mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 21:02:45 -07:00
83 lines
2.0 KiB
YAML
83 lines
2.0 KiB
YAML
name: Rust CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build_and_test:
|
|
name: Build and test crates on ${{ matrix.os }} with rust ${{ matrix.toolchain }}
|
|
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
os:
|
|
- 'ubuntu-latest'
|
|
- 'macos-latest'
|
|
- 'windows-latest'
|
|
toolchain:
|
|
- 'stable'
|
|
|
|
# Test `beta` and `nightly` toolchains only on `ubuntu`
|
|
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow#expanding-or-adding-matrix-configurations
|
|
include:
|
|
- toolchain: 'beta'
|
|
os: 'ubuntu-latest'
|
|
- toolchain: 'nightly'
|
|
os: 'ubuntu-latest'
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
- run: cargo build --verbose
|
|
- run: cargo test --verbose
|
|
|
|
lint_and_fmt:
|
|
name: Check format and lint rust crates
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
- run: cargo fmt --all -- --check
|
|
- run: cargo clippy -- -D warnings
|
|
|
|
ci_ok:
|
|
name: Rust CI OK
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 1
|
|
if: always()
|
|
needs: [build_and_test, lint_and_fmt]
|
|
env:
|
|
FAILURE: ${{ contains(join(needs.*.result, ','), 'failure') }}
|
|
CANCELLED: ${{ contains(join(needs.*.result, ','), 'cancelled') }}
|
|
steps:
|
|
- name: Check for failure or cancelled jobs result
|
|
shell: bash
|
|
run: |
|
|
echo "Failure: $FAILURE - Cancelled: $CANCELLED"
|
|
if [ "$FAILURE" = "false" ] && [ "$CANCELLED" = "false" ]; then
|
|
exit 0
|
|
else
|
|
exit 1
|
|
fi
|