Skip to content

Commit 5f5df16

Browse files
committed
add wpt github actions workflow
1 parent dc02407 commit 5f5df16

2 files changed

Lines changed: 77 additions & 6 deletions

File tree

.github/workflows/wpt.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: WPT diagnostics
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
wpt:
12+
name: WPT diagnostics (non-blocking)
13+
runs-on: ubuntu-latest
14+
continue-on-error: true
15+
timeout-minutes: 30
16+
env:
17+
CARGO_TERM_COLOR: always
18+
WPT_CHECKOUT: ${{ runner.temp }}/lightningcss-wpt
19+
# This workflow runs the parser/transform matrix without a browser.
20+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: yarn
27+
- uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.x'
30+
- uses: dtolnay/rust-toolchain@stable
31+
- uses: Swatinem/rust-cache@v2
32+
- name: Install dependencies
33+
run: yarn install --frozen-lockfile
34+
35+
- name: Clone pinned WPT revision
36+
run: |
37+
wpt_repository=$(node -p 'require("./wpt/revision.json").repository')
38+
wpt_revision=$(node -p 'require("./wpt/revision.json").commit')
39+
git clone --depth 1 --filter=blob:none --sparse "$wpt_repository" "$WPT_CHECKOUT"
40+
git -C "$WPT_CHECKOUT" fetch --depth 1 origin "$wpt_revision"
41+
git -C "$WPT_CHECKOUT" checkout --detach "$wpt_revision"
42+
git -C "$WPT_CHECKOUT" sparse-checkout set css
43+
44+
- name: Extract full corpus
45+
run: node wpt/extract.mjs "$WPT_CHECKOUT" --discovery --output wpt/fixtures.json
46+
47+
- name: Run WPT tests
48+
run: yarn test:wpt
49+
50+
# The harness deliberately exits nonzero for existing findings. Retain
51+
# that outcome, but still produce artifacts from any results it wrote.
52+
- name: Generate HTML report
53+
if: ${{ always() && hashFiles('wpt/results.json') != '' }}
54+
run: yarn report:wpt
55+
56+
- name: Upload WPT report
57+
if: ${{ always() }}
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: wpt-report
61+
path: |
62+
wpt/results.html
63+
wpt/results.json
64+
if-no-files-found: warn
65+
retention-days: 14

wpt/README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Opt-in WPT harness
1+
# WPT diagnostic harness
22

3-
This harness adapts a subset of the Web Platform Tests to Lightning CSS. It is a diagnostic tool, not a claim of browser conformance. It is deliberately **not connected to CI** and has no accepted-failure baseline yet.
3+
This harness adapts a subset of the Web Platform Tests to Lightning CSS. It is a diagnostic tool, not a claim of browser conformance. It runs locally on demand and in a **non-blocking GitHub Actions workflow**. There is no accepted-failure baseline yet.
44

5-
The initial milestone implements property-value extraction, parser recognition, and browser checks for context-free parsing/shorthand helpers. It uses the pinned revision in `revision.json`; `fixtures.json` contains the full current extraction: 24,344 cases from 902 pages, plus records for 150 unsupported and 9 empty pages. `selection.json` retains the optional eight-file starter selection. Derived fixtures retain their upstream paths and source hashes; see `LICENSE-WPT.md`.
5+
The initial milestone implements property-value extraction, parser recognition, and browser checks for context-free parsing/shorthand helpers. It uses the pinned revision in `revision.json`; `fixtures.json` is generated locally or in CI and is not committed. The full current extraction contains 24,344 cases from 902 pages, plus records for 150 unsupported and 9 empty pages. `selection.json` retains the optional eight-file starter selection. Derived fixtures retain their upstream paths and source hashes; see `LICENSE-WPT.md`.
66

77
## Run
88

99
Use the repository's normal Rust/Node development setup. Node 18+ is needed for the harness tests. Python 3 is needed only to regenerate fixtures. Existing Puppeteer is used for browser checks; no new dependencies are installed.
1010

1111
```sh
12-
# Parser/serializer/optimizer diagnostics, no WPT checkout or browser required.
12+
# After generating fixtures (see below): parser/serializer/optimizer diagnostics.
1313
yarn test:wpt
1414

1515
# Include browser checks. Set this to a Chrome executable available on your OS.
@@ -37,6 +37,12 @@ Browser baseline failures, coverage gaps, contextual matches, and cases needing
3737

3838
The four modes are `print`, `minify`, `lower`, and `lower-minify`. `print` only parses/prints. The other modes run declaration optimization; the `lower` modes additionally target Chrome 80. `lower` prints readable output and `lower-minify` prints compact output. This target is an initial stress configuration, not a browser support claim. The browser oracle runs original and emitted CSS in the same current browser, and records that browser's version/executable. `--modes print,minify` selects a smaller matrix.
3939

40+
## GitHub Actions
41+
42+
`.github/workflows/wpt.yml` runs on pull requests to `master`, pushes to `master`, and manual dispatch. It clones the revision from `wpt/revision.json` into the runner's temporary directory, extracts the full corpus with `--discovery`, and runs all four parser/transform modes. Browser checks are not enabled in this workflow.
43+
44+
The job uses `continue-on-error` so findings do not fail the overall workflow. Report generation and artifact upload run after test failures whenever results are available. Download the **wpt-report** artifact from the Actions run to get `results.html` and the underlying `results.json`; artifacts are retained for 14 days. Setup failures that produce no results remain visible in the job logs.
45+
4046
## Readable HTML reports
4147

4248
```sh
@@ -55,7 +61,7 @@ The HTML summarizes the supplied results file; it does not rerun tests or change
5561

5662
## Refresh or expand the corpus
5763

58-
A checkout is only necessary for extraction. The research checkout may still be available at `/private/tmp/lightningcss-wpt-research`. For a new checkout:
64+
Generate `fixtures.json` before the first local run. A checkout is only necessary for extraction. The research checkout may still be available at `/private/tmp/lightningcss-wpt-research`. For a new checkout:
5965

6066
```sh
6167
git clone --depth 1 --filter=blob:none --sparse https://github.com/web-platform-tests/wpt.git /tmp/lightningcss-wpt
@@ -118,4 +124,4 @@ The broader parser-only run caught nine panics, including infinite hue values an
118124
3. **Next:** selector/rule/media/recovery adapters and contextual computed-value tests under WPT's server.
119125
4. **Later:** selected reftests with untransformed references, then a separately reviewed CI baseline and scheduled discovery.
120126

121-
Keep the opt-in behavior until findings and assertion policy have been reviewed. The design rationale and broader scope are in `../WPT-HARNESS-RESEARCH.md`.
127+
Keep CI non-blocking until findings and assertion policy have been reviewed. The design rationale and broader scope are in `../WPT-HARNESS-RESEARCH.md`.

0 commit comments

Comments
 (0)