Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/update-test262-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Update Test262 tests

on:
# Trigger at every Sunday UTC noon, or manually.
schedule:
- cron: '0 12 * * 0'
workflow_dispatch:

jobs:
update-test262:
runs-on: ubuntu-24.04
steps:
- name: Checkout WPT repo
uses: actions/checkout@v4
with:
path: wpt
- name: Checkout Test262 repo
uses: actions/checkout@v4
with:
repository: tc39/test262
path: test262-spec
- name: Copy Test262 tests to WPT
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we copy everything and instead configure the CI to only run specific directories for now? That will perhaps make things easier if people want to run a different subset in their own CI.

# 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"
Comment on lines +23 to +60
Copy link
Contributor

@DanielRyanSmith DanielRyanSmith Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong agree with this; I don't think we should have non-trivial scripts directly in GH actions files.

env:
GIT_AUTHOR_NAME: "wpt-pr-bot"
GIT_AUTHOR_EMAIL: "[email protected]"
BRANCH_PREFIX: "test262-update"
COMMIT_TITLE: "Update Test262 tests"
- name: Create PR
if: ${{ steps.commit.outcome == 'success' }}
run: |
cd wpt
git push --set-upstream origin $BRANCH_NAME
gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_TITLE: "Update Test262 tests"
PR_BODY: "Scheduled weekly update auto-generated by the '${{ github.workflow }}' workflow."