ci: drop redundant build step, document why clippy needs nightly (#422) #655
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: Rust | |
| on: | |
| push: | |
| branches: [dev] | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build_and_test: | |
| name: "Build and Test" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust Stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - uses: Swatinem/rust-cache@v2.7.7 | |
| - name: "Test" | |
| # Run all tests (bins, examples, lib, integration and docs) | |
| # https://doc.rust-lang.org/cargo/commands/cargo-test.html#target-selection | |
| run: cargo test | |
| - name: "Check documentation" | |
| # env: | |
| # RUSTDOCFLAGS: -D warnings | |
| run: cargo doc --no-deps --workspace --lib --document-private-items --examples | |
| rustfmt_and_clippy: | |
| name: Rustfmt and Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Nightly is required: .rustfmt.toml uses unstable options, and clippy | |
| # with --all-features builds matrix-transpose's simd-transpose feature, | |
| # which needs the nightly-only portable_simd language feature. | |
| - name: Install Rust Nightly with rustfmt and clippy | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly | |
| components: rustfmt, clippy | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2.7.7 | |
| - name: "Check formatting" | |
| run: cargo +nightly fmt --check --all | |
| - name: Run Clippy | |
| run: cargo +nightly clippy --workspace --exclude mpz-wasm-bench --all-targets --all-features -- -D warnings | |
| - name: Run Clippy on wasm-bench | |
| working-directory: crates/wasm-bench | |
| run: cargo +nightly clippy --lib --target wasm32-unknown-unknown -- -D warnings | |
| wasm: | |
| name: "Build and Test WASM bench" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust Nightly with rust-src | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: nightly | |
| targets: wasm32-unknown-unknown | |
| components: rust-src | |
| - uses: Swatinem/rust-cache@v2.7.7 | |
| - name: Install Chrome | |
| uses: browser-actions/setup-chrome@v2 | |
| with: | |
| chrome-version: stable | |
| - name: Build WASM bundle | |
| working-directory: crates/wasm-bench | |
| run: ./build-wasm.sh | |
| - name: Build benchmark runner | |
| run: cargo build --release --bin wasm-bench-runner | |
| - name: Smoke-test in headless Chrome | |
| working-directory: crates/wasm-bench | |
| run: ../../target/release/wasm-bench-runner -b garbler_core/half_gates --iterations 1 --samples 1 | |
| miri: | |
| if: ( ! github.event.pull_request.draft ) | |
| name: "Test with Miri" | |
| runs-on: ubuntu-latest | |
| env: | |
| # blake3's build.rs cross-compiles NEON asm for aarch64, which requires | |
| # a C cross-compiler the runner doesn't have. Miri can't meaningfully | |
| # interpret the asm anyway, so force the pure-Rust path by setting the | |
| # env var blake3 probes for its `no_neon` cargo feature. | |
| CARGO_FEATURE_NO_NEON: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # The `alloca` crate (a dev-dependency pulled in via criterion) has a | |
| # build script that cross-compiles C, which needs an aarch64 C compiler | |
| # for the aarch64 Miri target. | |
| - name: Install aarch64 cross compiler | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Install Miri | |
| run: | | |
| rustup toolchain install nightly --component miri | |
| rustup override set nightly | |
| cargo miri setup | |
| - name: Test with Miri on x86_64 | |
| run: cargo miri test -p clmul -p matrix-transpose -p mpz-fields --target x86_64-unknown-linux-gnu | |
| - name: Test with Miri on aarch64 | |
| run: cargo miri test -p clmul -p matrix-transpose -p mpz-fields --target aarch64-unknown-linux-gnu |