ci: add GitHub Actions CI workflow + Rust 2024 edition (#11) #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| validate: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| # Pinned to full commit SHA for supply-chain security (actions/checkout@v4) | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| with: | |
| persist-credentials: false | |
| # Pinned to full commit SHA for dtolnay/rust-toolchain (corresponds to v1 tag) | |
| # This ensures immutable build behavior and satisfies security scanners. | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 | |
| with: | |
| toolchain: stable | |
| components: clippy, rustfmt | |
| # Swatinem/rust-cache is used instead of raw actions/cache + static key. | |
| # It handles Rust-specific caching (including git deps like neuromod) and | |
| # avoids the Cargo.lock gitignore problem that caused stale caches. | |
| - name: Cache cargo registry | |
| uses: Swatinem/rust-cache@42dc69e1aa15d09112580998cf2ef0119e2e91ae | |
| - name: Check formatting | |
| run: cargo fmt --check | |
| - name: Clippy (lint) | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| run: cargo build --all-features | |
| - name: Test | |
| run: cargo test --all-features |