[add] improve tests #61
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample workflow for building and deploying a Hugo site to GitHub Pages | |
name: Lighthouse Check | |
on: | |
# Runs on pushes targeting the default branch | |
pull_request: | |
branches: ["main"] | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
# Check on PR | |
lighthouse-check: | |
runs-on: ubuntu-latest | |
env: | |
HUGO_VERSION: 0.108.0 | |
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/artifacts | |
- name: Lighthouse | |
uses: foo-software/lighthouse-check-action@v12.0.1 | |
id: lighthouseCheck | |
with: | |
device: 'all' | |
locale: 'en' | |
prCommentEnabled: true | |
prCommentSaveOld: true | |
gitAuthor: ${{ github.actor }} | |
gitBranch: ${{ github.ref }} | |
gitHubAccessToken: ${{ secrets.GITHUB_TOKEN }} | |
outputDirectory: ${{ github.workspace }}/tmp/artifacts | |
# 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 artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: Lighthouse reports | |
path: ${{ github.workspace }}/tmp/artifacts | |
- name: Verify Lighthouse Check results | |
uses: foo-software/lighthouse-check-status-action@v3.0.1 | |
with: | |
lighthouseCheckResults: ${{ steps.lighthouseCheck.outputs.lighthouseCheckResults }} | |
minAccessibilityScore: "80" | |
minBestPracticesScore: "80" | |
minPerformanceScore: "40" | |
minProgressiveWebAppScore: "0" | |
minSeoScore: "70" |