name: Rust CI on: push: branches: - master - aether-rust-pioneer paths: - "Cargo.toml" - "Cargo.lock" - "crates/**" - "apps/**" - ".github/workflows/rust-ci.yml" pull_request: paths: - "Cargo.toml" - "Cargo.lock" - "crates/**" - "apps/**" - ".github/workflows/rust-ci.yml" concurrency: group: rust-ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always jobs: fmt: name: Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Show Rust toolchain run: rustup show active-toolchain - name: Install rustfmt component run: rustup component add rustfmt - name: Format run: cargo fmt --all --check clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Show Rust toolchain run: rustup show active-toolchain - name: Install clippy component run: rustup component add clippy - name: Rust cache uses: Swatinem/rust-cache@v2 with: shared-key: rust-ci-${{ runner.os }} workspaces: . -> target - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.9 - name: Clippy env: RUSTC_WRAPPER: sccache SCCACHE_GHA_ENABLED: "true" run: cargo clippy --workspace --all-targets -- -D warnings - name: Show sccache stats if: always() env: RUSTC_WRAPPER: sccache SCCACHE_GHA_ENABLED: "true" run: sccache --show-stats test: name: Test runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Show Rust toolchain run: rustup show active-toolchain - name: Rust cache uses: Swatinem/rust-cache@v2 with: shared-key: rust-ci-${{ runner.os }} workspaces: . -> target - name: Setup sccache uses: mozilla-actions/sccache-action@v0.0.9 - name: Test env: RUSTC_WRAPPER: sccache SCCACHE_GHA_ENABLED: "true" run: cargo test --workspace - name: Show sccache stats if: always() env: RUSTC_WRAPPER: sccache SCCACHE_GHA_ENABLED: "true" run: sccache --show-stats check: name: check runs-on: ubuntu-latest needs: - fmt - clippy - test if: ${{ always() }} steps: - name: Verify required jobs run: | if [ "${{ needs.fmt.result }}" != "success" ] || \ [ "${{ needs.clippy.result }}" != "success" ] || \ [ "${{ needs.test.result }}" != "success" ]; then echo "Rust CI failed" exit 1 fi