@@ -50,7 +50,7 @@ concurrency:
5050# Set default env vars
5151env :
5252 RUST_BACKTRACE : full
53- TEST_TIMEOUT : 30
53+ TEST_TIMEOUT : 60
5454 # Minimum number of PR approvals required before running the tests
5555 REQUIRED_APPROVALS : 2
5656 # Number of generated cases to run per selected proptest.
@@ -283,7 +283,11 @@ jobs:
283283
284284 # List every test present on the HEAD branch.
285285 - name : List HEAD branch tests
286+ env :
287+ HEAD_REF : ${{ github.event.pull_request.head.ref || github.ref_name }}
286288 run : |
289+ echo "Head branch: $HEAD_REF"
290+
287291 cargo nextest list \
288292 --archive-file ${{ needs.setup-env.outputs.test-archive-file }} \
289293 -Tjson 2>/dev/null \
@@ -296,56 +300,52 @@ jobs:
296300 | sort > /tmp/head-tests.txt
297301 echo "HEAD tests: $(wc -l < /tmp/head-tests.txt)"
298302
299- # Check out the base branch into a temporary git worktree and compile
300- # it to list its tests.
301- #
302- # CARGO_TARGET_DIR is pointed at the HEAD workspace's target/ directory.
303- # Anything unchanged between HEAD and BASE (external deps and
304- # unmodified stacks-core crates) is reused, so only the crates
305- # that actually differ need recompiling.
303+ # Check out the base branch into a temporary git worktree and compile it
304+ # to list its tests, building in the worktree's own target/. The worktree
305+ # (and its build output) is removed afterwards.
306306 #
307- # NOTE:
308- # Overwriting HEAD binaries in target/ is harmless — the test-run step
309- # uses --archive-file, which extracts HEAD binaries into a temp dir and
310- # never reads from target/.
311- #
312- # Reusing HEAD's target/ is only effective when testenv fell back to a local
313- # build (cache miss): that build uses no special RUSTFLAGS, so the artifacts
314- # are compatible and Rust only recompiles the crates that differ from BASE.
315- # When testenv succeeds (cache hit), target/ contains artifacts built with
316- # -Cinstrument-coverage (from manage-test-caches). The flag mismatch invalidates
317- # every fingerprint, forcing a full recompile regardless — no faster than
318- # using a fresh target directory (and it's not worth using same flag either).
307+ # This is always a full compile: the ./target/debug/ restored by "Restore
308+ # Test Archive Cache" was built with -C instrument-coverage by
309+ # setup-test-caches, so its fingerprints never match this list-only build
310+ # and there is nothing to reuse. RUSTFLAGS only allows warnings here — the
311+ # job-wide `-D warnings` would otherwise turn a benign warning into a hard
312+ # error and leave an empty list.
319313 - name : List BASE branch tests
320314 env :
321315 BASE_REF : ${{ github.event.pull_request.base.ref || inputs.base_ref }}
316+ RUSTFLAGS : " -A warnings"
317+ shell : bash
322318 run : |
323319 echo "Base branch: $BASE_REF"
324320
325321 git fetch --depth=1 origin "$BASE_REF"
326322 git worktree add --detach /tmp/base-worktree "origin/$BASE_REF"
327323
328- # Capture HEAD workspace root before entering the worktree
329- head_target="$(pwd)/target"
330-
324+ # Build in the worktree's own target/ (no HEAD target/ reuse — see note).
331325 pushd /tmp/base-worktree
332- CARGO_TARGET_DIR="$head_target" \
333- cargo nextest list \
334- -Tjson 2>/dev/null \
335- | jq -r '
326+ cargo nextest list -Tjson > /tmp/base-list.json
327+ popd
328+
329+ # Remove the worktree along with its build output (--force because the
330+ # compile above populated its target/).
331+ git worktree remove --force /tmp/base-worktree
332+ git worktree prune
333+
334+ jq -r '
336335 .["rust-suites"]
337336 | to_entries[]
338337 | .value.testcases
339338 | keys[]
340- ' \
339+ ' /tmp/base-list.json \
341340 | sort > /tmp/base-tests.txt
342- popd
343-
344- # Worktree source files are clean (build output went to HEAD_TARGET)
345- git worktree remove /tmp/base-worktree
346- git worktree prune
341+
342+ base_count=$(wc -l < /tmp/base-tests.txt)
343+ echo "Base tests: $base_count"
347344
348- echo "Base tests: $(wc -l < /tmp/base-tests.txt)"
345+ if [ "$base_count" -eq 0 ]; then
346+ echo "::error::BASE test listing is empty — aborting to avoid treating all HEAD tests as new."
347+ exit 1
348+ fi
349349
350350 # Compare the HEAD and base test lists and keep only tests that are new in HEAD.
351351 # Then filter to only those tagged with :t::...:t_prop:, i.e. test names of the form:
0 commit comments