Skip to content

Commit 57f974f

Browse files
committed
fix: Add weekly baseline testing
1 parent 9546fe1 commit 57f974f

File tree

8 files changed

+56620
-1390
lines changed

8 files changed

+56620
-1390
lines changed

.github/workflows/build_test.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@ jobs:
4343
./wpt/wpt manifest
4444
./wpt/wpt serve --inject-script=${{ github.workspace }}/dist/container-query-polyfill.modern.js &
4545
npm test
46-
47-
- name: Open Pull Request
48-
env:
49-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
run: |
51-
node --loader ts-node/esm ./tests/diff.ts
52-
git config user.name github-actions[bot]
53-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
54-
git checkout -b update-wpt-baseline-${{ github.job_id }}
55-
git add ./tests/baseline.json
56-
git commit -m "Update Web Platform Test baseline"
57-
git push -u origin HEAD
58-
gh pr create --title "[Automated] Update Web Platform Tests" --body-file ./tests/pr.txt
46+
ret=$(node --loader ts-node/esm ./tests/diff.ts)
47+
npm run prettier:fix
48+
cat ./tests/pr.txt >> $GITHUB_STEP_SUMMARY
49+
if [ $ret == "changed" ]; then
50+
exit 1
51+
fi
52+
- uses: actions/upload-artifact@v3
53+
with:
54+
name: baseline.json
55+
path: ./tests/baseline.json
56+
if: failure()
57+
- uses: actions/upload-artifact@v3
58+
with:
59+
name: results.json
60+
path: ./tests/results.json
61+
if: failure()

.github/workflows/release-please.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: release-please
33
on:
44
push:
55
branches:
6-
- main
6+
- x-rework-test-results
77

88
jobs:
99
release-please:
@@ -22,6 +22,8 @@ jobs:
2222
if: ${{ steps.release.outputs.release_created }}
2323
- run: npm install
2424
if: ${{ steps.release.outputs.release_created }}
25+
- run: npm run build
26+
if: ${{ steps.release.outputs.release_created }}
2527

2628
- uses: actions/setup-node@v3
2729
with:
@@ -31,4 +33,4 @@ jobs:
3133
- run: npm publish
3234
env:
3335
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
34-
if: ${{ steps.release.outputs.release_created }}
36+
if: ${{ steps.release.outputs.release_created }}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Update WPT Baseline
2+
3+
on:
4+
workflow_dispatch:
5+
branches: [main]
6+
schedule:
7+
- cron: '0 0 * * 1'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
env:
13+
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
14+
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
15+
WPT_MANIFEST: ${{ github.workspace }}/wpt/MANIFEST.json
16+
SCHEDULED_BASELINE_DIFF: true
17+
steps:
18+
- uses: actions/checkout@v3
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: '16'
22+
- uses: actions/setup-python@v3
23+
with:
24+
python-version: '3.x'
25+
- uses: actions/checkout@v3
26+
with:
27+
repository: devknoll/wpt
28+
path: wpt
29+
ref: x-polyfill-all-tests
30+
31+
- name: Build
32+
run: |
33+
npm install
34+
npm run build:wpt
35+
36+
- name: Setup WPT
37+
run: |
38+
cd wpt
39+
pip install virtualenv
40+
./wpt make-hosts-file | sudo tee -a /etc/hosts
41+
- name: Run Tests
42+
run: |
43+
npm run serve &
44+
./wpt/wpt manifest
45+
./wpt/wpt serve --inject-script=${{ github.workspace }}/dist/container-query-polyfill.modern.js &
46+
npm test
47+
48+
- name: Open Pull Request
49+
env:
50+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
run: |
52+
ret=(node --loader ts-node/esm ./tests/diff.ts)
53+
if [ $ret == "unchanged" ]; then
54+
exit 0
55+
fi
56+
npm run prettier:fix
57+
git config user.name github-actions[bot]
58+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
59+
git checkout -b update-wpt-baseline-$(date +"%Y-%m-%d")
60+
git add ./tests/baseline.json
61+
git commit -m "Update Web Platform Test baseline"
62+
git push -u origin HEAD
63+
gh pr create --title "[Automated] Update Web Platform Tests" --body-file ./tests/pr.txt --label "update-baseline"

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
dist/
1+
dist/
2+
wpt/

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
"name": "container-query-polyfill",
33
"version": "1.0.0",
44
"description": "",
5-
"repository": "github:GoogleChromeLabs/container-query-polyfill",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/GoogleChromeLabs/container-query-polyfill.git"
8+
},
69
"type": "module",
710
"module": "dist/container-query-polyfill.modern.js",
811
"unpkg": "dist/container-query-polyfill.modern.js",

0 commit comments

Comments
 (0)