Skip to content

CI: Build examples in parallel on pull requests#782

Merged
kateinoigakukun merged 1 commit into
swiftwasm:mainfrom
PassiveLogic:kr/ci-parallel-examples
Jun 23, 2026
Merged

CI: Build examples in parallel on pull requests#782
kateinoigakukun merged 1 commit into
swiftwasm:mainfrom
PassiveLogic:kr/ci-parallel-examples

Conversation

@krodak

@krodak krodak commented Jun 23, 2026

Copy link
Copy Markdown
Member

Overview

build-examples builds every example sequentially in a single job and takes ~57 minutes. Each example is its own SwiftPM package that recompiles JavaScriptKit and swift-syntax from scratch, so the cost is dominated by repeating that swift-syntax compile back-to-back.

This turns the pull-request build-examples job into a matrix - one job per example, running concurrently - so the wall-clock time drops to that of the slowest single example. main keeps the single build-examples-deploy job (full release build) plus the GitHub Pages deploy, so published artifacts are identical. Examples are built in release to match the deploy path, and each matrix step runs build.sh from the example directory via working-directory (mirroring Utilities/build-examples.sh).

Timing

setup examples wall-clock
today (single sequential job) ~57 min
parallel matrix ~10 min

Each example still takes ~10 min on its own (dominated by compiling swift-syntax from scratch), but they now run in parallel. The main deploy job is unchanged.

Branch protection: required checks need updating

Because build-examples is now a matrix, the single build-examples status check is replaced by one per example. An admin needs to update the branch protection required checks for main: drop build-examples and add the six matrix contexts:

  • build-examples (ActorOnWebWorker)
  • build-examples (Basic)
  • build-examples (Embedded)
  • build-examples (Multithreading)
  • build-examples (OffscrenCanvas)
  • build-examples (PlayBridgeJS)

Use the job + matrix name exactly as above. The Run unit tests / prefix and the (pull_request) suffix shown in the PR merge box are display-only and are not part of the required-context string. Until this is done, the old build-examples context sits in "Expected — Waiting for status to be reported" and blocks merge.

@krodak krodak changed the title CI: Build examples in parallel (and cache) to cut build-examples wall-clock CI: Build examples in parallel + cache to cut build-examples build time Jun 23, 2026
@krodak krodak requested a review from kateinoigakukun June 23, 2026 16:10
@krodak krodak self-assigned this Jun 23, 2026
@krodak krodak removed the request for review from kateinoigakukun June 23, 2026 16:14
The `build-examples` job built all examples sequentially in a single job,
taking ~57 minutes - each example is its own SwiftPM package that recompiles
JavaScriptKit and swift-syntax from scratch, with no sharing between them.

Split the job by event:

- Pull requests fan out a matrix `build-examples` with one job per example,
  built in parallel. Wall-clock drops to that of the slowest single example
  (~10 min). Each example now reports as a separate `build-examples (<name>)`
  check, so the required status checks need updating (see PR description).
- `main` keeps the full release build of all examples plus the GitHub Pages
  deploy (`build-examples-deploy`), so published artifacts are unchanged.

Examples are built in release to match the deploy path, keeping the only
behavioral change the parallelism. Each matrix step runs `build.sh` from the
example directory (via `working-directory`), mirroring
Utilities/build-examples.sh.
@krodak krodak force-pushed the kr/ci-parallel-examples branch from e7295b6 to 28773c1 Compare June 23, 2026 16:17
Comment thread .github/workflows/test.yml Outdated
@krodak krodak force-pushed the kr/ci-parallel-examples branch from 28773c1 to 219a115 Compare June 23, 2026 17:11
@krodak krodak changed the title CI: Build examples in parallel + cache to cut build-examples build time CI: Build examples in parallel on pull requests Jun 23, 2026
@kateinoigakukun kateinoigakukun merged commit 358b38a into swiftwasm:main Jun 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants