返回 CodeWhale
ci-test-suite.yml
根目录 / .github / workflows / ci-test-suite.yml
1 name: CI test suite
2
3 # Called by ci.yml, once per operating system, so each OS is its own pipeline:
4 # one build of the whole workspace's test binaries, parallel shards that run
5 # partitions of that one nextest archive, and a check that the shards together
6 # ran exactly the tests the archive lists. Running per OS means Linux reports
7 # as soon as Linux is done instead of waiting for the slowest build.
8 #
9 # Trust boundary: this runs with the caller's event. Nothing here writes a cache
10 # (rust-cache and sccache save only on main) or uses a write permission. The
11 # artifacts passed between jobs live inside one run. With self_hosted, which
12 # ci.yml sets only for a dispatch in this repository, the macOS build and its
13 # one shard run on the codewhale-mac runner and keep a local target, Cargo and
14 # rustup home under the runner's work directory between those trusted runs.
15
16 on:
17 workflow_call:
18 inputs:
19 os:
20 description: Hosted runner label
21 required: true
22 type: string
23 self_hosted:
24 description: Run on the self-hosted codewhale-mac runner instead of the hosted label (ci.yml sets it only for dispatches in this repository)
25 required: false
26 default: false
27 type: boolean
28 shards:
29 description: Number of shards, equal to the length of shard_list
30 required: true
31 type: number
32 shard_list:
33 description: JSON array of shard numbers, for example [1,2,3,4]
34 required: true
35 type: string
36 build_jobs:
37 description: CARGO_BUILD_JOBS for the test build
38 required: true
39 type: string
40 debug:
41 description: Debug-table level for the test build (CARGO_PROFILE_*_DEBUG)
42 required: true
43 type: string
44
45 permissions:
46 contents: read
47
48 env:
49 CARGO_TERM_COLOR: always
50 CARGO_INCREMENTAL: 0
51 RUSTFLAGS: -Dwarnings
52 RUST_MIN_STACK: 8388608
53
54 jobs:
55 build:
56 name: Build
57 # A cold hosted Mac compiled for 65 minutes with one Cargo job (run
58 # 43216596942) and the old one-job cap was 210; this job only compiles, so
59 # it keeps real margin without the test run in it.
60 timeout-minutes: 150
61 runs-on: ${{ inputs.self_hosted && fromJSON('["self-hosted","macOS","ARM64","codewhale-mac"]') || (inputs.os == 'ubuntu-latest' && 'ubuntu-24.04' || inputs.os) }}
62 env:
63 # Test builds compile all features of the whole workspace. One Cargo job
64 # kept hosted runners inside memory (exit 143 on 2026-10-19 with four);
65 # trimmed debug tables shrink compiler and linker memory so Linux and
66 # Windows can run two. Assertions and every test are unchanged.
67 CARGO_BUILD_JOBS: ${{ inputs.build_jobs }}
68 CARGO_PROFILE_DEV_DEBUG: ${{ inputs.debug }}
69 CARGO_PROFILE_TEST_DEBUG: ${{ inputs.debug }}
70 CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER: rust-lld
71 steps:
72 - name: Isolate homes, temp and target on the self-hosted Mac
73 if: runner.environment == 'self-hosted'
74 shell: bash
75 run: |
76 set -euo pipefail
77 state="${RUNNER_WORKSPACE}/ci-state"
78 job_tmp="$(mktemp -d /tmp/cwci.XXXXXX)"
79 mkdir -p "${state}/home" "${state}/target"
80 {
81 echo "HOME=${state}/home"
82 echo "CARGO_HOME=${state}/home/.cargo"
83 echo "RUSTUP_HOME=${state}/home/.rustup"
84 echo "CARGO_TARGET_DIR=${state}/target"
85 echo "TMPDIR=${job_tmp}"
86 echo "CW_JOB_TMP=${job_tmp}"
87 } >> "${GITHUB_ENV}"
88 - uses: actions/checkout@v7
89 - name: Test Windows installer PATH helper
90 if: inputs.os == 'windows-latest'
91 shell: pwsh
92 run: ./scripts/installer/update-user-path.tests.ps1
93 - name: Install NSIS for Windows installer regression
94 if: inputs.os == 'windows-latest'
95 shell: pwsh
96 run: ./scripts/installer/install-nsis.ps1
97 - name: Test Windows installer PATH regression
98 if: inputs.os == 'windows-latest'
99 shell: pwsh
100 run: ./scripts/installer/installer-path-regression.tests.ps1 -AllowUserPathMutation
101 - uses: dtolnay/rust-toolchain@1.100.0
102 - name: Install macOS LLVM tools
103 if: inputs.os == 'macos-latest'
104 run: rustup component add llvm-tools
105 - name: Start the persistent target from a known toolchain
106 if: runner.environment == 'self-hosted'
107 shell: bash
108 run: |
109 set -euo pipefail
110 stamp="${CARGO_TARGET_DIR}/.toolchain"
111 want="$(rustc -V)"
112 free_kib="$(df -Pk "${CARGO_TARGET_DIR}" | awk 'NR==2{print $4}')"
113 if [ "$(cat "${stamp}" 2>/dev/null || true)" != "${want}" ] || [ "${free_kib}" -lt 104857600 ]; then
114 echo "Starting an empty target for ${want} (${free_kib} KiB free)."
115 rm -rf "${CARGO_TARGET_DIR}"
116 mkdir -p "${CARGO_TARGET_DIR}"
117 printf '%s\n' "${want}" > "${stamp}"
118 fi
119 - uses: mozilla-actions/sccache-action@v0.0.11
120 if: runner.environment != 'self-hosted'
121 with:
122 version: "v0.19.0"
123 id: sccache
124 continue-on-error: true
125 # Every run reads the GitHub Actions cache main wrote; only main writes (see Enable sccache).
126 - name: Enable sccache
127 if: steps.sccache.outcome == 'success'
128 shell: bash
129 run: |
130 if [ "${GITHUB_REF}" = refs/heads/main ]; then rw=READ_WRITE; else rw=READ_ONLY; fi
131 {
132 echo "SCCACHE_GHA_ENABLED=true"
133 echo "SCCACHE_GHA_RW_MODE=${rw}"
134 echo "RUSTC_WRAPPER=sccache"
135 echo "SCCACHE_IGNORE_SERVER_IO_ERROR=1"
136 echo "SCCACHE_IDLE_TIMEOUT=0"
137 } >> "${GITHUB_ENV}"
138 - name: Install Linux system dependencies
139 if: inputs.os == 'ubuntu-latest'
140 run: |
141 bash scripts/ci/ci-apt-install.sh libdbus-1-dev pkg-config bubblewrap apparmor-profiles
142 sh scripts/ci/prepare-linux-test-sandbox.sh
143 - name: Ubuntu build headroom
144 # Reuse the same fixed hosted-runner provisioning as Safety and Lint.
145 # Exit 143 is a shutdown observation, not proof of OOM or timeout.
146 if: inputs.os == 'ubuntu-latest'
147 shell: bash
148 run: bash scripts/ci/prepare-ubuntu-build-headroom.sh
149 - uses: Swatinem/rust-cache@v2
150 if: runner.environment != 'self-hosted'
151 with:
152 cache-bin: false
153 cache-on-failure: true
154 save-if: ${{ github.ref == 'refs/heads/main' }}
155 - uses: taiki-e/install-action@b6620ca104fb7b50dafa1109be9622abc1fdd381
156 with:
157 tool: cargo-nextest@0.9.151
158 - uses: actions/setup-node@v7.1.0
159 with:
160 node-version: 22
161 - name: Hold this machine's build lock (self-hosted)
162 if: runner.environment == 'self-hosted'
163 shell: bash
164 run: |
165 if [ -z "${CODEWHALE_BUILD_LOCK_FILE:-}" ]; then
166 echo "CODEWHALE_BUILD_LOCK_FILE is not set on this runner; building without the machine lock."
167 exit 0
168 fi
169 hold="$RUNNER_TEMP/cw-build-lock.hold"
170 ready="$RUNNER_TEMP/cw-build-lock.ready"
171 log="$RUNNER_TEMP/cw-build-lock.log"
172 touch "$hold"
173 rm -f "$ready"
174 # shellcheck disable=SC2016
175 nohup python3 scripts/build-lock.py "$CODEWHALE_BUILD_LOCK_FILE" -- \
176 sh -c 'touch "$1"; while [ -e "$2" ]; do sleep 2; done' _ "$ready" "$hold" \
177 >"$log" 2>&1 &
178 shown=0
179 until [ -e "$ready" ]; do
180 if [ "$shown" -eq 0 ] && [ -s "$log" ]; then cat "$log"; shown=1; fi
181 sleep 2
182 done
183 cat "$log"
184 echo "CODEWHALE_BUILD_LOCK_HELD=1" >> "$GITHUB_ENV"
185 - name: Build canonical executable for acceptance tests
186 shell: bash
187 run: sh scripts/with-hermetic-test-home.sh cargo test --workspace --all-features --locked --no-run --test help_dispatch
188 env:
189 RUSTC_WRAPPER: ${{ inputs.os != 'windows-latest' && env.RUSTC_WRAPPER || '' }}
190 - name: Retain Apple Silicon executable for native pairing
191 if: inputs.os == 'macos-latest'
192 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
193 with:
194 name: native-engine-macos-latest
195 path: ${{ env.CARGO_TARGET_DIR || 'target' }}/debug/codewhale
196 if-no-files-found: error
197 retention-days: 1
198 - name: Windows Terminal clipboard-to-draft acceptance
199 if: inputs.os == 'windows-latest'
200 timeout-minutes: 5
201 shell: pwsh
202 run: node scripts/release/windows-terminal-clipboard.mjs target/debug/codewhale.exe "${{ runner.temp }}/windows-clipboard"
203 - name: Retain Windows Terminal clipboard-to-draft evidence
204 if: ${{ !cancelled() && inputs.os == 'windows-latest' }}
205 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
206 with:
207 name: windows-clipboard-${{ github.sha }}-${{ github.run_attempt }}
208 path: ${{ runner.temp }}/windows-clipboard/
209 if-no-files-found: error
210 retention-days: 7
211 - name: Archive test binaries
212 # One compile per OS. Shards run this archive with
213 # `cargo nextest run --archive-file`, so the suite is the same test
214 # binaries, built once. Doctests are not in the archive; they run
215 # below, once, while the library artifacts are still warm.
216 shell: bash
217 run: |
218 set -euo pipefail
219 mkdir -p "$RUNNER_TEMP/test-archive" "$RUNNER_TEMP/test-expected"
220 cargo nextest archive --workspace --all-features --locked --profile ci \
221 --archive-file "$RUNNER_TEMP/test-archive/nextest-archive.tar.zst"
222 exe=codewhale
223 if [ "$RUNNER_OS" = Windows ]; then exe=codewhale.exe; fi
224 cp "${CARGO_TARGET_DIR:-target}/debug/$exe" "$RUNNER_TEMP/test-archive/$exe"
225 env:
226 RUSTC_WRAPPER: ${{ inputs.os != 'windows-latest' && env.RUSTC_WRAPPER || '' }}
227 - name: Count the tests the archive selects
228 shell: bash
229 run: |
230 set -euo pipefail
231 cargo nextest list --archive-file "$RUNNER_TEMP/test-archive/nextest-archive.tar.zst" \
232 --workspace-remap . --profile ci --message-format json > "$RUNNER_TEMP/test-listing.json"
233 tests="$(python3 -I scripts/ci/nextest-shard-count.py list "$RUNNER_TEMP/test-listing.json")"
234 printf '{"os": "%s", "tests": %s, "shards": %s}\n' "${{ inputs.os }}" "$tests" "${{ inputs.shards }}" \
235 > "$RUNNER_TEMP/test-expected/expected-${{ inputs.os }}.json"
236 cat "$RUNNER_TEMP/test-expected/expected-${{ inputs.os }}.json"
237 - name: Run doctests
238 # nextest does not run doctests; this keeps them once per OS.
239 shell: bash
240 run: sh scripts/with-hermetic-test-home.sh cargo test --workspace --all-features --locked --doc
241 env:
242 RUSTC_WRAPPER: ${{ inputs.os != 'windows-latest' && env.RUSTC_WRAPPER || '' }}
243 RUST_MIN_STACK: '16777216'
244 - name: Lockfile drift guard
245 run: git diff --exit-code -- Cargo.lock
246 - name: sccache stats
247 if: steps.sccache.outcome == 'success'
248 continue-on-error: true
249 shell: bash
250 run: sccache --show-stats
251 - name: Release this machine's build lock (self-hosted)
252 if: always() && runner.environment == 'self-hosted'
253 shell: bash
254 run: rm -f "$RUNNER_TEMP/cw-build-lock.hold"
255 - name: Retain test archive for the shards
256 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
257 with:
258 name: test-archive-${{ inputs.os }}
259 path: ${{ runner.temp }}/test-archive/
260 if-no-files-found: error
261 retention-days: 1
262 compression-level: 0
263 - name: Retain expected test count
264 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
265 with:
266 name: test-expected-${{ inputs.os }}
267 path: ${{ runner.temp }}/test-expected/
268 if-no-files-found: error
269 retention-days: 7
270 - name: Remove the job temp directory (self-hosted)
271 if: always() && runner.environment == 'self-hosted'
272 shell: bash
273 run: chmod -R u+w -- "$CW_JOB_TMP" 2>/dev/null || true; rm -rf -- "$CW_JOB_TMP"
274
275 shard:
276 name: Shard ${{ matrix.shard }}/${{ inputs.shards }}
277 needs: build
278 timeout-minutes: 60
279 runs-on: ${{ inputs.self_hosted && fromJSON('["self-hosted","macOS","ARM64","codewhale-mac"]') || (inputs.os == 'ubuntu-latest' && 'ubuntu-24.04' || inputs.os) }}
280 strategy:
281 # A failure in one shard must not erase the others' results; the suite
282 # gate needs every conclusion.
283 fail-fast: false
284 matrix:
285 shard: ${{ fromJSON(inputs.shard_list) }}
286 env:
287 CODEWHALE_EXT_HOST_TESTS: '1'
288 CODEWHALE_EXT_HOST_BUN_TESTS: '1'
289 # Give test threads the stack the product gives itself; the reasoning is
290 # on the shared-process step above and in scripts/dev-cargo.sh.
291 RUST_MIN_STACK: '16777216'
292 # The exact-image Native containment tests (and, on Windows, the LPAC
293 # owner and profile tests) that scripts/ci/compiled-host-native-receipt.py
294 # requires in ONE JUnit report. Shard 1 runs them in their own nextest
295 # invocation and every shard excludes them from its partition, so each
296 # still runs exactly once. release-workflows.test.js keeps this list equal
297 # to the script's.
298 NATIVE_FILTER: >-
299 package(codewhale-engine) & kind(lib) & (
300 test(=extension_host::tests::compiled_native_host_cannot_read_secrets_or_write_outside_its_data_dir) |
301 test(=extension_host::tests::compiled_native_host_memory_cap_is_enforced) |
302 test(=extension_host::windows::tests::windows_native_lpac_node_owner_boundary) |
303 test(=extension_host::windows::tests::windows_native_lpac_bun_owner_boundary) |
304 test(=extension_host::windows::tests::windows_native_lpac_compiled_owner_boundary) |
305 test(=extension_host::windows::tests::windows_native_profiles_are_distinct_and_acl_grant_refuses_junctions) |
306 test(=extension_host::windows::tests::windows_argv_and_environment_keep_exact_values_and_reject_nul) |
307 test(=extension_host::windows::tests::windows_profile_retirement_removes_only_its_grants_and_inherited_data_on_restarts) |
308 test(=extension_host::windows::tests::windows_profile_directory_budget_and_recorded_identity_refuse_before_overwrite))
309 steps:
310 - name: Isolate homes and temp on the self-hosted Mac
311 if: runner.environment == 'self-hosted'
312 shell: bash
313 run: |
314 set -euo pipefail
315 state="${RUNNER_WORKSPACE}/ci-state"
316 job_tmp="$(mktemp -d /tmp/cwci.XXXXXX)"
317 mkdir -p "${state}/home"
318 {
319 echo "HOME=${state}/home"
320 echo "CARGO_HOME=${state}/home/.cargo"
321 echo "RUSTUP_HOME=${state}/home/.rustup"
322 echo "TMPDIR=${job_tmp}"
323 echo "CW_JOB_TMP=${job_tmp}"
324 echo "NEXTEST_TEST_THREADS=8"
325 } >> "${GITHUB_ENV}"
326 - uses: actions/checkout@v7
327 - name: Point terminal failure diagnostics at the runner temp directory
328 shell: bash
329 run: echo "QA_PTY_DIAGNOSTICS_DIR=${RUNNER_TEMP}/pty-failures" >> "${GITHUB_ENV}"
330 - uses: dtolnay/rust-toolchain@1.100.0
331 - name: Install Linux system dependencies
332 if: inputs.os == 'ubuntu-latest'
333 run: |
334 bash scripts/ci/ci-apt-install.sh libdbus-1-dev pkg-config bubblewrap apparmor-profiles
335 sh scripts/ci/prepare-linux-test-sandbox.sh
336 - uses: taiki-e/install-action@b6620ca104fb7b50dafa1109be9622abc1fdd381
337 with:
338 tool: cargo-nextest@0.9.151
339 - uses: actions/setup-node@v7.1.0
340 # The extension-host integration tests spawn the real bundle under
341 # Node >= 22.19; CODEWHALE_EXT_HOST_TESTS makes a missing Node a
342 # failure instead of a silent skip.
343 with:
344 node-version: 22
345 - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2
346 with:
347 bun-version: 1.4.0
348 - name: Build matching compiled-host input for required Native containment receipts
349 shell: bash
350 run: bash scripts/ci/compiled-host-test-input.sh
351 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
352 with:
353 name: test-archive-${{ inputs.os }}
354 path: ${{ runner.temp }}/test-archive
355 - name: Place the canonical executable for acceptance tests
356 shell: bash
357 run: |
358 set -euo pipefail
359 mkdir -p target/debug
360 cp "$RUNNER_TEMP"/test-archive/codewhale* target/debug/
361 if [ "$RUNNER_OS" != Windows ]; then chmod +x target/debug/codewhale; fi
362 # The archive extracts test binaries to a different layout than a
363 # one-job build, so acceptance tests would not find the executable
364 # beside them; QA_TUI_BIN names it explicitly.
365 exe=codewhale
366 if [ "$RUNNER_OS" = Windows ]; then exe=codewhale.exe; fi
367 echo "QA_TUI_BIN=${GITHUB_WORKSPACE}/target/debug/${exe}" >> "${GITHUB_ENV}"
368 - name: Run native containment tests
369 if: matrix.shard == 1
370 shell: bash
371 run: |
372 set -euo pipefail
373 mkdir -p "$RUNNER_TEMP/test-count" "$RUNNER_TEMP/nextest-extract"
374 sh scripts/with-hermetic-test-home.sh cargo nextest run \
375 --archive-file "$RUNNER_TEMP/test-archive/nextest-archive.tar.zst" \
376 --extract-to "$RUNNER_TEMP/nextest-extract" --extract-overwrite \
377 --workspace-remap . --profile ci -E "$NATIVE_FILTER"
378 cp target/nextest/ci/junit.xml "$RUNNER_TEMP/native-junit.xml"
379 python3 -I scripts/ci/nextest-shard-count.py junit "$RUNNER_TEMP/native-junit.xml" > "$RUNNER_TEMP/native-count.txt"
380 - name: Warm the Windows Native host launch before the loaded partition
381 if: inputs.os == 'windows-latest' && matrix.shard != 1
382 shell: bash
383 run: |
384 set -euo pipefail
385 mkdir -p "$RUNNER_TEMP/nextest-extract"
386 sh scripts/with-hermetic-test-home.sh cargo nextest run \
387 --archive-file "$RUNNER_TEMP/test-archive/nextest-archive.tar.zst" \
388 --extract-to "$RUNNER_TEMP/nextest-extract" --extract-overwrite \
389 --workspace-remap . --profile ci \
390 -E 'package(codewhale-engine) & kind(lib) & test(=extension_host::windows::tests::windows_native_lpac_node_owner_boundary)'
391 rm -f target/nextest/ci/junit.xml
392 - name: Run tests
393 # Same test binaries as `cargo test`, run by cargo-nextest: one
394 # process per test, all runner cores busy, slow tests named instead
395 # of stalling the binary. `.config/nextest.toml` serializes the PTY
396 # binary and bounds the integration binary that spawns the real
397 # executable; retries are off, so a flake is a red run, not a hidden
398 # one. This shard runs partition k of N of everything except the
399 # native containment tests; test-suite proves the shards add up to the
400 # archive's full list.
401 shell: bash
402 run: |
403 set -euo pipefail
404 mkdir -p "$RUNNER_TEMP/test-count" "$RUNNER_TEMP/nextest-extract"
405 monitor=
406 if [ "$RUNNER_OS" = Linux ]; then
407 # Headroom trace: if the runner is terminated again, the last lines
408 # say whether memory or disk ran out.
409 ( while sleep 30; do
410 echo "[headroom] $(free -m | awk '/^Mem:/{print "mem used " $3 "/" $2 " MiB"} /^Swap:/{print "swap used " $3 "/" $2 " MiB"}' | paste -sd ' ') disk free $(df -h / | awk 'NR==2{print $4}')"
411 done ) &
412 monitor=$!
413 fi
414 status=0
415 sh scripts/with-hermetic-test-home.sh cargo nextest run \
416 --archive-file "$RUNNER_TEMP/test-archive/nextest-archive.tar.zst" \
417 --extract-to "$RUNNER_TEMP/nextest-extract" --extract-overwrite \
418 --workspace-remap . --profile ci \
419 --partition "slice:${{ matrix.shard }}/${{ inputs.shards }}" \
420 -E "not ($NATIVE_FILTER)" || status=$?
421 if [ -n "$monitor" ]; then kill "$monitor" 2>/dev/null || true; fi
422 if [ "$status" -ne 0 ]; then exit "$status"; fi
423 tests="$(python3 -I scripts/ci/nextest-shard-count.py junit target/nextest/ci/junit.xml)"
424 if [ -f "$RUNNER_TEMP/native-count.txt" ]; then tests=$((tests + $(cat "$RUNNER_TEMP/native-count.txt"))); fi
425 printf '{"os": "%s", "shard": %s, "tests": %s}\n' "${{ inputs.os }}" "${{ matrix.shard }}" "$tests" \
426 > "$RUNNER_TEMP/test-count/shard-${{ inputs.os }}-${{ matrix.shard }}.json"
427 cat "$RUNNER_TEMP/test-count/shard-${{ inputs.os }}-${{ matrix.shard }}.json"
428 - name: Retain sealed terminal failure diagnostics
429 if: failure()
430 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
431 with:
432 name: terminal-failures-${{ runner.os }}-${{ matrix.shard }}-${{ github.sha }}-${{ github.run_attempt }}
433 path: ${{ runner.temp }}/pty-failures/
434 include-hidden-files: true
435 if-no-files-found: ignore
436 retention-days: 7
437 - name: Export exact compiled-image Native containment receipt
438 # JUnit is from the same archive's native invocation: no second
439 # compile. The official entire CI run must be green before release can
440 # consume this artifact. Missing/changed inputs or silent test skips
441 # are red.
442 if: matrix.shard == 1
443 shell: bash
444 run: |
445 set -euo pipefail
446 test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
447 git diff --exit-code
448 git diff --cached --exit-code
449 python3 scripts/ci/compiled-host-native-receipt.py \
450 --junit "$RUNNER_TEMP/native-junit.xml" \
451 --compiled-image "$CODEWHALE_COMPILED_HOST_TEST_BINARY" \
452 --bundle crates/engine/extension-host/dist/codewhale-extension-host.mjs \
453 --bun "$CODEWHALE_COMPILED_HOST_TEST_BUN" --source-sha "$GITHUB_SHA" \
454 --image-platform "$CODEWHALE_COMPILED_HOST_TEST_PLATFORM" --image-arch "$CODEWHALE_COMPILED_HOST_TEST_ARCH" \
455 --host-sha256 "$CODEWHALE_COMPILED_HOST_TEST_SHA256" \
456 --runtime-sha256 "$CODEWHALE_COMPILED_HOST_TEST_RUNTIME_SHA256" \
457 --bundle-sha256 "$CODEWHALE_COMPILED_HOST_TEST_BUNDLE_SHA256" \
458 --output "$RUNNER_TEMP/native-compiled-host"
459 - name: Retain exact compiled image and Native receipt
460 if: matrix.shard == 1
461 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
462 with:
463 name: native-compiled-host-${{ runner.os }}-${{ runner.arch }}
464 path: ${{ runner.temp }}/native-compiled-host/
465 if-no-files-found: error
466 retention-days: 30
467 - name: Lockfile drift guard
468 run: git diff --exit-code -- Cargo.lock
469 - name: Retain shard test count
470 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
471 with:
472 name: test-count-${{ inputs.os }}-${{ matrix.shard }}
473 path: ${{ runner.temp }}/test-count/
474 if-no-files-found: error
475 retention-days: 7
476 - name: Remove the job temp directory (self-hosted)
477 if: always() && runner.environment == 'self-hosted'
478 shell: bash
479 run: chmod -R u+w -- "$CW_JOB_TMP" 2>/dev/null || true; rm -rf -- "$CW_JOB_TMP"
480
481 check:
482 # The job that answers "did this OS's whole suite pass": the build and every
483 # shard succeeded, and the shards together ran exactly the tests the archive
484 # lists. Not a required check (§180).
485 name: Suite check
486 needs: [build, shard]
487 if: '!cancelled()'
488 timeout-minutes: 10
489 runs-on: ubuntu-24.04
490 steps:
491 - uses: actions/checkout@v7
492 with:
493 sparse-checkout: scripts/ci
494 - name: Every build and shard succeeded
495 shell: bash
496 env:
497 BUILD_RESULT: ${{ needs.build.result }}
498 SHARD_RESULT: ${{ needs.shard.result }}
499 run: |
500 echo "build: ${BUILD_RESULT}"
501 echo "shard: ${SHARD_RESULT}"
502 if [ "${BUILD_RESULT}" != success ] || [ "${SHARD_RESULT}" != success ]; then
503 echo "::error::The sharded suite did not complete successfully."
504 exit 1
505 fi
506 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
507 with:
508 name: test-expected-${{ inputs.os }}
509 path: counts
510 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
511 with:
512 pattern: test-count-${{ inputs.os }}-*
513 path: counts
514 merge-multiple: true
515 - name: Shards ran every listed test exactly once
516 run: python3 -I scripts/ci/nextest-shard-count.py check counts
517
517 lines YAML