Merge pull request #24 from BBaoVanC/lighthouse-actions

Add Lighthouse job to `audit` workflow
This commit is contained in:
2022-05-01 00:02:53 -05:00
committed by GitHub
3 changed files with 58 additions and 0 deletions

View File

@ -4,6 +4,45 @@ on:
push: push:
jobs: jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- name: Checkount
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install Caddy
run: |
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
sudo systemctl disable --now caddy
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Build
run: hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
- name: Compress
run: time ./compress.sh
- name: Audit using Lighthouse
uses: treosh/lighthouse-ci-action@v9
with:
uploadArtifacts: true
temporaryPublicStorage: true
configPath: ./lighthouserc.yaml
audit: audit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

9
Caddyfile Normal file
View File

@ -0,0 +1,9 @@
# vim: ft=caddyfile
https://localhost {
header Cache-Control no-cache
root * public/
file_server {
precompressed br gzip
}
}

10
lighthouserc.yaml Normal file
View File

@ -0,0 +1,10 @@
ci:
collect:
url:
- https://localhost/
- https://localhost/blog/
- https://localhost/blog/caddy-is-the-best-webserver/
- https://localhost/links/
startServerCommand: sudo caddy run
settings:
chromeFlags: "--ignore-certificate-errors --throttling.cpuSlowdownMultiplier=2.4"