feat(automation): Add workflow to vendor and update Test262 tests [pt 4/5]#56843
feat(automation): Add workflow to vendor and update Test262 tests [pt 4/5]#56843jcscottiii wants to merge 5 commits intomasterfrom
Conversation
35d9c44 to
3374ad9
Compare
6406255 to
04e3166
Compare
3374ad9 to
a2d6c63
Compare
04e3166 to
e8ec10a
Compare
a2d6c63 to
258c427
Compare
e8ec10a to
b3adcf7
Compare
| run: | | ||
| LATEST_SHA=$(git -C test262-spec rev-parse HEAD) | ||
| echo "Latest remote Test262 SHA: $LATEST_SHA" | ||
|
|
||
| rm -rf wpt/third_party/test262/test/ | ||
| mkdir -p wpt/third_party/test262/test/ | ||
| mkdir -p wpt/third_party/test262/harness/ | ||
|
|
||
| # Selectively copy only Interop 2026 feature tests for now | ||
| # See: https://github.com/web-platform-tests/wpt.fyi/issues/4681 | ||
| # Mapping of web feature to test directory can be found at: https://github.com/tc39/test262/blob/main/WEB_FEATURES.yml | ||
| # Temporal tests | ||
| mkdir -p wpt/third_party/test262/test/built-ins/Date/prototype/toTemporalInstant | ||
| mkdir -p wpt/third_party/test262/test/built-ins/Temporal | ||
| mkdir -p wpt/third_party/test262/test/intl402/Temporal | ||
| cp -r test262-spec/test/built-ins/Date/prototype/toTemporalInstant/* wpt/third_party/test262/test/built-ins/Date/prototype/toTemporalInstant | ||
| cp -r test262-spec/test/built-ins/Temporal/* wpt/third_party/test262/test/built-ins/Temporal | ||
| cp -r test262-spec/test/intl402/Temporal/* wpt/third_party/test262/test/intl402/Temporal | ||
|
|
||
| # Top-level-await tests | ||
| mkdir -p wpt/third_party/test262/test/language/module-code/top-level-await | ||
| cp -r test262-spec/test/language/module-code/top-level-await/* wpt/third_party/test262/test/language/module-code/top-level-await | ||
|
|
||
| # Always sync the harness files | ||
| rsync -a --delete test262-spec/harness/ wpt/third_party/test262/harness/ | ||
| printf "[test262]\nsource = \"https://github.com/tc39/test262\"\nrev = \"${LATEST_SHA}\"\n" > wpt/third_party/test262/vendored.toml | ||
| - name: Commit changes | ||
| id: commit | ||
| continue-on-error: true | ||
| run: | | ||
| cd wpt | ||
| export BRANCH_NAME="$BRANCH_PREFIX-$(date +'%Y%m%d%H%M%S')" | ||
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
| git config user.name "$GIT_AUTHOR_NAME" | ||
| git config user.email "$GIT_AUTHOR_EMAIL" | ||
| git checkout -B $BRANCH_NAME | ||
| git add third_party/test262/ | ||
| git commit -m "$COMMIT_TITLE" |
There was a problem hiding this comment.
Optional nit: The scripts are somewhat long and may be subject to change. Would it be better to move some of this to a separate file?
There was a problem hiding this comment.
Strong agree with this; I don't think we should have non-trivial scripts directly in GH actions files.
DanielRyanSmith
left a comment
There was a problem hiding this comment.
This suggestion came from a Gemini code review:
Focus: The "Selectively copies" step.
Critique:
The work is described as "selectively copying" files from Test262 to WPT.
- The Risk: If a test file is deleted or renamed in the upstream
tc39/test262repository, a simple copy operation (likecp -rorcheckout-index) will not remove the old file from yourthird_party/test262directory. Over time, your vendored directory will accumulate "zombie tests"—files that no longer exist upstream but persist in WPT, potentially causing confusing failures or bloat. - Suggested Fix: You must use a sync method that handles deletions (e.g.,
rsync --deleteor explicitly deleting the target directory before copying). - Constraint: Ensure you do not accidentally delete WPT-specific files (like
README.wpt,DIR_METADATA, orOWNERS) that might live in that directory.
258c427 to
94dd567
Compare
This commit introduces a GitHub Actions workflow to automate the
vendoring of the Test262 test suite into `third_party/test262`. This
automation is the final piece of the integration, ensuring that the
tests can be kept up-to-date with the upstream `tc39/test262` repository.
The workflow is configured to run weekly or can be triggered manually.
It performs the following steps:
1. Checks out both the WPT and `tc39/test262` repositories.
2. Selectively copies a subset of the Test262 tests into WPT.
3. Copies the essential Test262 harness files.
4. Creates a `vendored.toml` file at the root of the vendored directory,
recording the specific commit SHA from `tc39/test262` that the
files were sourced from. This ensures traceability, as described
in the RFC.
5. Commits the updated files and opens a pull request with the changes.
Initially, only a subset of Test262 tests related to Interop 2026
features (`Temporal` and `top-level-await`) are being imported. This is
a temporary measure to manage the volume of new test results and to
avoid overloading wpt.fyi, which currently has limitations in processing
the full Test262 result set (see wpt-fyi/issues/4681). The workflow can
be expanded to include more tests in the future.
This work directly supports the integration of Test262 into WPT as detailed
in the RFC: web-platform-tests/rfcs#229
This commit is part of a series of smaller PRs split from the larger,
original implementation in #55997.
b3adcf7 to
a062397
Compare
| run: | | ||
| LATEST_SHA=$(git -C test262-spec rev-parse HEAD) | ||
| echo "Latest remote Test262 SHA: $LATEST_SHA" | ||
|
|
||
| rm -rf wpt/third_party/test262/test/ | ||
| mkdir -p wpt/third_party/test262/test/ | ||
| mkdir -p wpt/third_party/test262/harness/ | ||
|
|
||
| # Selectively copy only Interop 2026 feature tests for now | ||
| # See: https://github.com/web-platform-tests/wpt.fyi/issues/4681 | ||
| # Mapping of web feature to test directory can be found at: https://github.com/tc39/test262/blob/main/WEB_FEATURES.yml | ||
| # Temporal tests | ||
| mkdir -p wpt/third_party/test262/test/built-ins/Date/prototype/toTemporalInstant | ||
| mkdir -p wpt/third_party/test262/test/built-ins/Temporal | ||
| mkdir -p wpt/third_party/test262/test/intl402/Temporal | ||
| cp -r test262-spec/test/built-ins/Date/prototype/toTemporalInstant/* wpt/third_party/test262/test/built-ins/Date/prototype/toTemporalInstant | ||
| cp -r test262-spec/test/built-ins/Temporal/* wpt/third_party/test262/test/built-ins/Temporal | ||
| cp -r test262-spec/test/intl402/Temporal/* wpt/third_party/test262/test/intl402/Temporal | ||
|
|
||
| # Top-level-await tests | ||
| mkdir -p wpt/third_party/test262/test/language/module-code/top-level-await | ||
| cp -r test262-spec/test/language/module-code/top-level-await/* wpt/third_party/test262/test/language/module-code/top-level-await | ||
|
|
||
| # Always sync the harness files | ||
| rsync -a --delete test262-spec/harness/ wpt/third_party/test262/harness/ | ||
| printf "[test262]\nsource = \"https://github.com/tc39/test262\"\nrev = \"${LATEST_SHA}\"\n" > wpt/third_party/test262/vendored.toml | ||
| - name: Commit changes | ||
| id: commit | ||
| continue-on-error: true | ||
| run: | | ||
| cd wpt | ||
| export BRANCH_NAME="$BRANCH_PREFIX-$(date +'%Y%m%d%H%M%S')" | ||
| echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | ||
| git config user.name "$GIT_AUTHOR_NAME" | ||
| git config user.email "$GIT_AUTHOR_EMAIL" | ||
| git checkout -B $BRANCH_NAME | ||
| git add third_party/test262/ | ||
| git commit -m "$COMMIT_TITLE" |
There was a problem hiding this comment.
Strong agree with this; I don't think we should have non-trivial scripts directly in GH actions files.
|
@DanielRyanSmith @jgraham this is ready for review again. |
.github/update-test262.sh
Outdated
| # This script is intended to be run from the root of the WPT repository. | ||
| # It expects a checkout of tc39/test262 in a directory named 'test262-spec' | ||
| # at the same level as the WPT repository (or as configured below). |
There was a problem hiding this comment.
This should be in tools/ci. You can look at the ci_* scripts for the pattern we use to ensure that the pwd is set correctly.
.github/update-test262.sh
Outdated
| # -a: archive mode | ||
| # --delete: delete extraneous files from dest dirs | ||
| # --exclude: preserve WPT-specific metadata | ||
| RSYNC_OPTS=(-a --delete --exclude 'README.wpt' --exclude 'DIR_METADATA' --exclude 'OWNERS' --exclude 'WEB_FEATURES.yml') |
There was a problem hiding this comment.
This exclude list feels very fragile, and like we're going to eventually be surprised that someone adds META.yml or similar, and then finds that it's deleted later. Ideally we'd have all the files that are synced in a directory that's only synced, but at the very least this kind of config should live inside the test262 directory itself, so that someone updating it might find it.
| @@ -440,6 +440,7 @@ SET TIMEOUT: acid/acid3/test.html | |||
| *: resources/webidl2/* | |||
| *: tools/* | |||
| *: */third_party/* | |||
There was a problem hiding this comment.
@jgraham FYI. The tests that will be imported into WPT_ROOT/third_party, do not trigger this rule. I had to add the rule below to silence the lint errors.
| cd wpt | ||
| git push --set-upstream origin $BRANCH_NAME | ||
| gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY" | ||
| gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY" --reviewer jcscottiii |
There was a problem hiding this comment.
This looks pretty sus :) If we need a reviewer set then it should probably be @wpt-pr-bot
There was a problem hiding this comment.
Good call out! I was just following the wasm one: https://github.com/web-platform-tests/wpt/blob/master/.github/workflows/update-wasm-tests.yml
Happy to also create a pr to change that to wpt-pr-bot too.
There was a problem hiding this comment.
Edit: I updated the wasm one to do the same thing #58554
This commit introduces a GitHub Actions workflow to automate the vendoring of the Test262 test suite into
third_party/test262. This automation is the final piece of the integration, ensuring that the tests can be kept up-to-date with the upstreamtc39/test262repository.The workflow is configured to run weekly or can be triggered manually. It performs the following steps:
tc39/test262repositories.vendored.tomlfile at the root of the vendored directory, recording the specific commit SHA fromtc39/test262that the files were sourced from. This ensures traceability, as described in the RFC.Initially, only a subset of Test262 tests related to Interop 2026 features (
Temporalandtop-level-await) are being imported. This is a temporary measure to manage the volume of new test results and to avoid overloading wpt.fyi, which currently has limitations in processing the full Test262 result set (see wpt-fyi/issues/4681). The workflow can be expanded to include more tests in the future.This work directly supports the integration of Test262 into WPT as detailed in the RFC: web-platform-tests/rfcs#229
This commit is part of a series of smaller PRs split from the larger, original implementation in #55997.