[ci] Render an upstream baseline copy of the spec in proposal repos - #2229
[ci] Render an upstream baseline copy of the spec in proposal repos#2229kmiller68 wants to merge 1 commit into
Conversation
Proposal repos are plain forks of `WebAssembly/spec`, so their published webassembly.github.io/<proposal>/ site has no rendered copy of the unmodified spec to compare against. The proposals often also lag behind the upstream spec so a direct comparison between the rendered specs is full of false differences. A reviewer who wants to see what a proposal actually does to the spec text has to build upstream themselves, or read source diffs, which is particularly awkward for parts of the spec which are generated in the output. e.g. typeset rules, tables, appendices, etc. With this change a fork also renders every document at the commit where it diverged from its parent repo, and publishes the result under webassembly.github.io/<proposal>/upstream with the same layout as the main site. This will allow us to link to W3C's spec diff service and view a formatted and searchable comparison with a single URL. e.g. https://services.w3.org/htmldiff?doc1=https://webassembly.github.io/<proposal>/upstream/core/bikeshed/&doc2=https://webassembly.github.io/<proposal>/core/bikeshed/ The baseline is chosen by a new resolve-baseline job, which asks the `gh` API for the repository's parent, fetches the parent's main, and takes `git merge-base`. For most proposals which sync by merging upstream, this resolves to the most recent sync point. When running on `WebAssembly/spec`, a fork with no changes of its own, or when the parent cannot be determined / fetched, the job short-circuits and no upstream copy is generated. The commit upstream was rendered from is recorded at /upstream/baseline-sha and compared on the next run. When the shas match, the upstream variant is dropped from the build matrix and the published copy is carried over instead of being rendered again. This saves a decent amount of CI time for most (non-downstreaming) commits.
|
For help with reviewing here are two CI runs:
Published output from the two current runs:
After writing this I also realized that gh-pages is actually a git repo itself. So in theory there are historical renderings from the merge-base. That said, there are a few reasons I uploaded this anyway:
|
|
One other decision I made is to use |
tlively
left a comment
There was a problem hiding this comment.
Nice! I will definitely use this.
| mv _upstream/core-rendered-upstream _output/upstream/core | ||
| mv _upstream/js-api-rendered-upstream _output/upstream/js-api | ||
| mv _upstream/web-api-rendered-upstream _output/upstream/web-api | ||
| mv _upstream/code-metadata-rendered-upstream _output/upstream/metadata/code | ||
| mv _upstream/legacy-exceptions-core-rendered-upstream _output/upstream/legacy/exceptions/core | ||
| mv _upstream/legacy-exceptions-js-api-rendered-upstream _output/upstream/legacy/exceptions/js-api | ||
| mv _upstream/versions-rendered-upstream _output/upstream/versions |
There was a problem hiding this comment.
Can we avoid listing out all these directories so we can't accidentally forget to add new directories in the future?
| published=$(gh api "repos/$REPOSITORY/contents/$BASELINE_STAMP?ref=gh-pages" \ | ||
| --jq .content 2>/dev/null | base64 -d | tr -d '[:space:]') || published='' |
There was a problem hiding this comment.
https://github.com/kmiller68/spec/actions/runs/31828913256/job/94859702501 logs "base64: invalid input" here. Is that expected?
Proposal repos are plain forks of
WebAssembly/spec, so their published webassembly.github.io// site has no rendered copy of the unmodified spec to compare against. The proposals often also lag behind the upstream spec so a direct comparison between the rendered specs is full of false differences. A reviewer who wants to see what a proposal actually does to the spec text has to build upstream themselves, or read source diffs, which is particularly awkward for parts of the spec which are generated in the output. e.g. typeset rules, tables, appendices, etc.With this change a fork also renders every document at the commit where it diverged from its parent repo, and publishes the result under webassembly.github.io//upstream with the same layout as the main site. This will allow us to link to W3C's spec diff service and view a formatted and searchable comparison with a single URL. e.g.
https://services.w3.org/htmldiff?doc1=https://webassembly.github.io//upstream/core/bikeshed/&doc2=https://webassembly.github.io//core/bikeshed/
The baseline is chosen by a new resolve-baseline job, which asks the
ghAPI for the repository's parent, fetches the parent's main, and takesgit merge-base. For most proposals which sync by merging upstream, this resolves to the most recent sync point. When running onWebAssembly/spec, a fork with no changes of its own, or when the parent cannot be determined / fetched, the job short-circuits and no upstream copy is generated.The commit upstream was rendered from is recorded at /upstream/baseline-sha and compared on the next run. When the shas match, the upstream variant is dropped from the build matrix and the published copy is carried over instead of being rendered again. This saves a decent amount of CI time for most (non-downstreaming) commits.