-
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (131 loc) · 5.03 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Performs Lighthouse checks
name: Lighthouse
on:
# Runs on pushes targeting the default branch
pull_request:
branches: ["main"]
# Default to bash
defaults:
run:
shell: bash
jobs:
# Check on PR
lighthouse:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.108.0
permissions:
# Required to upload/save artifact, otherwise you'll get
# "Error: Resource not accessible by integration"
contents: write
# Required to post comment, otherwise you'll get
# "Error: Resource not accessible by integration"
pull-requests: write
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
working-directory: ./src
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--minify
- name: Run Hugo Server
working-directory: ./src
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
# Run server in background
run: hugo server &
# Wait till the server warms up
- run: sleep 15
- run: mkdir -p ${{ github.workspace }}/tmp/desktop
- run: mkdir -p ${{ github.workspace }}/tmp/mobile
- name: Lighthouse Desktop
uses: foo-software/lighthouse-check-action@v12.0.1
id: lighthouseDesktop
with:
device: 'desktop'
locale: 'en'
tag: "desktop"
prCommentEnabled: true
prCommentSaveOld: true
gitAuthor: ${{ github.actor }}
gitBranch: ${{ github.ref }}
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: ${{ github.workspace }}/tmp/desktop
# see https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md
# and https://github.com/GoogleChrome/lighthouse/blob/main/core/config/default-config.js
overridesJsonFile: ./lighthouse-overrides.json
sha: ${{ github.sha }}
urls: 'http://localhost:1313/'
- name: Lighthouse Mobile
uses: foo-software/lighthouse-check-action@v12.0.1
id: lighthouseMobile
with:
device: 'mobile'
locale: 'en'
tag: "mobile"
prCommentEnabled: true
prCommentSaveOld: true
gitAuthor: ${{ github.actor }}
gitBranch: ${{ github.ref }}
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }}
outputDirectory: ${{ github.workspace }}/tmp/mobile
# see https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md
# and https://github.com/GoogleChrome/lighthouse/blob/main/core/config/default-config.js
overridesJsonFile: ./lighthouse-overrides.json
sha: ${{ github.sha }}
urls: 'http://localhost:1313/'
- name: Upload mobile report
id: lighthouse-mobile-report
uses: actions/upload-artifact@master
with:
name: Lighthouse mobile report upload
path: ${{ github.workspace }}/tmp/mobile
- name: Upload desktop report
id: lighthouse-desktop-report
uses: actions/upload-artifact@master
with:
name: Lighthouse desktop report upload
path: ${{ github.workspace }}/tmp/desktop
- name: Publish the reports
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
## Lighthouse Reports
- [Mobile](${{ steps.lighthouse-mobile-report.outputs.artifact-url }})
- [Desktop](${{ steps.lighthouse-desktop-report.outputs.artifact-url }})
- name: Verify Lighthouse Desktop Results
uses: foo-software/lighthouse-check-status-action@v3.0.1
with:
lighthouseCheckResults: ${{ steps.lighthouseDesktop.outputs.lighthouseCheckResults }}
minAccessibilityScore: "80"
minBestPracticesScore: "80"
minPerformanceScore: "40"
minProgressiveWebAppScore: "0"
minSeoScore: "70"
- name: Verify Lighthouse Mobile Results
uses: foo-software/lighthouse-check-status-action@v3.0.1
with:
lighthouseCheckResults: ${{ steps.lighthouseMobile.outputs.lighthouseCheckResults }}
minAccessibilityScore: "80"
minBestPracticesScore: "80"
minPerformanceScore: "40"
minProgressiveWebAppScore: "0"
minSeoScore: "70"