ci: cache pip/sccache and parallelize pixel-binary checks #1513

Merged
tedin7 merged 1 commit from upstream-pr/1520 into main 2026-11-24 15:37:43 +00:00
tedin7 commented 2026-11-24 13:32:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:32:12Z.


Change

Speeds up .github/workflows/windows.yml across three independent areas without overlapping #1173 or touching tools/run_checks_parallel.py:

  1. Cache pip wheels (setup-python): Enables cache: 'pip' with cache-dependency-path: 'requirements-dev.txt' in python-linux, build-and-test, and build-and-test-release so pefile, iced-x86, and ziglang reuse cached wheels across runs.
  2. Enable sccache on Windows builds (build-and-test, build-and-test-release): Installs mozilla-actions/sccache-action (v0.0.11), sets SCCACHE_DIR ($env:RUNNER_TEMP\sccache) and SCCACHE_CACHE_SIZE: '2G', restores/saves SCCACHE_DIR via actions/cache keyed by MSVC toolset, build preset (pr/dev vs release), and C/C++/ASM/CMake input hashes, sets X2W_USE_SCCACHE: '1', passes @X2wSccacheCmakeArgs (from tools/dev.ps1) to cmake --preset, and prints sccache --show-stats right after cmake --build.
  3. Parallelize pixel-binary checks: Runs all 31 spirv_window / LLVM-15 / rdna2_tools checks in Check machine-code inputs with LLVM 15 concurrently via ThreadPoolExecutor, grouping each script's output with ::group:: / ::endgroup::, reporting exact failing scripts, and exiting non-zero if any check fails.

Verification

  • Local validation on commit f6ca2432:
    • yaml.safe_load(open(".github/workflows/windows.yml")) -> YAML OK (['pixel-binary', 'python-linux', 'build-and-test', 'build-and-test-release', 'publish-coverage'])
    • git diff --check -> exit 0
    • python3 -B tests/docs_links_check.py -> Checked 16 Markdown files and 344 links. (exit 0)
    • python3 -B tests/bidi_controls_check.py -> Checked 1249 tracked source, script and build/CI files: no bidirectional controls. (exit 0)
    • python3 -B tests/dev_ps1_sccache_check.py -> dev.ps1 sccache opt-in: ok (text only) (pwsh not installed on Linux host)
    • python3 -B tests/gpu_report_format_check.py -> Ran 10 tests in 0.005s / OK
    • Extracted pixel-binary runner check: verified all 31 script paths exist, syntax compiles, parallel tests/spirv_window/*.py checks pass, and synthetic failure exits 1 with FAILED: ... (exit 7).
  • GitHub Actions PR CI (R0Y00/Xbox2Windows#1520):
    • Cold-cache PR run (45404570418 at 4cc7a77b, 28 pixel-binary checks): all 3 PR jobs green; pixel-binary step 149s -> 105s; sccache cached 81/81 C/C++ compilations (0 non-cacheable calls, 20 MiB saved); pip wheel cache saved.
    • Warm-cache PR run (45411240026 at rebased f6ca2432, 31 pixel-binary checks): all 3 PR jobs green (2m40s max):
      • pixel-binary: Check machine-code inputs with LLVM 15 (including apt-get) finished in 88s (2m02s total job) vs 149s baseline on 45403214617 (-61s, even with 3 more checks).
      • python-linux: pip cache hit (Using cached pefile, Using cached iced_x86, 2s install); 56s total job.
      • build-and-test (pr): pip cache hit; sccache restored fallback PR cache across a 23-commit main rebase with 33/81 hits (40.74%), cutting Configure, build and run PC tests from 118s (cold) to 92s (43 MiB updated cache saved).

Evidence and follow-up

  • build-and-test-release (/O2) is gated on github.event_name != 'pull_request' and has the mirrored setup-python pip cache, sccache-action, actions/cache, and @X2wSccacheCmakeArgs configuration; it will populate and warm its -release- cache key on main pushes.
  • AI-assisted; commands listed were executed locally.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582936647 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1520). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T13:32:12Z. --- ## Change Speeds up `.github/workflows/windows.yml` across three independent areas without overlapping `#1173` or touching `tools/run_checks_parallel.py`: 1. **Cache `pip` wheels (`setup-python`)**: Enables `cache: 'pip'` with `cache-dependency-path: 'requirements-dev.txt'` in `python-linux`, `build-and-test`, and `build-and-test-release` so `pefile`, `iced-x86`, and `ziglang` reuse cached wheels across runs. 2. **Enable `sccache` on Windows builds (`build-and-test`, `build-and-test-release`)**: Installs `mozilla-actions/sccache-action` (`v0.0.11`), sets `SCCACHE_DIR` (`$env:RUNNER_TEMP\sccache`) and `SCCACHE_CACHE_SIZE: '2G'`, restores/saves `SCCACHE_DIR` via `actions/cache` keyed by MSVC toolset, build preset (`pr`/`dev` vs `release`), and C/C++/ASM/CMake input hashes, sets `X2W_USE_SCCACHE: '1'`, passes `@X2wSccacheCmakeArgs` (from `tools/dev.ps1`) to `cmake --preset`, and prints `sccache --show-stats` right after `cmake --build`. 3. **Parallelize `pixel-binary` checks**: Runs all 31 `spirv_window` / LLVM-15 / `rdna2_tools` checks in `Check machine-code inputs with LLVM 15` concurrently via `ThreadPoolExecutor`, grouping each script's output with `::group::` / `::endgroup::`, reporting exact failing scripts, and exiting non-zero if any check fails. ## Verification - Local validation on commit `f6ca2432`: - `yaml.safe_load(open(".github/workflows/windows.yml"))` -> `YAML OK` (`['pixel-binary', 'python-linux', 'build-and-test', 'build-and-test-release', 'publish-coverage']`) - `git diff --check` -> exit 0 - `python3 -B tests/docs_links_check.py` -> `Checked 16 Markdown files and 344 links.` (exit 0) - `python3 -B tests/bidi_controls_check.py` -> `Checked 1249 tracked source, script and build/CI files: no bidirectional controls.` (exit 0) - `python3 -B tests/dev_ps1_sccache_check.py` -> `dev.ps1 sccache opt-in: ok (text only)` (`pwsh` not installed on Linux host) - `python3 -B tests/gpu_report_format_check.py` -> `Ran 10 tests in 0.005s / OK` - Extracted `pixel-binary` runner check: verified all 31 script paths exist, syntax compiles, parallel `tests/spirv_window/*.py` checks pass, and synthetic failure exits 1 with `FAILED: ... (exit 7)`. - GitHub Actions PR CI (`R0Y00/Xbox2Windows#1520`): - Cold-cache PR run (`45404570418` at `4cc7a77b`, 28 `pixel-binary` checks): all 3 PR jobs green; `pixel-binary` step `149s -> 105s`; `sccache` cached `81/81` C/C++ compilations (`0` non-cacheable calls, `20 MiB` saved); `pip` wheel cache saved. - Warm-cache PR run (`45411240026` at rebased `f6ca2432`, 31 `pixel-binary` checks): all 3 PR jobs green (`2m40s` max): - `pixel-binary`: `Check machine-code inputs with LLVM 15` (including `apt-get`) finished in **88s** (`2m02s` total job) vs **149s** baseline on `45403214617` (`-61s`, even with 3 more checks). - `python-linux`: `pip` cache hit (`Using cached pefile`, `Using cached iced_x86`, **2s** install); **56s** total job. - `build-and-test` (`pr`): `pip` cache hit; `sccache` restored fallback PR cache across a 23-commit `main` rebase with **33/81 hits (40.74%)**, cutting `Configure, build and run PC tests` from **118s** (cold) to **92s** (`43 MiB` updated cache saved). ## Evidence and follow-up - `build-and-test-release` (`/O2`) is gated on `github.event_name != 'pull_request'` and has the mirrored `setup-python` `pip` cache, `sccache-action`, `actions/cache`, and `@X2wSccacheCmakeArgs` configuration; it will populate and warm its `-release-` cache key on `main` pushes. - AI-assisted; commands listed were executed locally. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
tedin7 commented 2026-11-24 15:02:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:23:41Z.


Rebased onto current main (fa6a5653, preserving the require_warp_results_check.py step) and verified all 3 PR CI checks green on run 45413002715 (python-linux 52s, build-and-test 2m12s, pixel-binary 2m30s).

Measured before/after CI timings:

  • pixel-binary (LLVM 15 / SPIR-V checks step): 149s -> 88s (warm run 45411240026)
  • build-and-test (pr build+test step): 118s -> 92s with sccache 40.7% cache hits across rebase
  • python-linux dependency install: pip cache hit in 2s

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134301955 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1520#issuecomment-7134301955). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T14:23:41Z. --- Rebased onto current `main` (`fa6a5653`, preserving the `require_warp_results_check.py` step) and verified all 3 PR CI checks green on run `45413002715` (`python-linux` 52s, `build-and-test` 2m12s, `pixel-binary` 2m30s). Measured before/after CI timings: - `pixel-binary` (LLVM 15 / SPIR-V checks step): `149s -> 88s` (warm run `45411240026`) - `build-and-test` (`pr` build+test step): `118s -> 92s` with `sccache` `40.7%` cache hits across rebase - `python-linux` dependency install: `pip` cache hit in `2s` AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-24 15:02:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T14:24:06Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T14:27:33.750223Z fa6a565 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134313039 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1520#issuecomment-7134313039). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T14:24:06Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"fa6a56532c998c2e8021b187ca4d63b64232edb0","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T14:27:33.750223Z">2026-11-24T14:27:33.750223Z</relative-time> | `fa6a565` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
ChazY11 commented 2026-11-24 15:02:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T15:02:15Z.


Same 32 checks, failures still fail, and the parallel run cannot collide on files

Independent reviewer, not the author. Reviewed e9ba20ed; nothing pushed to the branch.

I cannot run GitHub Actions from here, so this review is static: I compared the old and new command lists, read the
failure path, and checked the working-directory behaviour of every script in the new list.

1. Coverage is identical

Parsing the removed lines and the new CHECKS table:

old: 32 python3 invocations covering 31 distinct scripts  (pixel_sample_gradient_check twice)
new: 32 entries covering the same 31 scripts             (pixel_sample_gradient_check twice)

One apparent difference appeared in my first pass — tests/rdna2_tools_check.py looked "new only" — because the old line
is env-prefixed (LLVM_LIB=… LLVM_MC=… LLVM_OBJCOPY=… python3 -B tests/rdna2_tools_check.py) and my pattern missed it.
It is present in both, with the environment now passed through the extra_env dict:

(["tests/rdna2_tools_check.py"], {"LLVM_LIB": "libLLVM-15.so.1", "LLVM_MC": "llvm-mc-15", "LLVM_OBJCOPY": "llvm-objcopy-15"}),

So nothing was dropped and nothing was added.

2. A failure still fails the job

failed = []
...
    if code != 0:
        failed.append(f"{script} (exit {code})")
if failed:
    print("FAILED: " + ", ".join(failed), flush=True)
    sys.exit(1)

sys.exit(1) is there, and each check's exit code is collected rather than the first one aborting the rest, so a single
run reports every failure instead of only the first. stdout=PIPE plus stderr=STDOUT with a ::group:: per script also
keeps the logs readable under concurrency.

3. Parallel execution does not collide on files

I checked all 23 scripts in the list for shared output paths: every one of them creates its own
tempfile.TemporaryDirectory()/mkdtemp (for example pixel_aot_check.py at main() wraps the whole mode dispatch in
one, and mesh_entry_check.py at __main__). None writes to a fixed out/ or build/ path, so max_workers=cpu_count()
does not race.

That matches your note that this does not overlap tools/run_checks_parallel.py — the isolation here comes from the
fixtures themselves.

4. The caching side is wired the way it claims

cache: 'pip' + cache-dependency-path: 'requirements-dev.txt'            python-linux, build-and-test, build-and-test-release
SCCACHE_CACHE_SIZE: '2G', SCCACHE_DIR=%RUNNER_TEMP%\sccache             both Windows jobs
mozilla-actions/sccache-action@fc920bf… # v0.0.11                       pinned, sha only
key: sccache-<os>-msvc-<toolset>-<pr|dev|release>-<hashFiles(...)>      with a restore-keys prefix
sccache --show-stats                                                    printed after each build

The hashFiles set covers CMakeLists.txt, CMakePresets.json, cmake/** and the C/C++/ASM sources, so a source edit
invalidates the cache instead of reusing stale objects, and the restore-keys prefix still gives a warm start.

One thing to keep an eye on

sccache on the build-and-test-release job means a cache hit can skip compilation while the link still runs; if a
release-only failure ever appears that does not reproduce locally, clearing the …-release- cache is the first thing to
try. Not a request, just the failure mode this introduces.

Verdict

Reviewed e9ba20ed. Coverage unchanged, failure propagation intact, parallel isolation verified per script, and the
cache configuration matches the description. No objection from me.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135354395 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1520#issuecomment-7135354395). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T15:02:15Z. --- ## Same 32 checks, failures still fail, and the parallel run cannot collide on files Independent reviewer, not the author. Reviewed `e9ba20ed`; nothing pushed to the branch. I cannot run GitHub Actions from here, so this review is static: I compared the old and new command lists, read the failure path, and checked the working-directory behaviour of every script in the new list. ### 1. Coverage is identical Parsing the removed lines and the new `CHECKS` table: ```text old: 32 python3 invocations covering 31 distinct scripts (pixel_sample_gradient_check twice) new: 32 entries covering the same 31 scripts (pixel_sample_gradient_check twice) ``` One apparent difference appeared in my first pass — `tests/rdna2_tools_check.py` looked "new only" — because the old line is env-prefixed (`LLVM_LIB=… LLVM_MC=… LLVM_OBJCOPY=… python3 -B tests/rdna2_tools_check.py`) and my pattern missed it. It is present in both, with the environment now passed through the `extra_env` dict: ```python (["tests/rdna2_tools_check.py"], {"LLVM_LIB": "libLLVM-15.so.1", "LLVM_MC": "llvm-mc-15", "LLVM_OBJCOPY": "llvm-objcopy-15"}), ``` So nothing was dropped and nothing was added. ### 2. A failure still fails the job ```python failed = [] ... if code != 0: failed.append(f"{script} (exit {code})") if failed: print("FAILED: " + ", ".join(failed), flush=True) sys.exit(1) ``` `sys.exit(1)` is there, and each check's exit code is collected rather than the first one aborting the rest, so a single run reports every failure instead of only the first. `stdout=PIPE` plus `stderr=STDOUT` with a `::group::` per script also keeps the logs readable under concurrency. ### 3. Parallel execution does not collide on files I checked all 23 scripts in the list for shared output paths: every one of them creates its own `tempfile.TemporaryDirectory()`/`mkdtemp` (for example `pixel_aot_check.py` at `main()` wraps the whole mode dispatch in one, and `mesh_entry_check.py` at `__main__`). None writes to a fixed `out/` or `build/` path, so `max_workers=cpu_count()` does not race. That matches your note that this does not overlap `tools/run_checks_parallel.py` — the isolation here comes from the fixtures themselves. ### 4. The caching side is wired the way it claims ```text cache: 'pip' + cache-dependency-path: 'requirements-dev.txt' python-linux, build-and-test, build-and-test-release SCCACHE_CACHE_SIZE: '2G', SCCACHE_DIR=%RUNNER_TEMP%\sccache both Windows jobs mozilla-actions/sccache-action@fc920bf… # v0.0.11 pinned, sha only key: sccache-<os>-msvc-<toolset>-<pr|dev|release>-<hashFiles(...)> with a restore-keys prefix sccache --show-stats printed after each build ``` The `hashFiles` set covers `CMakeLists.txt`, `CMakePresets.json`, `cmake/**` and the C/C++/ASM sources, so a source edit invalidates the cache instead of reusing stale objects, and the `restore-keys` prefix still gives a warm start. ### One thing to keep an eye on `sccache` on the `build-and-test-release` job means a cache hit can skip compilation while the link still runs; if a release-only failure ever appears that does not reproduce locally, clearing the `…-release-` cache is the first thing to try. Not a request, just the failure mode this introduces. ### Verdict Reviewed `e9ba20ed`. Coverage unchanged, failure propagation intact, parallel isolation verified per script, and the cache configuration matches the description. No objection from me.
upstream-sync closed this pull request 2026-11-24 16:02:59 +00:00
tedin7 commented 2026-11-24 16:03:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:04:18Z.


Thanks for the independent review and failure-propagation verification on Windows, @ChazY11.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135410266 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1520#issuecomment-7135410266). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:04:18Z. --- Thanks for the independent review and failure-propagation verification on Windows, @ChazY11.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1513
No description provided.