Skip to content

Commit 6fb17d1

Browse files
committed
tools: add a daily wpt.fyi synchronized report upload
1 parent a875a50 commit 6fb17d1

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
inputs:
10+
node-versions:
11+
description: 'Node.js versions (as supported by actions/setup-node) to test as JSON array'
12+
required: false
13+
default: '["nightly", "current", "lts/*", "lts/-1"]'
14+
schedule:
15+
# This is 20 minutes after `epochs/daily` branch is triggered to be created
16+
# in WPT repo.
17+
# https://github.com/web-platform-tests/wpt/blob/master/.github/workflows/epochs.yml
18+
- cron: '*/5 * * * *'
19+
20+
env:
21+
PYTHON_VERSION: '3.11'
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
report:
28+
strategy:
29+
matrix:
30+
node-version: ${{ fromJSON(github.event.inputs.node-versions || '["nightly", "current", "lts/*", "lts/-1"]') }}
31+
fail-fast: false
32+
runs-on: ubuntu-latest
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: contains(matrix.node-version, '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: contains(matrix.node-version, '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.node-version }}
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 }}.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+
- name: Upload WPT Report to wpt.fyi API
98+
env:
99+
WPT_FYI_USERNAME: ${{ secrets.WPT_FYI_USERNAME }}
100+
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
101+
working-directory: out/wpt
102+
run: |
103+
if [ -e wptreport.json ]; then
104+
gzip wptreport.json
105+
curl \
106+
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
107+
108+
https://wpt.fyi/api/results/upload
109+
fi

0 commit comments

Comments
 (0)