Skip to content

Parallelize background CI tasks with wait steps - #15511

Closed
reaperhulk wants to merge 1 commit into
mainfrom
claude/ci-parallelization-msr605
Closed

Parallelize background CI tasks with wait steps#15511
reaperhulk wants to merge 1 commit into
mainfrom
claude/ci-parallelization-msr605

Conversation

@reaperhulk

Copy link
Copy Markdown
Member

Optimize CI workflow performance by running long-running installation tasks in the background and waiting for them to complete only when needed.

Summary

This change refactors the GitHub Actions CI workflows to parallelize independent setup tasks. Instead of running llvm-tools and nox installations sequentially, they now run in the background while other tasks (cache restoration, vector downloads, OpenSSL setup) proceed in parallel. Wait steps are strategically placed to ensure dependencies are satisfied before they're needed.

Key Changes

  • Linux job: Move llvm-tools and nox installations to background tasks that overlap with cache/vector operations, with wait steps before bindgen install and nox environment creation
  • Linux FIPS job: Move nox installation to background, running before cache restore and vector download, with wait step before nox environment creation
  • Linux Alpine job: Move nox installation to background with the same pattern as FIPS job
  • macOS job: Move both llvm-tools and nox installations to background tasks that overlap with cache/vector/artifact operations, with a combined wait step before the build
  • Coverage job: Move coverage installation to background so it overlaps with the alls-green check, with wait step before combining coverage data

Implementation Details

  • Background tasks are marked with background: true and given unique id values for reference
  • Wait steps use the wait field to reference background task IDs
  • Wait steps are placed at the earliest point where the installed tools are needed
  • Comments explain the rationale for each background task and its wait step placement
  • The create pip cache dir step in FIPS and Alpine jobs is moved before the background nox install to ensure the cache directory exists before pip runs

https://claude.ai/code/session_01GFG654D9KD6rxzQ6R453qm

The coverage install sits on the critical path ahead of the artifact
download, which it has nothing to do with, and steps otherwise execute in
sequence. Mark it `background: true` and `wait:` for it once the download
is done. Measured, the install and the download now occupy the same two
second window and the wait costs nothing, taking the job from 20s to 17s.

A background step that fails is reported at the wait, so a broken install
still fails the job.

The alls-green check moves to the end of the job because of an awkward
interaction: a `wait:` step does not accept an `if:` (the workflow fails
to parse with "Unexpected value 'if'"), so the wait cannot carry
`always()` and has to sit in a prefix of steps that nothing failing can
skip. Every step in this job already ran under `always()`, so the check's
position was not gating anything - it only sets the job's conclusion. It
keeps `always()` in its new position so a coverage failure doesn't skip
it and lose the report of which needed job failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFG654D9KD6rxzQ6R453qm
@reaperhulk
reaperhulk force-pushed the claude/ci-parallelization-msr605 branch from 02e0d89 to 66a1269 Compare August 24, 2026 12:39
@reaperhulk reaperhulk closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants