Skip to content

Commit

Permalink
tools: add a daily wpt.fyi synchronized report upload
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Feb 7, 2023
1 parent a875a50 commit 6fb17d1
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/daily-wpt-fyi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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:
inputs:
node-versions:
description: 'Node.js versions (as supported by actions/setup-node) to test as JSON array'
required: false
default: '["nightly", "current", "lts/*", "lts/-1"]'
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: '*/5 * * * *'

env:
PYTHON_VERSION: '3.11'

permissions:
contents: read

jobs:
report:
strategy:
matrix:
node-version: ${{ fromJSON(github.event.inputs.node-versions || '["nightly", "current", "lts/*", "lts/-1"]') }}
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
run: npx envinfo

# install a version and checkout
- name: Get latest nightly
if: contains(matrix.node-version, 'nightly')
run: echo "NIGHTLY=$(curl -s https://nodejs.org/download/nightly/index.json | jq -r '.[0].version')" >> $GITHUB_ENV
- name: Get nightly ref
if: contains(matrix.node-version, 'nightly')
env:
GH_TOKEN: ${{ github.token }}
run: |
SHORT_SHA=$(node -p 'process.env.NIGHTLY.split(/-nightly\d{8}/)[1]')
echo "NIGHTLY_REF=$(gh api /repos/nodejs/node/commits/$SHORT_SHA | jq -r '.sha')" >> $GITHUB_ENV
- name: Install Node.js
id: setup-node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NIGHTLY || matrix.node-version }}
- name: Checkout ${{ steps.setup-node.outputs.node-version }}
uses: actions/checkout@v3
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

# 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
uses: actions/checkout@v3
with:
repository: web-platform-tests/wpt
persist-credentials: false
path: test/fixtures/wpt
clean: false
ref: epochs/daily
- name: Set env.WPT_REVISION
run: echo "WPT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
working-directory: test/fixtures/wpt

- name: Run WPT and generate report
run: |
mkdir -p out/wpt
make test-wpt-report || true
- name: Clone report for upload
run: |
if [ -e wptreport.json ]; then
cp wptreport.json wptreport-${{ steps.setup-node.outputs.node-version }}.json
fi
working-directory: out/wpt
- name: Upload GitHub Actions artifact
uses: actions/upload-artifact@v3
with:
path: out/wpt/wptreport-*.json
name: WPT Reports
if-no-files-found: warn
- name: Upload WPT Report to wpt.fyi API
env:
WPT_FYI_USERNAME: ${{ secrets.WPT_FYI_USERNAME }}
WPT_FYI_PASSWORD: ${{ secrets.WPT_FYI_PASSWORD }}
working-directory: out/wpt
run: |
if [ -e wptreport.json ]; then
gzip wptreport.json
curl \
-u "$WPT_FYI_USERNAME:$WPT_FYI_PASSWORD" \
-F "[email protected]" \
https://wpt.fyi/api/results/upload
fi

0 comments on commit 6fb17d1

Please sign in to comment.