diff --git a/.github/workflows/rust-ci-full.yml b/.github/workflows/rust-ci-full.yml index de37faa4ca..497c666652 100644 --- a/.github/workflows/rust-ci-full.yml +++ b/.github/workflows/rust-ci-full.yml @@ -5,6 +5,12 @@ on: - main - "**full-ci**" workflow_dispatch: + inputs: + windows_x64_archive_fanout: + description: Build one Windows x64 nextest archive, then run four archive-backed shards. + required: false + default: false + type: boolean # CI builds in debug (dev) for faster signal. env: @@ -199,12 +205,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 +751,267 @@ jobs: echo "Tests failed. See logs for details." exit 1 + windows_x64_tests: + name: Tests — windows-x64 - x86_64-pc-windows-msvc + if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.windows_x64_archive_fanout) }} + runs-on: + group: codex-runners + labels: codex-windows-x64 + timeout-minutes: 45 + defaults: + run: + working-directory: codex-rs + env: + USE_SCCACHE: "false" + CARGO_INCREMENTAL: "0" + SCCACHE_CACHE_SIZE: 10G + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + # Some integration tests rely on DotSlash being installed. + # See https://github.com/openai/codex/pull/7617. + - name: Install DotSlash + uses: facebook/install-dotslash@1e4e7b3e07eaca387acb98f1d4720e0bee8dbb6a # v2 + + - uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0 + with: + targets: x86_64-pc-windows-msvc + + - name: Compute lockfile hash + id: lockhash + working-directory: codex-rs + 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: tests + id: test + run: cargo nextest run --no-fail-fast --target x86_64-pc-windows-msvc --cargo-profile ci-test --timings + env: + RUST_BACKTRACE: 1 + RUST_MIN_STACK: "8388608" # 8 MiB + NEXTEST_STATUS_LEVEL: leak + + - 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 }} + + - name: verify tests passed + if: steps.test.outcome == 'failure' + run: | + echo "Tests failed. See logs for details." + exit 1 + + windows_x64_test_archive: + name: Build Windows x64 nextest archive (XL) + if: ${{ github.event_name == 'workflow_dispatch' && inputs.windows_x64_archive_fanout }} + runs-on: + group: codex-runners + labels: codex-windows-x64-xl + timeout-minutes: 45 + defaults: + run: + working-directory: codex-rs + env: + USE_SCCACHE: "false" + CARGO_INCREMENTAL: "0" + SCCACHE_CACHE_SIZE: 10G + WINDOWS_X64_ARCHIVE_FILE: windows-x64-nextest-archive.tar.zst + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + # Some integration tests rely on DotSlash being installed. + # See https://github.com/openai/codex/pull/7617. + - name: Install DotSlash + uses: facebook/install-dotslash@1e4e7b3e07eaca387acb98f1d4720e0bee8dbb6a # v2 + + - uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0 + with: + targets: x86_64-pc-windows-msvc + + - name: Compute lockfile hash + id: lockhash + working-directory: codex-rs + 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 archive) + if: always() + uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 + with: + name: cargo-timings-rust-ci-nextest-x86_64-pc-windows-msvc-dev-archive + 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 archive - x86_64-pc-windows-msvc (part ${{ matrix.shard }}/4) + needs: windows_x64_test_archive + if: ${{ github.event_name == 'workflow_dispatch' && inputs.windows_x64_archive_fanout && needs.windows_x64_test_archive.result == 'success' }} + 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] + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + # Some integration tests rely on DotSlash being installed. + # See https://github.com/openai/codex/pull/7617. + - name: Install DotSlash + uses: facebook/install-dotslash@1e4e7b3e07eaca387acb98f1d4720e0bee8dbb6a # v2 + + - uses: dtolnay/rust-toolchain@a0b273b48ed29de4470960879e8381ff45632f26 # 1.93.0 + + - 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="$(pwd)" + extract_dir="${RUNNER_TEMP}/nextest-extract-part-${{ matrix.shard }}-of-4" + mkdir_extract_dir="${extract_dir}" + if [[ "${RUNNER_OS}" == "Windows" ]] && command -v cygpath >/dev/null 2>&1; then + mkdir_extract_dir="$(cygpath -u "${extract_dir}")" + fi + mkdir -p "${mkdir_extract_dir}" + if [[ "${RUNNER_OS}" == "Windows" ]] && command -v cygpath >/dev/null 2>&1; then + archive_file="$(cygpath -w "${archive_file}")" + workspace_root="$(cygpath -w "${workspace_root}")" + extract_dir="$(cygpath -w "${extract_dir}")" + fi + cargo nextest run \ + --no-fail-fast \ + --archive-file "${archive_file}" \ + --workspace-remap "${workspace_root}" \ + --extract-to "${extract_dir}" \ + --extract-overwrite \ + --partition "hash:${{ matrix.shard }}/4" + 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 +1023,9 @@ jobs: argument_comment_lint_prebuilt, lint_build, tests, + windows_x64_tests, + windows_x64_test_archive, + windows_x64_archive_tests, ] if: always() runs-on: ubuntu-24.04 @@ -775,12 +1039,18 @@ jobs: echo "shear : ${{ needs.cargo_shear.result }}" echo "lint : ${{ needs.lint_build.result }}" echo "tests : ${{ needs.tests.result }}" + echo "win x64: ${{ needs.windows_x64_tests.result }}" + echo "archive: ${{ needs.windows_x64_test_archive.result }}" + echo "shards : ${{ 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_tests.result }}' == 'success' || '${{ needs.windows_x64_tests.result }}' == 'skipped' ]] || { echo 'windows_x64_tests failed'; exit 1; } + [[ '${{ needs.windows_x64_test_archive.result }}' == 'success' || '${{ needs.windows_x64_test_archive.result }}' == 'skipped' ]] || { echo 'windows_x64_test_archive failed'; exit 1; } + [[ '${{ needs.windows_x64_archive_tests.result }}' == 'success' || '${{ needs.windows_x64_archive_tests.result }}' == 'skipped' ]] || { echo 'windows_x64_archive_tests failed'; exit 1; } - name: sccache summary note if: always()