Skip to content

Commit 1be365b

Browse files
committed
tools: add a daily wpt.fyi synchronized report upload
1 parent 50cec47 commit 1be365b

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

.github/workflows/daily-wpt-fyi.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# This workflow runs every night and tests various releases of Node.js
2+
# (latest nightly, current, and two latest LTS release lines) against the
3+
# `epochs/daily` branch of WPT.
4+
5+
name: Daily WPT report
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
# This is 20 minutes after `epochs/daily` branch is triggered to be created
11+
# in WPT repo.
12+
# https://github.com/web-platform-tests/wpt/blob/master/.github/workflows/epochs.yml
13+
- cron: 30 0 * * *
14+
15+
env:
16+
PYTHON_VERSION: '3.11'
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
generate:
23+
strategy:
24+
matrix:
25+
ref:
26+
- nightly
27+
- current
28+
- lts/*
29+
- lts/-1
30+
fail-fast: false
31+
runs-on: ubuntu-latest
32+
continue-on-error: true
33+
steps:
34+
- name: Set up Python ${{ env.PYTHON_VERSION }}
35+
uses: actions/setup-python@v4
36+
with:
37+
python-version: ${{ env.PYTHON_VERSION }}
38+
- name: Environment Information
39+
run: npx envinfo
40+
41+
# install a version and checkout
42+
- name: Get latest nightly
43+
if: matrix.ref == 'nightly'
44+
run: echo "NIGHTLY=$(curl -s https://nodejs.org/download/nightly/index.json | jq -r '.[0].version')" >> $GITHUB_ENV
45+
- name: Get nightly ref
46+
if: matrix.ref == 'nightly'
47+
env:
48+
GH_TOKEN: ${{ github.token }}
49+
run: |
50+
SHORT_SHA=$(node -p 'process.env.NIGHTLY.split(/-nightly\d{8}/)[1]')
51+
echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA | jq -r '.sha')" >> $GITHUB_ENV
52+
- name: Install Node.js
53+
id: setup-node
54+
uses: actions/setup-node@v3
55+
with:
56+
node-version: ${{ env.NIGHTLY || matrix.ref }}
57+
- name: Checkout ${{ steps.setup-node.outputs.node-version }}
58+
uses: actions/checkout@v3
59+
with:
60+
persist-credentials: false
61+
ref: ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
62+
- name: Set env.NODE
63+
run: echo "NODE=$(which node)" >> $GITHUB_ENV
64+
65+
# replace checked out WPT with the synchronized branch
66+
- name: Remove stale WPT
67+
run: rm -rf wpt
68+
working-directory: test/fixtures
69+
- name: Checkout epochs/daily WPT
70+
uses: actions/checkout@v3
71+
with:
72+
repository: web-platform-tests/wpt
73+
persist-credentials: false
74+
path: test/fixtures/wpt
75+
clean: false
76+
ref: epochs/daily
77+
- name: Set env.WPT_REVISION
78+
run: echo "WPT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
79+
working-directory: test/fixtures/wpt
80+
81+
- name: Run WPT and generate report
82+
run: |
83+
mkdir -p out/wpt
84+
make test-wpt-report || true
85+
- name: Clone report for upload
86+
run: |
87+
if [ -e wptreport.json ]; then
88+
cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version || github.sha }}.json
89+
fi
90+
working-directory: out/wpt
91+
- name: Upload GitHub Actions artifact
92+
uses: actions/upload-artifact@v3
93+
with:
94+
path: out/wpt/wptreport-*.json
95+
name: WPT Reports
96+
if-no-files-found: warn
97+
98+
# prev. step fails if no file was generated
99+
- name: Upload WPT Report to wpt.fyi API
100+
env:
101+
WPT_FYI_USERNAME: ${{ secrets.WPT_FYI_USERNAME }}
102+
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
103+
working-directory: out/wpt
104+
run: |
105+
if [ -e wptreport.json ]; then
106+
gzip wptreport.json
107+
curl \
108+
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
109+
110+
https://wpt.fyi/api/results/upload
111+
fi

0 commit comments

Comments
 (0)