Add targeted rust full CI test workflow

This commit is contained in:
starr-openai
2026-05-29 00:56:21 -07:00
parent 522f549922
commit b6e746629c
3 changed files with 173 additions and 3 deletions
+4
View File
@@ -26,6 +26,10 @@ The workflows in this directory are split so that pull requests get fast, review
- release-profile Cargo builds
- cross-platform `argument-comment-lint`
- Linux remote-env tests
- `rust-ci-full-targeted-test.yml` is the manual one-test repro path for the
`rust-ci-full` nextest lanes. Dispatch it with one platform and one exact
cargo-nextest filterset such as `test(=module::test)`; the workflow rejects
filtersets that resolve to zero or multiple tests.
## Rule Of Thumb
@@ -47,6 +47,18 @@ on:
required: false
default: false
type: boolean
nextest_filterset:
required: false
default: "all()"
type: string
partition_tests:
required: false
default: true
type: boolean
require_single_test:
required: false
default: false
type: boolean
# Caller workflow-level env does not flow through workflow_call, so keep the
# Cargo git transport hardening on the archive and shard jobs directly here.
@@ -287,7 +299,7 @@ jobs:
} >> "$GITHUB_STEP_SUMMARY"
shard:
name: Tests shard ${{ matrix.shard }}/4
name: Tests ${{ matrix.shard == 0 && 'selected test' || format('shard {0}/4', matrix.shard) }}
needs: archive
runs-on: ${{ inputs.runner_group != '' && fromJSON(format('{{"group":"{0}","labels":"{1}"}}', inputs.runner_group, inputs.runner_labels)) || inputs.runner }}
timeout-minutes: 60
@@ -300,7 +312,7 @@ jobs:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
shard: ${{ inputs.partition_tests && fromJSON('[1, 2, 3, 4]') || fromJSON('[0]') }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
@@ -391,12 +403,30 @@ jobs:
--no-fail-fast
--archive-file "${archive_file}"
--workspace-remap "${workspace_root}"
--partition "hash:${{ matrix.shard }}/4"
--filterset "${NEXTEST_FILTERSET}"
)
if [[ "${{ matrix.shard }}" != "0" ]]; then
nextest_args+=(--partition "hash:${{ matrix.shard }}/4")
fi
if [[ "${{ inputs.test_threads }}" != "0" ]]; then
nextest_args+=(--test-threads "${{ inputs.test_threads }}")
fi
if [[ "${REQUIRE_SINGLE_TEST}" == "true" ]]; then
test_count="$(
cargo nextest list \
--archive-file "${archive_file}" \
--workspace-remap "${workspace_root}" \
--filterset "${NEXTEST_FILTERSET}" \
--message-format json |
python3 -c 'import json, sys; print(json.load(sys.stdin)["test-count"])'
)"
if [[ "${test_count}" != "1" ]]; then
echo "nextest filterset must resolve to exactly one test; got ${test_count}" >&2
exit 1
fi
fi
test_command=(cargo nextest "${nextest_args[@]}")
if [[ "${RUNNER_OS}" == "Linux" ]]; then
sandbox_helper="${helper_target_dir}/codex-linux-sandbox"
@@ -419,6 +449,8 @@ jobs:
"${test_command[@]}"
env:
NEXTEST_FILTERSET: ${{ inputs.nextest_filterset }}
REQUIRE_SINGLE_TEST: ${{ inputs.require_single_test && 'true' || 'false' }}
RUST_BACKTRACE: 1
RUST_MIN_STACK: "8388608" # 8 MiB
NEXTEST_STATUS_LEVEL: leak
@@ -0,0 +1,134 @@
name: rust-ci-full targeted test
on:
workflow_dispatch:
inputs:
platform:
description: Full CI test platform to run.
required: true
type: choice
options:
- macos-aarch64
- linux-x64-remote
- linux-arm64
- windows-x64
- windows-arm64
nextest_filterset:
description: cargo-nextest filterset that must resolve to exactly one test, for example test(=module::test).
required: true
type: string
jobs:
tests_macos_aarch64:
if: ${{ inputs.platform == 'macos-aarch64' }}
name: Targeted test — macos-15-xlarge - aarch64-apple-darwin
uses: ./.github/workflows/rust-ci-full-nextest-platform.yml
with:
runner: macos-15-xlarge
target: aarch64-apple-darwin
profile: ci-test
artifact_id: targeted-macos-aarch64
use_sccache: true
nextest_filterset: ${{ inputs.nextest_filterset }}
partition_tests: false
require_single_test: true
secrets: inherit
tests_linux_x64_remote:
if: ${{ inputs.platform == 'linux-x64-remote' }}
name: Targeted test — ubuntu-24.04 - x86_64-unknown-linux-gnu (remote)
uses: ./.github/workflows/rust-ci-full-nextest-platform.yml
with:
runner: ubuntu-24.04
runner_group: codex-runners
runner_labels: codex-linux-x64
target: x86_64-unknown-linux-gnu
profile: ci-test
artifact_id: targeted-linux-x64-remote
remote_env: true
use_sccache: true
nextest_filterset: ${{ inputs.nextest_filterset }}
partition_tests: false
require_single_test: true
secrets: inherit
tests_linux_arm64:
if: ${{ inputs.platform == 'linux-arm64' }}
name: Targeted test — ubuntu-24.04-arm - aarch64-unknown-linux-gnu
uses: ./.github/workflows/rust-ci-full-nextest-platform.yml
with:
runner: ubuntu-24.04-arm
runner_group: codex-runners
runner_labels: codex-linux-arm64
target: aarch64-unknown-linux-gnu
profile: ci-test
artifact_id: targeted-linux-arm64
use_sccache: true
nextest_filterset: ${{ inputs.nextest_filterset }}
partition_tests: false
require_single_test: true
secrets: inherit
tests_windows_x64:
if: ${{ inputs.platform == 'windows-x64' }}
name: Targeted test — windows-x64 - x86_64-pc-windows-msvc
uses: ./.github/workflows/rust-ci-full-nextest-platform.yml
with:
runner: windows-x64
runner_group: codex-runners
runner_labels: codex-windows-x64
target: x86_64-pc-windows-msvc
profile: ci-test
artifact_id: targeted-windows-x64
test_threads: 8
nextest_filterset: ${{ inputs.nextest_filterset }}
partition_tests: false
require_single_test: true
secrets: inherit
tests_windows_arm64:
if: ${{ inputs.platform == 'windows-arm64' }}
name: Targeted test — windows-arm64 - aarch64-pc-windows-msvc
uses: ./.github/workflows/rust-ci-full-nextest-platform.yml
with:
runner: windows-arm64
runner_group: codex-runners
runner_labels: codex-windows-arm64
archive_runner: windows-x64
archive_runner_group: codex-runners
archive_runner_labels: codex-windows-x64
target: aarch64-pc-windows-msvc
profile: ci-test
artifact_id: targeted-windows-arm64
test_threads: 8
use_sccache: true
nextest_filterset: ${{ inputs.nextest_filterset }}
partition_tests: false
require_single_test: true
secrets: inherit
results:
name: Targeted test results
needs:
[
tests_macos_aarch64,
tests_linux_x64_remote,
tests_linux_arm64,
tests_windows_x64,
tests_windows_arm64,
]
if: always()
runs-on: ubuntu-24.04
steps:
- name: Confirm selected targeted test passed
shell: bash
run: |
case '${{ inputs.platform }}' in
macos-aarch64) result='${{ needs.tests_macos_aarch64.result }}' ;;
linux-x64-remote) result='${{ needs.tests_linux_x64_remote.result }}' ;;
linux-arm64) result='${{ needs.tests_linux_arm64.result }}' ;;
windows-x64) result='${{ needs.tests_windows_x64.result }}' ;;
windows-arm64) result='${{ needs.tests_windows_arm64.result }}' ;;
*) echo 'unknown platform'; exit 1 ;;
esac
[[ "${result}" == 'success' ]] || { echo "selected targeted test failed: ${result}"; exit 1; }