Speed up Windows x64 Rust tests with archive fanout

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-05-13 11:04:58 -07:00
parent 610b86fefb
commit a05053d765

View File

@@ -559,12 +559,6 @@ jobs:
runs_on:
group: codex-runners
labels: codex-linux-arm64
- runner: windows-x64
target: x86_64-pc-windows-msvc
profile: dev
runs_on:
group: codex-runners
labels: codex-windows-x64
- runner: windows-arm64
target: aarch64-pc-windows-msvc
profile: dev
@@ -751,6 +745,153 @@ jobs:
echo "Tests failed. See logs for details."
exit 1
windows_x64_test_archive:
name: Build Windows x64 nextest archive
runs-on:
group: codex-runners
labels: codex-windows-x64
timeout-minutes: 45
defaults:
run:
working-directory: codex-rs
env:
CARGO_INCREMENTAL: "0"
WINDOWS_X64_ARCHIVE_FILE: windows-x64-nextest-archive.tar.zst
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0
with:
targets: x86_64-pc-windows-msvc
- name: Compute lockfile hash
id: lockhash
shell: bash
run: |
set -euo pipefail
echo "hash=$(sha256sum Cargo.lock | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "toolchain_hash=$(sha256sum rust-toolchain.toml | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Restore cargo home cache
id: cache_cargo_home_restore
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-home-windows-x64-x86_64-pc-windows-msvc-dev-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
restore-keys: |
cargo-home-windows-x64-x86_64-pc-windows-msvc-dev-
- uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2.62.49
with:
tool: nextest
version: 0.9.103
- name: Build nextest archive
shell: bash
run: |
set -euo pipefail
archive_dir="${RUNNER_TEMP}/nextest-archive"
mkdir -p "${archive_dir}"
cargo nextest archive \
--target x86_64-pc-windows-msvc \
--cargo-profile ci-test \
--timings \
--archive-file "${archive_dir}/${WINDOWS_X64_ARCHIVE_FILE}"
- name: Upload nextest archive
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: windows-x64-nextest-archive
path: ${{ runner.temp }}/nextest-archive/${{ env.WINDOWS_X64_ARCHIVE_FILE }}
if-no-files-found: error
retention-days: 1
- name: Upload Cargo timings (nextest)
if: always()
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: cargo-timings-rust-ci-nextest-x86_64-pc-windows-msvc-dev
path: codex-rs/target/**/cargo-timings/cargo-timing.html
if-no-files-found: warn
- name: Save cargo home cache
if: always() && !cancelled() && steps.cache_cargo_home_restore.outputs.cache-hit != 'true'
continue-on-error: true
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: cargo-home-windows-x64-x86_64-pc-windows-msvc-dev-${{ steps.lockhash.outputs.hash }}-${{ steps.lockhash.outputs.toolchain_hash }}
windows_x64_archive_tests:
name: Tests — windows-x64 shard ${{ matrix.shard }}/6
needs: windows_x64_test_archive
runs-on:
group: codex-runners
labels: codex-windows-x64
timeout-minutes: 45
defaults:
run:
working-directory: codex-rs
env:
WINDOWS_X64_ARCHIVE_FILE: windows-x64-nextest-archive.tar.zst
strategy:
fail-fast: false
matrix:
shard:
- 1
- 2
- 3
- 4
- 5
- 6
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install DotSlash
uses: facebook/install-dotslash@1e4e7b3e07eaca387acb98f1d4720e0bee8dbb6a # v2
- uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0
with:
targets: x86_64-pc-windows-msvc
- uses: taiki-e/install-action@44c6d64aa62cd779e873306675c7a58e86d6d532 # v2.62.49
with:
tool: nextest
version: 0.9.103
- name: Download nextest archive
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: windows-x64-nextest-archive
path: ${{ runner.temp }}/windows-x64-nextest-archive
- name: tests
id: test
shell: bash
run: |
set -euo pipefail
archive_file="${RUNNER_TEMP}/windows-x64-nextest-archive/${WINDOWS_X64_ARCHIVE_FILE}"
workspace_root="$(cygpath -w "$(pwd)")"
extract_dir_unix="${RUNNER_TEMP}/nextest-extract-shard-${{ matrix.shard }}"
mkdir -p "${extract_dir_unix}"
extract_dir="$(cygpath -w "${extract_dir_unix}")"
archive_file="$(cygpath -w "${archive_file}")"
cargo nextest run \
--no-fail-fast \
--archive-file "${archive_file}" \
--workspace-remap "${workspace_root}" \
--extract-to "${extract_dir}" \
--partition "hash:${{ matrix.shard }}/6" \
--test-threads 8
env:
RUST_BACKTRACE: 1
RUST_MIN_STACK: "8388608" # 8 MiB
NEXTEST_STATUS_LEVEL: leak
- name: verify tests passed
if: steps.test.outcome == 'failure'
run: |
echo "Tests failed. See logs for details."
exit 1
# --- Gatherer job for the full post-merge workflow --------------------------
results:
name: Full CI results
@@ -762,6 +903,7 @@ jobs:
argument_comment_lint_prebuilt,
lint_build,
tests,
windows_x64_archive_tests,
]
if: always()
runs-on: ubuntu-24.04
@@ -775,12 +917,14 @@ jobs:
echo "shear : ${{ needs.cargo_shear.result }}"
echo "lint : ${{ needs.lint_build.result }}"
echo "tests : ${{ needs.tests.result }}"
echo "winx64 : ${{ needs.windows_x64_archive_tests.result }}"
[[ '${{ needs.argument_comment_lint_package.result }}' == 'success' ]] || { echo 'argument_comment_lint_package failed'; exit 1; }
[[ '${{ needs.argument_comment_lint_prebuilt.result }}' == 'success' ]] || { echo 'argument_comment_lint_prebuilt failed'; exit 1; }
[[ '${{ needs.general.result }}' == 'success' ]] || { echo 'general failed'; exit 1; }
[[ '${{ needs.cargo_shear.result }}' == 'success' ]] || { echo 'cargo_shear failed'; exit 1; }
[[ '${{ needs.lint_build.result }}' == 'success' ]] || { echo 'lint_build failed'; exit 1; }
[[ '${{ needs.tests.result }}' == 'success' ]] || { echo 'tests failed'; exit 1; }
[[ '${{ needs.windows_x64_archive_tests.result }}' == 'success' ]] || { echo 'windows_x64_archive_tests failed'; exit 1; }
- name: sccache summary note
if: always()