-
Notifications
You must be signed in to change notification settings - Fork 21
59 lines (51 loc) · 1.61 KB
/
wpt-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Tests
on:
pull_request_target:
branches:
- main
paths-ignore:
- "**/*.md"
workflow_dispatch:
jobs:
test:
name: WebPageTest Test Cases
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Install dependencies
run: npm install jest webpagetest
- name: Run WebPageTest with unit tests
run: npm test
env:
WPT_SERVER: "webpagetest.httparchive.org"
WPT_API_KEY: ${{ secrets.HA_API_KEY }}
- name: Run WebPageTest for more websites
run: node tests/wpt.js
env:
WPT_SERVER: "webpagetest.httparchive.org"
WPT_API_KEY: ${{ secrets.HA_API_KEY }}
PR_BODY: ${{ github.event.pull_request.body }}
- name: Upload artifact if needed
id: artifact-upload-step
uses: actions/upload-artifact@v4
with:
path: artifact.md
- name: Update comment.md
run: |
if grep -q "{artifact-url}" comment.md; then
artifact_url="${{ steps.artifact-upload-step.outputs.artifact-url }}"
sed -i "s|{artifact-url}|$artifact_url|g" comment.md
echo "Placeholder {artifact-url} replaced with a value: $artifact_url."
else
echo "No placeholder {artifact-url} found in comment.md."
fi
- name: Add comment to PR
uses: mshick/add-pr-comment@v2
if: always()
with:
refresh-message-position: true
message-path: comment.md