ci: update CI workflow (#57) #101
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
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| name: CI | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| config: | |
| name: Configuring Rust Versions | |
| runs-on: ubuntu-latest | |
| outputs: | |
| msrv: "1.86.0" # Also update `rust-version` in `Cargo.toml` | |
| stable: "1.93.0" # Stable release as of 2026-02-10 | |
| nightly: nightly | |
| steps: | |
| - run: echo "Configuring Rust versions..." | |
| ci: | |
| needs: config | |
| name: Rust ${{ matrix.rust }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| rust: | |
| - ${{ needs.config.outputs.msrv }} | |
| - ${{ needs.config.outputs.stable }} | |
| - ${{ needs.config.outputs.nightly }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rust }} | |
| components: rustfmt, clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Clippy (Stable Features) | |
| if: matrix.rust == needs.config.outputs.stable | |
| run: cargo clippy --workspace --all-targets --features stable -- -D warnings | |
| - name: Build (Stable Features) | |
| run: cargo build --features stable | |
| - name: Test (Stable Features) | |
| run: cargo test --features stable | |
| - name: Clippy (Default Features) | |
| if: matrix.rust == needs.config.outputs.stable | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| - name: Build (Default Features) | |
| run: cargo build | |
| - name: Test (Default Features) | |
| run: cargo test | |
| - name: Build (Minimal Features) | |
| run: cargo build --no-default-features | |
| - name: Test (Minimal Features) | |
| run: cargo test --no-default-features | |
| - name: Build (Unstable Features) | |
| if: matrix.rust == needs.config.outputs.nightly | |
| run: cargo build --all-features | |
| - name: Test (Unstable Features) | |
| if: matrix.rust == needs.config.outputs.nightly | |
| run: cargo test --all-features | |
| - name: Formatting | |
| if: matrix.rust == needs.config.outputs.stable | |
| run: cargo fmt --all -- --check | |
| - name: Install wasmtime | |
| if: matrix.rust == needs.config.outputs.stable | |
| run: | | |
| curl https://wasmtime.dev/install.sh -sSf | bash | |
| echo "$HOME/.wasmtime/bin" >> $GITHUB_PATH | |
| - name: Test (WASI) | |
| if: matrix.rust == needs.config.outputs.stable | |
| env: | |
| CARGO_TARGET_WASM32_WASIP1_RUNNER: wasmtime run --dir . -- | |
| run: | | |
| rustup target add wasm32-wasip1 | |
| cargo bench --target=wasm32-wasip1 --no-default-features -- --test | |
| nextest-compat: | |
| needs: config | |
| name: Check compatibility with nextest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ needs.config.outputs.stable }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - uses: taiki-e/install-action@nextest | |
| - run: ci/nextest-compat.sh | |
| # If this fails, consider changing your text or adding something to .typos.toml | |
| typos: | |
| name: Check typos | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: crate-ci/[email protected] | |
| # Make sure the library builds with all dependencies downgraded to their | |
| # oldest versions allowed by the semver spec. This ensures we have not | |
| # under-specified any dependency | |
| minimal-versions: | |
| needs: config | |
| name: Check Minimal Version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install needed Rust toolchain versions | |
| run: | | |
| rustup toolchain install "${{ needs.config.outputs.msrv }}" --profile minimal | |
| rustup toolchain install "${{ needs.config.outputs.nightly }}" --profile minimal | |
| - name: Downgrade dependencies to minimal versions | |
| run: cargo "+${{ needs.config.outputs.nightly }}" update -Z minimal-versions | |
| - name: Compile with minimal versions | |
| run: cargo "+${{ needs.config.outputs.msrv }}" build --all-targets --locked |