Add a workflow to update test262 tests weekly (#12523)
* chore: draft update parser tests workflow * Build babel parser * chore: use Babel bot as git user name * use babel-bot token * refactor: use actions/github-script * rename
This commit is contained in:
parent
56c7024d5d
commit
0f866ed9d2
83
.github/workflows/update-parser-tests.yml
vendored
Normal file
83
.github/workflows/update-parser-tests.yml
vendored
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
name: Update Test262 parser tests
|
||||||
|
env:
|
||||||
|
YARN_ENABLE_SCRIPTS: false # disable post-install scripts
|
||||||
|
YARN_NODE_LINKER: pnp # use pnp linker for better performance
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs: {}
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * 5"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
createPullRequest:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: tc39/test262
|
||||||
|
path: build/test262
|
||||||
|
- name: Use Node.js latest
|
||||||
|
uses: actions/setup-node@v2-beta
|
||||||
|
with:
|
||||||
|
node-version: "*"
|
||||||
|
- name: Get yarn cache directory path
|
||||||
|
id: yarn-cache-dir-path
|
||||||
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: yarn-cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
key: yarn-${{ hashFiles('yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
yarn-
|
||||||
|
- name: Get latest test262 version
|
||||||
|
id: test262
|
||||||
|
run: echo "::set-output name=sha1::$(sh ./scripts/parser-tests/get-test262-version.sh)"
|
||||||
|
- name: Update test262 commit
|
||||||
|
run: |
|
||||||
|
echo ${{ steps.test262.outputs.sha1 }} | ./scripts/parser-tests/bump-test262-version.sh
|
||||||
|
- name: Build babel parser
|
||||||
|
run: |
|
||||||
|
yarn install --immutable --skip-builds
|
||||||
|
yarn gulp build-rollup
|
||||||
|
- name: Update test262 allow list
|
||||||
|
run: |
|
||||||
|
make test-test262-update-allowlist
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config user.name "Babel Bot"
|
||||||
|
git config user.email "Babel Bot <babel-bot@users.noreply.github.com>"
|
||||||
|
git checkout -b update-test262-parser
|
||||||
|
git commit -am "chore: update test262 to ${{ steps.test262.outputs.sha1 }}"
|
||||||
|
git push --force origin update-test262-parser
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: actions/github-script@v3
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const base = process.env.GITHUB_REF.replace("/ref/heads/", "");
|
||||||
|
const { data: prs } = await github.pulls.list({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
head: "update-test262-parser",
|
||||||
|
base: base
|
||||||
|
});
|
||||||
|
if (prs.length === 0) {
|
||||||
|
const { data: pr } = await github.pulls.create({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
head: "update-test262-parser",
|
||||||
|
base: base,
|
||||||
|
maintainer_can_modify: true,
|
||||||
|
title: "Update test262",
|
||||||
|
body: "Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}).",
|
||||||
|
});
|
||||||
|
|
||||||
|
github.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: pr.number,
|
||||||
|
labels: ["area: test262", "repo automation 🤖"]
|
||||||
|
})
|
||||||
|
}
|
||||||
7
scripts/parser-tests/bump-test262-version.sh
Executable file
7
scripts/parser-tests/bump-test262-version.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# read given commit SHA1 from stdin, update to TEST262_COMMIT in Makefile
|
||||||
|
# usage:
|
||||||
|
# sh ./scripts/parser-tests/get-test262-version.sh | sh ./scripts/parser-tests/bump-test262-version.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
perl -i -pe 's/^TEST262_COMMIT.+$/TEST262_COMMIT = '$(cat)'/' ./Makefile
|
||||||
9
scripts/parser-tests/get-test262-version.sh
Executable file
9
scripts/parser-tests/get-test262-version.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Get the latest HEAD of tc39/test262
|
||||||
|
# usage:
|
||||||
|
# sh ./scripts/parser-tests/bump-test262-version.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
export GIT_DIR=./build/test262/.git
|
||||||
|
git fetch -q origin HEAD
|
||||||
|
git rev-parse FETCH_HEAD
|
||||||
Loading…
x
Reference in New Issue
Block a user