Skip to content

Commit ee1688e

Browse files
committed
CI: Build examples in parallel on pull requests
The `build-examples` job built all examples sequentially in release mode 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 run a matrix with one job per example, built in `debug`, purely to catch breakage. Parallelism collapses the wall-clock time, and debug skips the wasm optimization cost that PRs don't need. - `main` keeps the full release build of all examples plus the GitHub Pages deploy (`build-examples-deploy`), so published artifacts are unchanged. No caching is introduced here; that can be layered on later once its cross-run reliability is verified.
1 parent ebbde04 commit ee1688e

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,40 @@ jobs:
155155
exit 1
156156
}
157157
158+
# Pull requests: compile every example in parallel (debug) just to catch breakage.
159+
# One job per example avoids rebuilding JavaScriptKit + swift-syntax 6x in series.
158160
build-examples:
161+
if: github.event_name == 'pull_request'
162+
runs-on: ubuntu-latest
163+
strategy:
164+
fail-fast: false
165+
matrix:
166+
example:
167+
- ActorOnWebWorker
168+
- Basic
169+
- Embedded
170+
- Multithreading
171+
- OffscrenCanvas
172+
- PlayBridgeJS
173+
steps:
174+
- uses: actions/checkout@v7
175+
- uses: ./.github/actions/install-swift
176+
with:
177+
download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2026-05-27-a/swift-DEVELOPMENT-SNAPSHOT-2026-05-27-a-ubuntu22.04.tar.gz
178+
- uses: swiftwasm/setup-swiftwasm@v2
179+
id: setup-wasm32-unknown-wasip1
180+
with: { target: wasm32-unknown-wasip1 }
181+
- uses: swiftwasm/setup-swiftwasm@v2
182+
id: setup-wasm32-unknown-wasip1-threads
183+
with: { target: wasm32-unknown-wasip1-threads }
184+
- run: ./Examples/${{ matrix.example }}/build.sh debug
185+
env:
186+
SWIFT_SDK_ID_wasm32_unknown_wasip1_threads: ${{ steps.setup-wasm32-unknown-wasip1-threads.outputs.swift-sdk-id }}
187+
SWIFT_SDK_ID_wasm32_unknown_wasip1: ${{ steps.setup-wasm32-unknown-wasip1.outputs.swift-sdk-id }}
188+
189+
# main: build all examples in release and publish them to GitHub Pages.
190+
build-examples-deploy:
191+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
159192
runs-on: ubuntu-latest
160193
steps:
161194
- uses: actions/checkout@v7
@@ -184,7 +217,7 @@ jobs:
184217
environment:
185218
name: github-pages
186219
url: ${{ steps.deployment.outputs.page_url }}
187-
needs: build-examples
220+
needs: build-examples-deploy
188221
permissions:
189222
pages: write
190223
id-token: write

0 commit comments

Comments
 (0)