Skip to content

Commit 13eb029

Browse files
panvadanielleadams
authored andcommitted
tools: update daily wpt actions summary
PR-URL: #47138 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 4add368 commit 13eb029

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

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

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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 '[.[] | select(.files[] | contains("linux-x64"))][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+
check-latest: true
52+
- name: Get nightly ref
53+
if: contains(matrix.node-version, 'nightly')
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
SHORT_SHA=$(node -p 'process.version.split(/-nightly\d{8}/)[1]')
58+
echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA --jq '.sha')" >> $GITHUB_ENV
59+
- name: Checkout ${{ steps.setup-node.outputs.node-version }}
60+
uses: actions/checkout@v3
61+
with:
62+
persist-credentials: false
63+
ref: ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
64+
- name: Set env.NODE
65+
run: echo "NODE=$(which node)" >> $GITHUB_ENV
66+
- name: Set env.WPT_REVISION
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
run: echo "WPT_REVISION=$(gh api /repos/web-platform-tests/wpt/branches/epochs/daily --jq '.commit.sha')" >> $GITHUB_ENV
70+
71+
# replace checked out WPT with the synchronized branch
72+
- name: Remove stale WPT
73+
run: rm -rf wpt
74+
working-directory: test/fixtures
75+
- name: Checkout epochs/daily WPT
76+
uses: actions/checkout@v3
77+
with:
78+
repository: web-platform-tests/wpt
79+
persist-credentials: false
80+
path: test/fixtures/wpt
81+
clean: false
82+
ref: ${{ env.WPT_REVISION }}
83+
84+
# Node.js WPT Runner
85+
- name: Run WPT and generate report
86+
run: |
87+
make test-wpt-report || true
88+
if [ -e out/wpt/wptreport.json ]; then
89+
echo "WPT_REPORT=$(pwd)/out/wpt/wptreport.json" >> $GITHUB_ENV
90+
fi
91+
92+
# undici WPT Runner
93+
- name: Set env.UNDICI_VERSION
94+
if: ${{ env.WPT_REPORT != '' }}
95+
run: echo "UNDICI_VERSION=v$(jq -r '.version' < deps/undici/src/package.json)" >> $GITHUB_ENV
96+
- name: Remove deps/undici
97+
if: ${{ env.WPT_REPORT != '' }}
98+
run: rm -rf deps/undici
99+
- name: Checkout undici
100+
if: ${{ env.WPT_REPORT != '' }}
101+
uses: actions/checkout@v3
102+
with:
103+
repository: nodejs/undici
104+
persist-credentials: false
105+
path: deps/undici
106+
clean: false
107+
ref: ${{ env.UNDICI_VERSION }}
108+
- name: Add undici WPTs to the report
109+
if: ${{ env.WPT_REPORT != '' }}
110+
run: |
111+
rm -rf test/wpt/tests
112+
mv ../../test/fixtures/wpt/ test/wpt/tests/
113+
npm install
114+
npm run test:wpt || true
115+
working-directory: deps/undici
116+
117+
# Upload artifacts
118+
- name: Clone report for upload
119+
if: ${{ env.WPT_REPORT != '' }}
120+
working-directory: out/wpt
121+
run: cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version }}.json
122+
- name: Upload GitHub Actions artifact
123+
if: ${{ env.WPT_REPORT != '' }}
124+
uses: actions/upload-artifact@v3
125+
with:
126+
path: out/wpt/wptreport-*.json
127+
name: WPT Reports
128+
if-no-files-found: error
129+
- name: Upload WPT Report to wpt.fyi API
130+
if: ${{ env.WPT_REPORT != '' }}
131+
env:
132+
WPT_FYI_USERNAME: ${{ vars.WPT_FYI_USERNAME }}
133+
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
134+
working-directory: out/wpt
135+
run: |
136+
gzip wptreport.json
137+
echo "## Node.js ${{ steps.setup-node.outputs.node-version }}" >> $GITHUB_STEP_SUMMARY
138+
echo "" >> $GITHUB_STEP_SUMMARY
139+
echo "WPT Revision: [\`${WPT_REVISION:0:7}\`](https://github.com/web-platform-tests/wpt/commits/$WPT_REVISION)" >> $GITHUB_STEP_SUMMARY
140+
for WPT_FYI_ENDPOINT in "https://wpt.fyi/api/results/upload" "https://staging.wpt.fyi/api/results/upload"
141+
do
142+
response=$(curl -sS \
143+
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
144+
-F "result_file=@wptreport.json.gz" \
145+
-F "labels=master" \
146+
$WPT_FYI_ENDPOINT)
147+
148+
if [[ $response =~ Task\ ([0-9]+)\ added\ to\ queue ]]; then
149+
run_id=${BASH_REMATCH[1]}
150+
origin=${WPT_FYI_ENDPOINT%/api/results/upload}
151+
152+
echo "" >> $GITHUB_STEP_SUMMARY
153+
echo "Run ID [\`$run_id\`]($origin/api/runs/$run_id) added to the processor queue at ${origin:8}" >> $GITHUB_STEP_SUMMARY
154+
echo "- [View on the ${origin:8} dashboard]($origin/results?run_id=$run_id)" >> $GITHUB_STEP_SUMMARY
155+
fi
156+
done

0 commit comments

Comments
 (0)