CI: Build examples in parallel on pull requests#15
Open
krodak wants to merge 6 commits into
Open
Conversation
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The `declare global { namespace ... }` class stub rendered every method
without `static` and filtered properties to instance-only, so a `@JS static
func` on a namespaced class was typed as an instance method and a `@JS
static var` was omitted from the generated `.d.ts`.
This was a type-only defect: the emitted JavaScript already exposes these
members statically (and the class's namespace export entry types them
correctly), so only TypeScript consumers were affected. Split static and
instance members in this path: emit static methods with `static` and
include static properties.
This has been incorrect since the global namespace class stub was
introduced, not a regression. The `Namespaces.Global` snapshot already
exercises a namespaced class with `static func`/`static var` but had
recorded the wrong output, so it is updated to the corrected declarations.
…e-static-members BridgeJS: Emit static members in declare global class declarations
Propagate Swift `///` and `/** */` documentation on exported declarations into the generated TypeScript declarations as JSDoc, so editors surface hover docs for the bridged API. The exporter now captures the leading doc comment for functions, classes, methods, properties, constructors, structs, and enums into the skeleton, and the linker renders it as a single JSDoc block. The Swift DocC field list is mapped as the inverse of the TS2Swift importer: the leading description becomes the JSDoc body, `- Parameters:`/`- Parameter x:` become `@param`, `- Returns:` becomes `@returns`, and `- Throws:` becomes `@throws`. Existing default-value annotations are merged into the same block so a parameter never emits two comment blocks; declarations without doc comments produce byte-identical output to before.
…c-comments BridgeJS: Include Swift doc comments in generated d.ts
166377f to
e7295b6
Compare
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.
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 with no sharing between them, so the cost is dominated by repeating that swift-syntax compile back-to-back.Two improvements, in two commits:
1. Build examples in parallel on pull requests. A matrix
build-exampleruns one job per example concurrently, with an aggregatebuild-examplesjob gating on the matrix so the existing required status check of that name keeps working unchanged.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).2. Cache each example's
.build. Keyed on the workflow file and the example'sPackage.resolved. On a warm cache the matrix jobs skip recompiling swift-syntax, which is the bulk of a cold example build.Timing comparison (per-example matrix wall-clock)
Typical PRs change source, not
Package.resolvedor the workflow, so they hit the warm path: ~57 min → ~2 min. Cold runs (first run, or when deps/workflow change) pay a small cache-save overhead. GitHub's 10 GB cache budget is shared across the six example.buildcaches, so heavy eviction would fall back to cold runs.No measurements were taken on the
maindeploy job; it is unchanged.Question
I kept the required status check working by adding an aggregate
build-examplesjob that depends on the matrix, so the required context name is unchanged and branch protection needs no edits. The alternative would be to drop the aggregate and make the per-examplebuild-example (<name>)checks required instead. I assumed keeping the currentbuild-examplesname and required-check setup as-is is preferable - happy to switch to per-example required checks if you'd rather.