ci: 1.85 as the MSRV #1315
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: | |
| - main | |
| pull_request: | |
| paths: | |
| - Cargo.* | |
| - .cargo/** | |
| - .github/workflows/rust.yml | |
| - src/** | |
| - tests/** | |
| - testdata/** | |
| # see https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| CI: 1 | |
| RUST_BACKTRACE: short | |
| RUSTFLAGS: "-W rust-2021-compatibility" | |
| RUSTUP_MAX_RETRIES: 10 | |
| # TODO: Add -D warnings when that's clean on Windows. | |
| jobs: | |
| # Check this file seems clean before launching anything else. | |
| action-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check workflow files | |
| shell: bash | |
| run: | | |
| bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) | |
| # shellcheck disable=SC2046 | |
| ./actionlint -color $(find .github/workflows -name '*.yml' -type f ! -name release.yml -print) | |
| # Run tests just on Ubuntu to establish that things basically work, | |
| # before launching mutants etc | |
| quick-test: | |
| needs: [action-lint] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - uses: swatinem/rust-cache@v2 | |
| - name: Show version | |
| run: | | |
| rustup show | |
| cargo --version | |
| rustc --version | |
| - name: Test | |
| run: cargo test | |
| # S3 integration tests can't run from CI because they need credentials, but we | |
| # can at least make sure that they compile. | |
| - name: cargo build --all-targets --all-features | |
| run: cargo build --all-targets --all-features | |
| - name: rustfmt check | |
| run: cargo fmt --all -- --check | |
| # Don't run clippy because it's too prone to breaking when new lints are introduced. | |
| # - name: clippy | |
| # run: cargo clippy --all-targets --all-features -- --deny clippy::all | |
| - run: cargo check --no-default-features --all-targets | |
| - name: typos | |
| uses: crate-ci/typos@master | |
| tests: | |
| needs: [quick-test] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| # windows-latest: currently broken and too hard for me to maintain -- mbp 2025-07 | |
| os: [ubuntu-latest, macOS-latest] | |
| version: [stable, nightly, "1.85"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.version }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Show version | |
| run: | | |
| rustup show | |
| cargo --version | |
| rustc --version | |
| - name: Build | |
| run: cargo build --all-targets | |
| - name: Test (without mount) | |
| run: cargo test -- --skip mount --include-ignored | |
| - name: Test (mount) | |
| run: cargo test --test mount -- --include-ignored | |
| env: | |
| # Running multiple instances in parallel might cause a crash on low-end environments | |
| # when executing the mounting tests on Windows due to projfs. | |
| RUST_TEST_THREADS: 1 | |
| pr-mutants: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| needs: [quick-test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Relative diff | |
| run: | | |
| git branch -av | |
| git diff origin/${{ github.base_ref }}.. | tee git.diff | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: beta | |
| - uses: Swatinem/rust-cache@v2 | |
| - uses: taiki-e/install-action@v2 | |
| name: Install cargo-mutants using install-action | |
| with: | |
| tool: cargo-mutants | |
| - name: Mutants in diff | |
| run: > | |
| cargo mutants --no-shuffle -vV --in-diff git.diff --in-place | |
| --no-default-features | |
| - name: Archive mutants.out | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mutants-incremental.out | |
| path: mutants.out | |
| cargo-mutants: | |
| runs-on: ubuntu-latest | |
| needs: [quick-test] | |
| strategy: | |
| # We want to see all the missed mutants so don't fail fast. | |
| fail-fast: false | |
| matrix: | |
| shard: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| - uses: swatinem/rust-cache@v2 | |
| - name: Install cargo-mutants from git | |
| # Force install in case there's a slightly different version cached. | |
| run: cargo install --force --git https://github.com/sourcefrog/cargo-mutants cargo-mutants | |
| - name: Run mutant tests | |
| # Don't use the S3 features because they require AWS credentials for realistic | |
| # testing. | |
| run: > | |
| cargo mutants --no-shuffle -vV --in-place --baseline=skip | |
| --shard ${{ matrix.shard }}/10 | |
| --no-default-features | |
| - name: Archive results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: mutants-${{ matrix.shard }}.out | |
| path: mutants.out |