-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (103 loc) · 3.68 KB
/
lighthouse.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Lighthouse Compare Action
on:
pull_request:
branches-ignore:
- "dependabot/**"
jobs:
getPreviewUrl:
runs-on: ubuntu-latest
outputs:
preview_url: ${{ steps.add_prefix.outputs.full_url }}
steps:
- uses: actions/checkout@v4
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#masking-a-value-in-a-log
# https://kinsta.com/blog/github-actions-secret/
- name: Add Mask on vercel token
run: echo "::add-mask::${{ secrets.VERCEL_TOKEN }}"
- name: Get Vercel Preview URL
id: vercel_preview_url
uses: zentered/[email protected]
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
with:
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
- name: Await for Vercel deployment
uses: UnlyEd/[email protected]
id: await-vercel
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
with:
deployment-url: ${{ steps.vercel_preview_url.outputs.preview_url }}
timeout: 300
poll-interval: 5
- name: Combine Prefix "https://"
id: add_prefix
run: echo "full_url=https://${{ steps.vercel_preview_url.outputs.preview_url }}" >> $GITHUB_OUTPUT
- name: Print URL
run: echo "${{ steps.add_prefix.outputs.full_url }}"
constructUrls:
needs: getPreviewUrl
runs-on: ubuntu-latest
env:
# Subpaths to investigate
SUBPATHS: "/games,/games/series,/games/dlcs,/planning,/backlog,/tests,/stats,/links"
outputs:
url_list: ${{ steps.construct_url_list.outputs.url_list }}
steps:
- uses: actions/checkout@v4
- name: Construct URLs
id: construct_url_list
run: |
URL_LIST=$(echo "${{ env.SUBPATHS }}" | tr ',' '\n' | sed "s|^|${{ needs.getPreviewUrl.outputs.preview_url }}|g" | tr '\n' ',' | sed 's|,$||')
echo "url_list=$URL_LIST" >> $GITHUB_OUTPUT
- name: Debug URLs
run: |
echo "Constructed URLs: ${{ steps.construct_url_list.outputs.url_list }}"
lighthouse_mobile:
needs: constructUrls
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts
- uses: foo-software/lighthouse-check-action@master
with:
urls: ${{ needs.constructUrls.outputs.url_list }}
device: mobile
prCommentEnabled: true
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: ${{ github.workspace }}/tmp/artifacts
- name: Upload artifacts
uses: actions/[email protected]
with:
name: Lighthouse mobile reports
path: ${{ github.workspace }}/tmp/artifacts
retention-days: 1
lighthouse_desktop:
needs: constructUrls
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
- run: mkdir -p ${{ github.workspace }}/tmp/artifacts
- uses: foo-software/lighthouse-check-action@master
with:
urls: ${{ needs.constructUrls.outputs.url_list }}
device: desktop
prCommentEnabled: true
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: ${{ github.workspace }}/tmp/artifacts
- name: Upload artifacts
uses: actions/[email protected]
with:
name: Lighthouse desktop reports
path: ${{ github.workspace }}/tmp/artifacts
retention-days: 1