|
| 1 | +name: Update Wasm tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Trigger at every Sunday UTC noon, or manually. |
| 5 | + schedule: |
| 6 | + - cron: 0 12 * * 0 |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-wpt: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout WPT repo |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + path: wpt |
| 17 | + - name: Checkout Wasm repo |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + repository: WebAssembly/spec |
| 21 | + path: wasm-spec |
| 22 | + - name: Setup OCaml |
| 23 | + uses: ocaml/setup-ocaml@v3 |
| 24 | + with: |
| 25 | + ocaml-compiler: 4.14.x |
| 26 | + - name: Setup OCaml tools |
| 27 | + run: opam install --yes ocamlfind.1.9.5 js_of_ocaml.4.0.0 js_of_ocaml-ppx.4.0.0 |
| 28 | + - name: Build interpreter |
| 29 | + run: cd wasm-spec/interpreter && opam exec make |
| 30 | + - name: Convert WAST tests to WPT |
| 31 | + run: wasm-spec/test/build.py --dont-recompile --html wasm-spec/out/ |
| 32 | + - name: Copy Wasm tests to WPT |
| 33 | + # Replace wasm/core entirely. |
| 34 | + run: | |
| 35 | + rm -rf wpt/wasm/core |
| 36 | + cp -r wasm-spec/out/ wpt/wasm/core/ |
| 37 | + - name: Commit changes |
| 38 | + id: commit |
| 39 | + continue-on-error: true |
| 40 | + run: | |
| 41 | + cd wpt |
| 42 | + export BRANCH_NAME="$BRANCH_PREFIX-$(date +'%Y%m%d%H%M%S')" |
| 43 | + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV |
| 44 | + git config user.name "$GIT_AUTHOR_NAME" |
| 45 | + git config user.email "$GIT_AUTHOR_EMAIL" |
| 46 | + git checkout -b $BRANCH_NAME |
| 47 | + git add wasm/core/ |
| 48 | + git commit -m "$COMMIT_TITLE" |
| 49 | + env: |
| 50 | + GIT_AUTHOR_NAME: "wpt-pr-bot" |
| 51 | + GIT_AUTHOR_EMAIL: "[email protected]" |
| 52 | + BRANCH_PREFIX: "wasm-update" |
| 53 | + COMMIT_TITLE: "Update Wasm tests" |
| 54 | + - name: Create PR |
| 55 | + # Check outcome for success as continue-on-error will mask failure. |
| 56 | + if: ${{ steps.commit.outcome == 'success' }} |
| 57 | + run: | |
| 58 | + cd wpt |
| 59 | + git push --set-upstream origin $BRANCH_NAME |
| 60 | + gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY" --reviewer past |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + COMMIT_TITLE: "Update Wasm tests" |
| 64 | + PR_BODY: "Scheduled weekly update auto-generated by the '${{ github.workflow }}' workflow." |
0 commit comments