--- name: Cargo build and test on: pull_request: paths: - .github/workflows/*.yml - '**/*.rs' - Cargo.toml - Cargo.lock workflow_dispatch: env: CARGO_TERM_COLOR: always RUSTFLAGS: "--deny warnings " jobs: build-and-test: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] rust: [stable, beta] include: - os: ubuntu-latest rust: nightly - os: ubuntu-latest rust: 1.70.0 runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1.0.6 with: toolchain: ${{ matrix.rust }} default: true - name: Install cargo-hack uses: taiki-e/install-action@cargo-hack # The miri tests use too new Rust features to build on the oldest CI Rust version - name: Remove miri tests on old Rust if: matrix.rust == '1.70.0' run: rm tests/miri.rs - name: Build shell: bash run: cargo build --locked # Run through all tests with all combinations of features - name: Test shell: bash run: cargo hack --feature-powerset --exclude-all-features test # Run `cargo test` but with artificial delay injected into some code paths. This helps # running through some hard-to-time code paths. loom testing is not included since it is not # compatible nor make any sense together with sleeping. - name: Test with artificial delay shell: bash run: RUSTFLAGS+="--cfg oneshot_test_delay" cargo hack --feature-powerset --exclude-all-features test # Compile the library against loom to do correctness testing. # `--features loom` must be given so that only feature powerset combinations including loom are tested. - name: Test with loom shell: bash run: | RUSTFLAGS+="--cfg oneshot_loom" LOOM_MAX_BRANCHES=100000 \ cargo hack --feature-powerset --exclude-all-features --features loom test # Check that the documentation builds and has no warnings - name: Build documentation shell: bash run: RUSTDOCFLAGS="--deny warnings" cargo hack --feature-powerset --exclude-all-features doc miri: name: "Miri" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Miri run: | rustup toolchain install nightly --component miri rustup override set nightly cargo miri setup - name: Test with Miri run: | MIRIFLAGS="-Zmiri-many-seeds=0..512 -Zmiri-backtrace=full" \ cargo miri test --test miri