Skip to content

Commit f62b58a

Browse files
panvaMylesBorins
authored andcommitted
tools: add a daily wpt.fyi synchronized report upload
PR-URL: #46498 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent e60d3f2 commit f62b58a

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

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

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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: '["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: 30 0 * * *
19+
20+
env:
21+
PYTHON_VERSION: '3.11'
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
report:
28+
if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch'
29+
strategy:
30+
matrix:
31+
node-version: ${{ fromJSON(github.event.inputs.node-versions || '["latest-nightly", "current", "lts/*", "lts/-1"]') }}
32+
fail-fast: false
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Set up Python ${{ env.PYTHON_VERSION }}
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: ${{ env.PYTHON_VERSION }}
39+
- name: Environment Information
40+
run: npx envinfo
41+
42+
# install a version and checkout
43+
- name: Get latest nightly
44+
if: matrix.node-version == 'latest-nightly'
45+
run: echo "NIGHTLY=$(curl -s https://nodejs.org/download/nightly/index.json | jq -r '.[0].version')" >> $GITHUB_ENV
46+
- name: Install Node.js
47+
id: setup-node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: ${{ env.NIGHTLY || matrix.node-version }}
51+
- name: Get nightly ref
52+
if: contains(matrix.node-version, 'nightly')
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
run: |
56+
SHORT_SHA=$(node -p 'process.version.split(/-nightly\d{8}/)[1]')
57+
echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA | jq -r '.sha')" >> $GITHUB_ENV
58+
- name: Checkout ${{ steps.setup-node.outputs.node-version }}
59+
uses: actions/checkout@v3
60+
with:
61+
persist-credentials: false
62+
ref: ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
63+
- name: Set env.NODE
64+
run: echo "NODE=$(which node)" >> $GITHUB_ENV
65+
66+
# replace checked out WPT with the synchronized branch
67+
- name: Remove stale WPT
68+
run: rm -rf wpt
69+
working-directory: test/fixtures
70+
- name: Checkout epochs/daily WPT
71+
uses: actions/checkout@v3
72+
with:
73+
repository: web-platform-tests/wpt
74+
persist-credentials: false
75+
path: test/fixtures/wpt
76+
clean: false
77+
ref: epochs/daily
78+
- name: Set env.WPT_REVISION
79+
run: echo "WPT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
80+
working-directory: test/fixtures/wpt
81+
82+
- name: Run WPT and generate report
83+
run: make test-wpt-report || true
84+
- name: Clone report for upload
85+
run: |
86+
if [ -e out/wpt/wptreport.json ]; then
87+
cd out/wpt
88+
cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version }}.json
89+
fi
90+
- name: Upload GitHub Actions artifact
91+
uses: actions/upload-artifact@v3
92+
with:
93+
path: out/wpt/wptreport-*.json
94+
name: WPT Reports
95+
if-no-files-found: warn
96+
- name: Upload WPT Report to wpt.fyi API
97+
env:
98+
WPT_FYI_ENDPOINT: ${{ vars.WPT_FYI_ENDPOINT }}
99+
WPT_FYI_USERNAME: ${{ vars.WPT_FYI_USERNAME }}
100+
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
101+
run: |
102+
if [ -e out/wpt/wptreport.json ]; then
103+
cd out/wpt
104+
gzip wptreport.json
105+
curl \
106+
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
107+
-F "result_file=@wptreport.json.gz" \
108+
-F "labels=master" \
109+
$WPT_FYI_ENDPOINT
110+
fi

0 commit comments

Comments
 (0)