Skip to content

Commit

Permalink
Run tests and compare results on PRs. (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
flackr authored Dec 13, 2023
1 parent e7799de commit 5a2639a
Show file tree
Hide file tree
Showing 4 changed files with 992 additions and 4 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: Deploy site to Pages
name: Build and test

on:
# Runs on pushes targeting the default branch
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand Down Expand Up @@ -46,8 +51,9 @@ jobs:
- name: WPT hosts
run: "./test/wpt/wpt make-hosts-file | sudo tee -a /etc/hosts"
- name: WPT tests
continue-on-error: true
run: "npm run test:wpt"
- name: Expected results
run: "npm run test:compare"
- name: Clean build files
run: "rm -rf node_modules test/wpt"
- name: Upload artifact
Expand All @@ -62,6 +68,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"dev": "run-all \"serve\" \" microbundle watch -f iife \"",
"deploy": "npm run build",
"test-setup": "node test/setup/checkout-wpt.mjs",
"test:wpt": "npm run test-setup && cd test && cd wpt && python wpt run --headless -y --log-wptreport ../report/data.json --log-wptscreenshot=../report/screenshots.txt --log-html=../report/index.html --inject-script ../../dist/scroll-timeline.js firefox scroll-animations",
"test:simple": "npm run test-setup && cd test && cd wpt && python wpt serve --inject-script ../../dist/scroll-timeline.js"
"test:wpt": "npm run test-setup && cd test && cd wpt && (python wpt run --headless -y --log-wptreport ../report/data.json --log-wptscreenshot=../report/screenshots.txt --log-html=../report/index.html --inject-script ../../dist/scroll-timeline.js firefox scroll-animations || true)",
"test:simple": "npm run test-setup && cd test && cd wpt && python wpt serve --inject-script ../../dist/scroll-timeline.js",
"test:compare": "node test/summarize-json.mjs test/report/data.json > test/report/summary.txt && echo 'Comparing test results. If different and expected, patch the following diff to test/expected.txt:' && diff test/expected.txt test/report/summary.txt"
},
"repository": {
"type": "git",
Expand Down
Loading

0 comments on commit 5a2639a

Please sign in to comment.