2023-02-04 09:53:05 +01:00
|
|
|
# This workflow runs every night and tests various releases of Node.js
|
|
|
|
# (latest nightly, current, and two latest LTS release lines) against the
|
|
|
|
# `epochs/daily` branch of WPT.
|
|
|
|
|
|
|
|
name: Daily WPT report
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
schedule:
|
|
|
|
# This is 20 minutes after `epochs/daily` branch is triggered to be created
|
|
|
|
# in WPT repo.
|
|
|
|
# https://github.com/web-platform-tests/wpt/blob/master/.github/workflows/epochs.yml
|
|
|
|
- cron: 30 0 * * *
|
|
|
|
|
|
|
|
env:
|
2024-04-03 08:24:57 +02:00
|
|
|
PYTHON_VERSION: '3.12'
|
2023-02-04 09:53:05 +01:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2024-11-02 21:24:19 +01:00
|
|
|
collect-versions:
|
2023-02-04 09:53:05 +01:00
|
|
|
if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch'
|
2024-11-02 21:24:19 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.query.outputs.matrix }}
|
|
|
|
steps:
|
|
|
|
- id: query
|
|
|
|
run: |
|
2024-11-02 21:42:06 +01:00
|
|
|
matrix=$(curl -s https://raw.githubusercontent.com/nodejs/Release/refs/heads/main/schedule.json | jq -c --arg now "$(date +%Y-%m-%d)" '[with_entries(select(.value.end > $now and .value.start < $now)) | keys[] | ltrimstr("v") | tonumber] + ["latest-nightly"]')
|
2024-11-02 21:24:19 +01:00
|
|
|
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
|
|
|
report:
|
|
|
|
needs:
|
|
|
|
- collect-versions
|
2023-02-04 09:53:05 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-11-02 21:24:19 +01:00
|
|
|
node-version: ${{ fromJSON(needs.collect-versions.outputs.matrix) }}
|
2023-02-04 09:53:05 +01:00
|
|
|
fail-fast: false
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
2024-11-03 20:07:53 +01:00
|
|
|
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
2023-02-04 09:53:05 +01:00
|
|
|
with:
|
|
|
|
python-version: ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Environment Information
|
|
|
|
run: npx envinfo
|
|
|
|
|
|
|
|
# install a version and checkout
|
|
|
|
- name: Get latest nightly
|
|
|
|
if: matrix.node-version == 'latest-nightly'
|
2023-03-01 14:51:58 +01:00
|
|
|
run: echo "NIGHTLY=$(curl -s https://nodejs.org/download/nightly/index.json | jq -r '[.[] | select(.files[] | contains("linux-x64"))][0].version')" >> $GITHUB_ENV
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Install Node.js
|
|
|
|
id: setup-node
|
2024-11-03 20:06:43 +01:00
|
|
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
2023-02-04 09:53:05 +01:00
|
|
|
with:
|
|
|
|
node-version: ${{ env.NIGHTLY || matrix.node-version }}
|
2023-03-11 08:22:39 +01:00
|
|
|
check-latest: true
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Get nightly ref
|
|
|
|
if: contains(matrix.node-version, 'nightly')
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
|
|
|
SHORT_SHA=$(node -p 'process.version.split(/-nightly\d{8}/)[1]')
|
2023-02-19 16:23:40 +01:00
|
|
|
echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA --jq '.sha')" >> $GITHUB_ENV
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Checkout ${{ steps.setup-node.outputs.node-version }}
|
2024-11-03 20:03:33 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-02-04 09:53:05 +01:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
ref: ${{ env.NIGHTLY_REF || steps.setup-node.outputs.node-version }}
|
|
|
|
- name: Set env.NODE
|
|
|
|
run: echo "NODE=$(which node)" >> $GITHUB_ENV
|
2023-02-22 08:45:27 +01:00
|
|
|
- name: Set env.WPT_REVISION
|
2023-02-19 16:23:40 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2023-02-22 08:45:27 +01:00
|
|
|
run: echo "WPT_REVISION=$(gh api /repos/web-platform-tests/wpt/branches/epochs/daily --jq '.commit.sha')" >> $GITHUB_ENV
|
2023-02-04 09:53:05 +01:00
|
|
|
|
|
|
|
# replace checked out WPT with the synchronized branch
|
|
|
|
- name: Remove stale WPT
|
|
|
|
run: rm -rf wpt
|
|
|
|
working-directory: test/fixtures
|
|
|
|
- name: Checkout epochs/daily WPT
|
2024-11-03 20:03:33 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-02-04 09:53:05 +01:00
|
|
|
with:
|
|
|
|
repository: web-platform-tests/wpt
|
|
|
|
persist-credentials: false
|
|
|
|
path: test/fixtures/wpt
|
|
|
|
clean: false
|
2023-02-22 08:45:27 +01:00
|
|
|
ref: ${{ env.WPT_REVISION }}
|
2023-02-04 09:53:05 +01:00
|
|
|
|
2023-02-25 20:22:08 +01:00
|
|
|
# Node.js WPT Runner
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Run WPT and generate report
|
|
|
|
run: |
|
2023-02-25 20:22:08 +01:00
|
|
|
make test-wpt-report || true
|
2023-02-04 09:53:05 +01:00
|
|
|
if [ -e out/wpt/wptreport.json ]; then
|
2023-02-25 20:22:08 +01:00
|
|
|
echo "WPT_REPORT=$(pwd)/out/wpt/wptreport.json" >> $GITHUB_ENV
|
2023-02-04 09:53:05 +01:00
|
|
|
fi
|
2023-02-25 20:22:08 +01:00
|
|
|
|
|
|
|
# undici WPT Runner
|
|
|
|
- name: Set env.UNDICI_VERSION
|
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
|
|
|
run: echo "UNDICI_VERSION=v$(jq -r '.version' < deps/undici/src/package.json)" >> $GITHUB_ENV
|
|
|
|
- name: Remove deps/undici
|
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
|
|
|
run: rm -rf deps/undici
|
|
|
|
- name: Checkout undici
|
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
2024-11-03 20:03:33 +01:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-02-25 20:22:08 +01:00
|
|
|
with:
|
|
|
|
repository: nodejs/undici
|
|
|
|
persist-credentials: false
|
|
|
|
path: deps/undici
|
|
|
|
clean: false
|
|
|
|
ref: ${{ env.UNDICI_VERSION }}
|
|
|
|
- name: Add undici WPTs to the report
|
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
|
|
|
run: |
|
|
|
|
rm -rf test/wpt/tests
|
|
|
|
mv ../../test/fixtures/wpt/ test/wpt/tests/
|
|
|
|
npm install
|
|
|
|
npm run test:wpt || true
|
|
|
|
working-directory: deps/undici
|
|
|
|
|
|
|
|
# Upload artifacts
|
|
|
|
- name: Clone report for upload
|
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
|
|
|
working-directory: out/wpt
|
|
|
|
run: cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version }}.json
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Upload GitHub Actions artifact
|
2023-02-25 20:22:08 +01:00
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
2024-11-03 20:04:57 +01:00
|
|
|
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
|
2023-02-04 09:53:05 +01:00
|
|
|
with:
|
|
|
|
path: out/wpt/wptreport-*.json
|
2023-12-21 12:00:10 +01:00
|
|
|
name: WPT Report for ${{ steps.setup-node.outputs.node-version }}
|
2023-02-25 20:22:08 +01:00
|
|
|
if-no-files-found: error
|
2023-02-04 09:53:05 +01:00
|
|
|
- name: Upload WPT Report to wpt.fyi API
|
2023-02-25 20:22:08 +01:00
|
|
|
if: ${{ env.WPT_REPORT != '' }}
|
2023-02-04 09:53:05 +01:00
|
|
|
env:
|
|
|
|
WPT_FYI_USERNAME: ${{ vars.WPT_FYI_USERNAME }}
|
|
|
|
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
|
2023-02-25 20:22:08 +01:00
|
|
|
working-directory: out/wpt
|
2023-02-04 09:53:05 +01:00
|
|
|
run: |
|
2023-02-25 20:22:08 +01:00
|
|
|
gzip wptreport.json
|
2023-02-25 20:23:10 +01:00
|
|
|
echo "## Node.js ${{ steps.setup-node.outputs.node-version }}" >> $GITHUB_STEP_SUMMARY
|
2023-03-22 16:02:53 +01:00
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
echo "WPT Revision: [\`${WPT_REVISION:0:7}\`](https://github.com/web-platform-tests/wpt/commits/$WPT_REVISION)" >> $GITHUB_STEP_SUMMARY
|
2023-02-25 20:22:08 +01:00
|
|
|
for WPT_FYI_ENDPOINT in "https://wpt.fyi/api/results/upload" "https://staging.wpt.fyi/api/results/upload"
|
|
|
|
do
|
2023-02-25 20:23:10 +01:00
|
|
|
response=$(curl -sS \
|
2023-02-25 20:22:08 +01:00
|
|
|
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
|
|
|
|
-F "result_file=@wptreport.json.gz" \
|
|
|
|
-F "labels=master" \
|
2023-02-25 20:23:10 +01:00
|
|
|
$WPT_FYI_ENDPOINT)
|
|
|
|
|
|
|
|
if [[ $response =~ Task\ ([0-9]+)\ added\ to\ queue ]]; then
|
|
|
|
run_id=${BASH_REMATCH[1]}
|
|
|
|
origin=${WPT_FYI_ENDPOINT%/api/results/upload}
|
|
|
|
|
|
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
2023-03-22 16:02:53 +01:00
|
|
|
echo "Run ID [\`$run_id\`]($origin/api/runs/$run_id) added to the processor queue at ${origin:8}" >> $GITHUB_STEP_SUMMARY
|
2023-02-25 20:23:10 +01:00
|
|
|
echo "- [View on the ${origin:8} dashboard]($origin/results?run_id=$run_id)" >> $GITHUB_STEP_SUMMARY
|
|
|
|
fi
|
2023-02-25 20:22:08 +01:00
|
|
|
done
|