diff --git a/.anvil.lock b/.anvil.lock index c1bee4b7f..f37bc73ed 100644 --- a/.anvil.lock +++ b/.anvil.lock @@ -1,7 +1,7 @@ version = 1 tool = "anvil" tool_version = "0.6.0" -catalog_checksum = "sha256:b1b94e5783dbe34fbf8f9c69a5e14cec3ece374e58876358ef4cd151f3f94e68" +catalog_checksum = "sha256:3415a24c3e1b7216ecfd37ecfda02b4e6039851b70f07e45a676597254874191" [[file]] path = ".anvil/container/Dockerfile.dockerignore" @@ -21,7 +21,7 @@ checksum = "sha256:d564a0ce424cda58c8f5b2476cf0c8b36e759afbdf8227608bd1f3fc74913 [[file]] path = ".github/actions/anvil-setup/action.yml" -checksum = "sha256:e1029f7ff95a5966184b4c04ccbed04ee8ba93bfc93bc9ac307d3dcef31374fb" +checksum = "sha256:a8e3cb37301ef39783721603b5145ab73dc79b7b4897c06b43b03db1f224a8a8" [[file]] path = ".github/actions/anvil-setup/just-problem-matcher.json" @@ -33,7 +33,7 @@ checksum = "sha256:7c43a36153ec346427892dca414fe971da616f99827fb5241167b1cf58a97 [[file]] path = ".github/workflows/anvil-pr-impl.yml" -checksum = "sha256:70c77226f9efe7252047d9ea4be93a1ac328708e72f4665214cb0c13e06b5c80" +checksum = "sha256:6368d048bf4921279b4f67306b22125cd48778e9d299508af1cb34f67f1de1a5" [[file]] path = ".github/workflows/anvil-pr.yml" @@ -41,7 +41,7 @@ checksum = "sha256:0c2530d9a38e6a74e0a7fd4f999b4a1790f97de30b58b68c6c2344600da19 [[file]] path = ".github/workflows/anvil-scheduled-impl.yml" -checksum = "sha256:ee1261dc018f6bdf3252890b57f0bc9510810c69505a64d3aef6d26315b824a3" +checksum = "sha256:5550d9e336bff247a92cbea1698b38dde7b0f97ae811928f23e023fd773e3652" [[file]] path = ".github/workflows/anvil-scheduled.yml" @@ -141,7 +141,7 @@ checksum = "sha256:9e9d0cbfef1e1e1586c2af4e9c387719c2f017ea1203d326baacc3ae25df8 [[file]] path = "justfiles/anvil/checks/msrv-test.just" -checksum = "sha256:9c25b140dcaa4b38db7701fd627dd9a2d5ad5f9bb83d4490c146058bf4328cc8" +checksum = "sha256:3f8690b4b8ec60b1b1aa3f35b32797f7b81eb64b347080ba9ee8b21e1b55ecce" [[file]] path = "justfiles/anvil/checks/mutants-diff.just" diff --git a/.github/actions/anvil-setup/action.yml b/.github/actions/anvil-setup/action.yml index 0c5c0077a..1441dbc46 100644 --- a/.github/actions/anvil-setup/action.yml +++ b/.github/actions/anvil-setup/action.yml @@ -109,7 +109,7 @@ runs: # cargo-binstall keeps the cold bootstrap path fast. - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.21.0 # immutable release, the tag cannot be moved + uses: cargo-bins/cargo-binstall@v1.21.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) - name: Install just shell: bash diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index b80e103d9..7e4532ab9 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -107,7 +107,7 @@ runs: - name: Install Cargo Tools if: inputs.cargo-tools != '' - uses: taiki-e/install-action@v2.81.8 # immutable release, the tag cannot be moved + uses: taiki-e/install-action@v2.81.8 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: tool: ${{ steps.expand.outputs.cargo_tools }} diff --git a/.github/workflows/anvil-pr-impl.yml b/.github/workflows/anvil-pr-impl.yml index d7738e376..3827022c1 100644 --- a/.github/workflows/anvil-pr-impl.yml +++ b/.github/workflows/anvil-pr-impl.yml @@ -154,13 +154,13 @@ jobs: # write tokens). - name: Upsert anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') != '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver path: target/anvil/comments/semver.md - name: Clear anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') == '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver delete: true @@ -216,7 +216,7 @@ jobs: # fails. The separate hashFiles predicates require both feature # configurations; one multi-pattern call would accept a partial pair. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: ${{ matrix.os }} diff --git a/.github/workflows/anvil-scheduled-impl.yml b/.github/workflows/anvil-scheduled-impl.yml index fae9fd00e..e29176663 100644 --- a/.github/workflows/anvil-scheduled-impl.yml +++ b/.github/workflows/anvil-scheduled-impl.yml @@ -73,7 +73,7 @@ jobs: # the Codecov UI can distinguish PR-tier uploads from scheduled # uploads while still tracking each platform separately. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: scheduled,${{ matrix.os }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ae85e8aad..51d29ffa0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -69,7 +69,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4.37.7 # immutable release, the tag cannot be moved + uses: github/codeql-action/init@v4.37.7 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} @@ -98,6 +98,6 @@ jobs: exit 1 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4.37.7 # immutable release, the tag cannot be moved + uses: github/codeql-action/analyze@v4.37.7 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d61280d13..3fb03f4c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -154,14 +154,14 @@ jobs: - name: Post Semver Failure Comment if: steps.semver.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: semver-check path: semver-comment.txt - name: Remove Semver Comment on Success if: steps.semver.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: semver-check delete: true @@ -262,7 +262,7 @@ jobs: - name: Generate Coverage (no-default-features) run: cargo +${{ env.RUST_NIGHTLY }} llvm-cov --no-default-features --workspace --lcov --output-path lcov-no-def.info - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: token: ${{ secrets.CODECOV_TOKEN }} files: lcov-all.info,lcov-no-def.info diff --git a/crates/cargo-anvil/README.md b/crates/cargo-anvil/README.md index d3eb1fb20..cafec43c2 100644 --- a/crates/cargo-anvil/README.md +++ b/crates/cargo-anvil/README.md @@ -298,7 +298,7 @@ both locally and in cloud workflows. `pr-fast` is one job, while the pr-slowpr-testllvm-covdual feature-config; gated by cargo-coverage-gate doc-testruns both feature configs examplescompile-only - pr-msrvmsrv-testdual feature-config, all-target tests under the declared MSRV + pr-msrvmsrv-testdual feature-config; lib/bin/integration tests under the declared MSRV (benches and examples are not run) pr-runtime-analysismirilibtest, not nextest carefulself-cleans on a toolchain bump loomopt-in targets only @@ -491,7 +491,7 @@ And `docs/verification.md` for the continuous-validation strategy. This crate was developed as part of The Oxidizer Project. Browse this crate's source code. - [__cargo_doc2readme_dependencies_info]: ggGmYW0CYXZlMC43LjNhdIQbFhzZ8rzWNNYbuRaDSGWynFgbH4PMdoT7GNcbVwNPtPjAhvFhYvRhcoQbLvVGTNtetQUbnp9vX0Ew7_gbkZEyxfXZXyMbltL72AXa-o1hZIGDa2NhcmdvLWFudmlsZTAuNi4wa2NhcmdvX2Fudmls + [__cargo_doc2readme_dependencies_info]: ggGmYW0CYXZlMC43LjNhdIQbFhzZ8rzWNNYbuRaDSGWynFgbH4PMdoT7GNcbVwNPtPjAhvFhYvRhcoQbVqn03OrTnSYblGjeKgXeGVgb6z3iwQiK18Abc5kLxsXto9xhZIGDa2NhcmdvLWFudmlsZTAuNi4wa2NhcmdvX2Fudmls [__link0]: https://crates.io/crates/cargo-delta [__link1]: https://docs.rs/cargo-anvil/0.6.0/cargo_anvil/?search=artifacts::container [__link10]: https://docs.rs/cargo-anvil/0.6.0/cargo_anvil/?search=artifacts diff --git a/crates/cargo-anvil/docs/design/README.md b/crates/cargo-anvil/docs/design/README.md index 601deeded..6b144dafc 100644 --- a/crates/cargo-anvil/docs/design/README.md +++ b/crates/cargo-anvil/docs/design/README.md @@ -206,7 +206,7 @@ update the recipes or cloud-workflow building blocks. A user with only `cargo` (no `just`, no `cargo-anvil`) can still run the basics: ```sh -cargo test --workspace --all-targets --all-features --locked +cargo test --workspace --tests --all-features --locked cargo clippy --workspace --all-targets --all-features --locked -- -D warnings cargo fmt --check ``` diff --git a/crates/cargo-anvil/docs/design/ado.md b/crates/cargo-anvil/docs/design/ado.md index 135df73a4..a8d6db50e 100644 --- a/crates/cargo-anvil/docs/design/ado.md +++ b/crates/cargo-anvil/docs/design/ado.md @@ -373,7 +373,7 @@ x86_64 jobs and per-OS affected-package impact sets as `pr_test`, and invokes `anvil-pr-msrv`. The stage consumes the per-OS impact artifact like the other PR groups; when the root manifest declares no MSRV, the recipe exits successfully after reporting that it skipped the test. Otherwise it runs affected-package -`cargo test --all-targets` in all-features and default-features configurations. +`cargo test --tests` in all-features and default-features configurations. Ordinary stable checks honor a caller-provided `RUSTUP_TOOLCHAIN`. The dedicated MSRV setup ensures the declared root MSRV is available through rustup. diff --git a/crates/cargo-anvil/docs/design/checks.md b/crates/cargo-anvil/docs/design/checks.md index 7ccb24994..aebbc9659 100644 --- a/crates/cargo-anvil/docs/design/checks.md +++ b/crates/cargo-anvil/docs/design/checks.md @@ -211,20 +211,36 @@ matrix overhead. #### `pr-msrv` (minimum-version tests) -When the root manifest declares an MSRV, Anvil runs `cargo test --all-targets` -for affected packages under that compiler. Cargo's all-target set covers -library and binary unit tests, integration tests, examples, and benches as test -targets. Anvil runs exactly two feature configurations: `--all-features` and +When the root manifest declares an MSRV, Anvil runs `cargo test --tests` +for affected packages under that compiler. `--tests` selects every target that +carries `test = true` -- library and binary unit tests, and integration tests. +Anvil runs exactly two feature configurations: `--all-features` and the default features. It does not add a `--no-default-features` pass; such a pass can exercise feature-negative code, but it is outside the current policy. -This is the all-target test execution at the minimum supported compiler; +This is the test execution at the minimum supported compiler; `pr-test` runs the same affected suite through coverage instrumentation on the catalog nightly. Other checks that use the selected stable compiler do not execute -this all-target suite, so an MSRV fallback does not make `pr-msrv` a duplicate. +this suite, so an MSRV fallback does not make `pr-msrv` a duplicate. A selecting toolchain file does not suppress the MSRV run, even when it selects the same compiler, because the MSRV group is the authoritative minimum-version test result. +The check deliberately does **not** use `--all-targets`. That flag expands to +`--lib --bins --tests --benches --examples`, which makes `cargo test` build *and +execute* every bench harness. A bench declared `harness = false` delegates its +run to a separate driver binary -- criterion's, or a profiler runner such as +`gungraun-runner` driving Valgrind -- and `anvil-msrv-test-setup` installs only +the MSRV toolchain, so that driver is absent and the group fails on a +prerequisite it never declares. That failure says nothing about the minimum +supported version. It also matches the repository-wide policy that benches and +examples are compiled but never run: `bench` uses `cargo bench --no-run` and +`examples` uses `cargo build --examples`, and both keep that compile coverage on +the selected stable compiler. `--tests` is preferred over the equivalent +`--lib --bins --tests` because `--lib` errors with "no library targets found" on +a bin-only affected package under impact scoping, the same reason `miri` uses it. +No doctest coverage is lost, since `--all-targets` suppresses doctests too and +`doc-test` owns them. + The group uses the same OS/architecture matrix and per-OS impact sets as `pr-test` so cfg-gated targets and dependencies are exercised under the MSRV. It runs in parallel with the other PR groups. When no root MSRV exists, diff --git a/crates/cargo-anvil/docs/design/github.md b/crates/cargo-anvil/docs/design/github.md index 83f16ec95..f97255ae0 100644 --- a/crates/cargo-anvil/docs/design/github.md +++ b/crates/cargo-anvil/docs/design/github.md @@ -990,8 +990,9 @@ the repository is deleted and recreated, and publishing generates a release attestation covering the tag, commit SHA and assets. The tag is a stable identifier under those rules, and unlike a SHA it stays readable in the diff when the pin is bumped. Generated files carry a -`# immutable release, the tag cannot be moved` comment at each such pin, so the reason -a tag appears where a SHA is otherwise expected is visible at the use site. +`# pinned by tag: this release is an immutable release (GitHub locks the tag to a commit)` +comment at each such pin, so the reason a tag appears where a SHA is otherwise +expected is visible at the use site. Every other action is pinned by commit SHA with the version in a trailing comment, for example `actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1`. @@ -1031,7 +1032,7 @@ The upload step: ```yaml - name: Upload coverage to Codecov if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: ${{ matrix.os }} diff --git a/crates/cargo-anvil/docs/design/local.md b/crates/cargo-anvil/docs/design/local.md index f2aecb668..7cec05cac 100644 --- a/crates/cargo-anvil/docs/design/local.md +++ b/crates/cargo-anvil/docs/design/local.md @@ -439,9 +439,10 @@ compiler. Anvil does not provision a separate tooling compiler; checks that require nightly continue to use their catalog-pinned nightly. When the root manifest declares an MSRV, `anvil-msrv-test` runs affected-package -`cargo test --all-targets` in all-features and default-features configurations -under that compiler. This includes library and binary unit tests, integration -tests, examples, and benches as test targets. It does not add a +`cargo test --tests` in all-features and default-features configurations +under that compiler. This covers library and binary unit tests and integration +tests; benches and examples are deliberately excluded, because `cargo test` +would execute bench harnesses. It does not add a `--no-default-features` pass. A root toolchain file does not suppress this minimum-version run. Without a root MSRV the recipe is a no-op. @@ -690,7 +691,7 @@ exactly the same arguments cloud workflows uses, because cloud workflows invokes A user with only `cargo` (no `just`, no `cargo-anvil`) can still run the basics: ```sh -cargo test --workspace --all-targets --all-features --locked +cargo test --workspace --tests --all-features --locked cargo clippy --workspace --all-targets --all-features --locked -- -D warnings cargo fmt --check ``` diff --git a/crates/cargo-anvil/src/lib.rs b/crates/cargo-anvil/src/lib.rs index 31fd78811..1d665f5e9 100644 --- a/crates/cargo-anvil/src/lib.rs +++ b/crates/cargo-anvil/src/lib.rs @@ -299,7 +299,7 @@ //! pr-slowpr-testllvm-covdual feature-config; gated by cargo-coverage-gate //! doc-testruns both feature configs //! examplescompile-only -//! pr-msrvmsrv-testdual feature-config, all-target tests under the declared MSRV +//! pr-msrvmsrv-testdual feature-config; lib/bin/integration tests under the declared MSRV (benches and examples are not run) //! pr-runtime-analysismirilibtest, not nextest //! carefulself-cleans on a toolchain bump //! loomopt-in targets only diff --git a/crates/cargo-anvil/templates/github/pr-impl-workflow.yml b/crates/cargo-anvil/templates/github/pr-impl-workflow.yml index d7738e376..3827022c1 100644 --- a/crates/cargo-anvil/templates/github/pr-impl-workflow.yml +++ b/crates/cargo-anvil/templates/github/pr-impl-workflow.yml @@ -154,13 +154,13 @@ jobs: # write tokens). - name: Upsert anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') != '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver path: target/anvil/comments/semver.md - name: Clear anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') == '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver delete: true @@ -216,7 +216,7 @@ jobs: # fails. The separate hashFiles predicates require both feature # configurations; one multi-pattern call would accept a partial pair. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: ${{ matrix.os }} diff --git a/crates/cargo-anvil/templates/github/scheduled-impl-workflow.yml b/crates/cargo-anvil/templates/github/scheduled-impl-workflow.yml index fae9fd00e..e29176663 100644 --- a/crates/cargo-anvil/templates/github/scheduled-impl-workflow.yml +++ b/crates/cargo-anvil/templates/github/scheduled-impl-workflow.yml @@ -73,7 +73,7 @@ jobs: # the Codecov UI can distinguish PR-tier uploads from scheduled # uploads while still tracking each platform separately. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: scheduled,${{ matrix.os }} diff --git a/crates/cargo-anvil/templates/github/setup-action.yml b/crates/cargo-anvil/templates/github/setup-action.yml index 0c5c0077a..1441dbc46 100644 --- a/crates/cargo-anvil/templates/github/setup-action.yml +++ b/crates/cargo-anvil/templates/github/setup-action.yml @@ -109,7 +109,7 @@ runs: # cargo-binstall keeps the cold bootstrap path fast. - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.21.0 # immutable release, the tag cannot be moved + uses: cargo-bins/cargo-binstall@v1.21.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) - name: Install just shell: bash diff --git a/crates/cargo-anvil/templates/justfiles/anvil/checks/msrv-test.just b/crates/cargo-anvil/templates/justfiles/anvil/checks/msrv-test.just index f95b38cff..915ac4284 100644 --- a/crates/cargo-anvil/templates/justfiles/anvil/checks/msrv-test.just +++ b/crates/cargo-anvil/templates/justfiles/anvil/checks/msrv-test.just @@ -23,9 +23,14 @@ anvil-msrv-test: anvil-msrv-test-validate-prereqs anvil-impact exit 0 } $pkg = @(if ($include) { -split $include } else { '--workspace' }) - & cargo "+$toolchain" test @pkg --all-targets --all-features --locked + # `--tests` = lib/bin unit tests + integration tests. NOT `--all-targets`, + # which adds `--benches`: `cargo test` EXECUTES bench harnesses, and a + # `harness = false` bench needs a driver binary this group never installs. + # Benches/examples stay compile-only (`anvil-bench`, `anvil-examples`). + # `--tests` over `--lib --bins --tests`: `--lib` fails on bin-only packages. + & cargo "+$toolchain" test @pkg --tests --all-features --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & cargo "+$toolchain" test @pkg --all-targets --locked + & cargo "+$toolchain" test @pkg --tests --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Install the declared MSRV toolchain only when this check is required. diff --git a/crates/cargo-anvil/tests/impact.rs b/crates/cargo-anvil/tests/impact.rs index bb7649b09..9afcae294 100644 --- a/crates/cargo-anvil/tests/impact.rs +++ b/crates/cargo-anvil/tests/impact.rs @@ -1036,11 +1036,18 @@ fn msrv_test_uses_affected_packages_for_both_feature_modes_and_skips_without_msr assert!(output.status.success(), "anvil-msrv-test failed:\n{combined}"); let argv = fs::read_to_string(&log).unwrap(); for expected in [ - format!("+1.97 test {affected} --all-targets --all-features --locked"), - format!("+1.97 test {affected} --all-targets --locked"), + format!("+1.97 test {affected} --tests --all-features --locked"), + format!("+1.97 test {affected} --tests --locked"), ] { assert!(argv.contains(&expected), "missing MSRV invocation '{expected}' in:\n{argv}"); } + // The MSRV check must not build or execute bench targets: `--all-targets` + // expands to include `--benches`, and a `harness = false` bench then runs + // through a driver binary the msrv setup chain never installs. + assert!( + !argv.contains("--all-targets") && !argv.contains("--benches"), + "MSRV invocations must not select bench targets; captured argv:\n{argv}" + ); let manifest = fs::read_to_string(root.join("Cargo.toml")).unwrap(); fs::write( diff --git a/crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap b/crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap index bbcffad60..c6ba50a5a 100644 --- a/crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap +++ b/crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap @@ -2790,9 +2790,14 @@ anvil-msrv-test: anvil-msrv-test-validate-prereqs anvil-impact exit 0 } $pkg = @(if ($include) { -split $include } else { '--workspace' }) - & cargo "+$toolchain" test @pkg --all-targets --all-features --locked + # `--tests` = lib/bin unit tests + integration tests. NOT `--all-targets`, + # which adds `--benches`: `cargo test` EXECUTES bench harnesses, and a + # `harness = false` bench needs a driver binary this group never installs. + # Benches/examples stay compile-only (`anvil-bench`, `anvil-examples`). + # `--tests` over `--lib --bins --tests`: `--lib` fails on bin-only packages. + & cargo "+$toolchain" test @pkg --tests --all-features --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & cargo "+$toolchain" test @pkg --all-targets --locked + & cargo "+$toolchain" test @pkg --tests --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Install the declared MSRV toolchain only when this check is required. diff --git a/crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap b/crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap index 3a91bee1e..ade9fb802 100644 --- a/crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap +++ b/crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap @@ -597,7 +597,7 @@ runs: # cargo-binstall keeps the cold bootstrap path fast. - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@v1.21.0 # immutable release, the tag cannot be moved + uses: cargo-bins/cargo-binstall@v1.21.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) - name: Install just shell: bash @@ -997,13 +997,13 @@ jobs: # write tokens). - name: Upsert anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') != '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver path: target/anvil/comments/semver.md - name: Clear anvil-semver advisory if: always() && github.event_name == 'pull_request' && matrix.os == 'linux' && github.event.pull_request.head.repo.full_name == github.repository && hashFiles('target/anvil/comments/semver.md') == '' - uses: marocchino/sticky-pull-request-comment@v3.0.5 # immutable release, the tag cannot be moved + uses: marocchino/sticky-pull-request-comment@v3.0.5 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: header: anvil-semver delete: true @@ -1059,7 +1059,7 @@ jobs: # fails. The separate hashFiles predicates require both feature # configurations; one multi-pattern call would accept a partial pair. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: ${{ matrix.os }} @@ -1292,7 +1292,7 @@ jobs: # the Codecov UI can distinguish PR-tier uploads from scheduled # uploads while still tracking each platform separately. if: always() && matrix.os != 'windows-arm' && hashFiles('target/coverage/lcov-all-features.info') != '' && hashFiles('target/coverage/lcov-no-default.info') != '' - uses: codecov/codecov-action@v7.0.0 # immutable release, the tag cannot be moved + uses: codecov/codecov-action@v7.0.0 # pinned by tag: this release is an immutable release (GitHub locks the tag to a commit) with: files: target/coverage/lcov-all-features.info,target/coverage/lcov-no-default.info flags: scheduled,${{ matrix.os }} @@ -2927,9 +2927,14 @@ anvil-msrv-test: anvil-msrv-test-validate-prereqs anvil-impact exit 0 } $pkg = @(if ($include) { -split $include } else { '--workspace' }) - & cargo "+$toolchain" test @pkg --all-targets --all-features --locked + # `--tests` = lib/bin unit tests + integration tests. NOT `--all-targets`, + # which adds `--benches`: `cargo test` EXECUTES bench harnesses, and a + # `harness = false` bench needs a driver binary this group never installs. + # Benches/examples stay compile-only (`anvil-bench`, `anvil-examples`). + # `--tests` over `--lib --bins --tests`: `--lib` fails on bin-only packages. + & cargo "+$toolchain" test @pkg --tests --all-features --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & cargo "+$toolchain" test @pkg --all-targets --locked + & cargo "+$toolchain" test @pkg --tests --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Install the declared MSRV toolchain only when this check is required. diff --git a/crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap b/crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap index 9855809a6..df2d8cc6a 100644 --- a/crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap +++ b/crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap @@ -1660,9 +1660,14 @@ anvil-msrv-test: anvil-msrv-test-validate-prereqs anvil-impact exit 0 } $pkg = @(if ($include) { -split $include } else { '--workspace' }) - & cargo "+$toolchain" test @pkg --all-targets --all-features --locked + # `--tests` = lib/bin unit tests + integration tests. NOT `--all-targets`, + # which adds `--benches`: `cargo test` EXECUTES bench harnesses, and a + # `harness = false` bench needs a driver binary this group never installs. + # Benches/examples stay compile-only (`anvil-bench`, `anvil-examples`). + # `--tests` over `--lib --bins --tests`: `--lib` fails on bin-only packages. + & cargo "+$toolchain" test @pkg --tests --all-features --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & cargo "+$toolchain" test @pkg --all-targets --locked + & cargo "+$toolchain" test @pkg --tests --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Install the declared MSRV toolchain only when this check is required. diff --git a/justfiles/anvil/checks/msrv-test.just b/justfiles/anvil/checks/msrv-test.just index f95b38cff..915ac4284 100644 --- a/justfiles/anvil/checks/msrv-test.just +++ b/justfiles/anvil/checks/msrv-test.just @@ -23,9 +23,14 @@ anvil-msrv-test: anvil-msrv-test-validate-prereqs anvil-impact exit 0 } $pkg = @(if ($include) { -split $include } else { '--workspace' }) - & cargo "+$toolchain" test @pkg --all-targets --all-features --locked + # `--tests` = lib/bin unit tests + integration tests. NOT `--all-targets`, + # which adds `--benches`: `cargo test` EXECUTES bench harnesses, and a + # `harness = false` bench needs a driver binary this group never installs. + # Benches/examples stay compile-only (`anvil-bench`, `anvil-examples`). + # `--tests` over `--lib --bins --tests`: `--lib` fails on bin-only packages. + & cargo "+$toolchain" test @pkg --tests --all-features --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - & cargo "+$toolchain" test @pkg --all-targets --locked + & cargo "+$toolchain" test @pkg --tests --locked if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Install the declared MSRV toolchain only when this check is required.