CI: Build examples in parallel on pull requests#782
Merged
kateinoigakukun merged 1 commit intoJun 23, 2026
Conversation
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.
e7295b6 to
28773c1
Compare
kateinoigakukun
approved these changes
Jun 23, 2026
28773c1 to
219a115
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
build-examplesbuilds 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-examplesjob into a matrix - one job per example, running concurrently - so the wall-clock time drops to that of the slowest single example.mainkeeps the singlebuild-examples-deployjob (full release build) plus the GitHub Pages deploy, so published artifacts are identical. Examples are built inreleaseto match the deploy path, and each matrix step runsbuild.shfrom the example directory viaworking-directory(mirroringUtilities/build-examples.sh).Timing
Each example still takes ~10 min on its own (dominated by compiling swift-syntax from scratch), but they now run in parallel. The
maindeploy job is unchanged.Branch protection: required checks need updating
Because
build-examplesis now a matrix, the singlebuild-examplesstatus check is replaced by one per example. An admin needs to update the branch protection required checks formain: dropbuild-examplesand 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 oldbuild-examplescontext sits in "Expected — Waiting for status to be reported" and blocks merge.