Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add core WebAssembly tests to WPT #49277

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
65 changes: 65 additions & 0 deletions .github/workflows/update-wasm-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Update Wasm tests

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

jobs:
build-wpt:
runs-on: ubuntu-latest
steps:
- name: Checkout WPT repo
uses: actions/checkout@v4
with:
path: main
- name: Checkout Wasm repo
uses: actions/checkout@v4
with:
repository: WebAssembly/spec
path: wasm-spec
- name: Setup OCaml
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: 4.14.x
- name: Setup OCaml tools
run: opam install --yes ocamlfind.1.9.5 js_of_ocaml.4.0.0 js_of_ocaml-ppx.4.0.0
- name: Build interpreter
run: cd wasm-spec/interpreter && opam exec make
- name: Convert WAST tests to WPT
run: wasm-spec/test/build.py --dont-recompile --html wasm-spec/out/
- name: Copy Wasm tests to WPT
# Replace wasm/core entirely and fix up testharness paths.
run: |
rm -rf main/wasm/core
cp -r wasm-spec/out/ main/wasm/core/
find main/wasm/core/ -type f -name '*.html' -exec sed -i 's/\.\/js\/harness\/testharness/\/resources\/testharness/' {} \;
- name: Commit changes
Copy link

Choose a reason for hiding this comment

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

If you use the peter-evans/create-pull-request action as the WebIDL workflow does, you don't need to manually commit the changes or do anything with git itself.

Copy link

Choose a reason for hiding this comment

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

Another example is what we do in emscripten to create a PR, request a review from a github team, and set the PR to auto-merge (after approval and passing tests)

Copy link
Member Author

Choose a reason for hiding this comment

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

We do something similar in the wpt-metadata repo, but I'm always wary of using 3rd-party libraries for security reasons. However, I see the author of this action is now working for GitHub, so maybe this is less of a concern.

Copy link

Choose a reason for hiding this comment

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

Yeah, that makes sense. I'm fine either way, up to you.

id: commit
continue-on-error: true
run: |
cd main
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 wasm/core/
git commit -m "$COMMIT_TITLE"
env:
GIT_AUTHOR_NAME: "wpt-pr-bot"
GIT_AUTHOR_EMAIL: "[email protected]"
BRANCH_PREFIX: "wasm-update"
COMMIT_TITLE: "Update Wasm tests"
- name: Create PR
# Check outcome for success as continue-on-error will mask failure.
if: ${{ steps.commit.outcome == 'success' }}
run: |
cd main
git push --set-upstream origin $BRANCH_NAME
gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY" --reviewer past
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_TITLE: "Update Wasm tests"
PR_BODY: "Scheduled weekly update auto-generated by the '${{ github.workflow }}' workflow."