Skip to content

Merge pull request #384 from Princeton-CDH/leaflet-test #820

Merge pull request #384 from Princeton-CDH/leaflet-test

Merge pull request #384 from Princeton-CDH/leaflet-test #820

Workflow file for this run

name: lighthouse ci
on: [push]
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
jobs:
build-ci:
name: build site and run lighthouse ci
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: Get Hugo version
run: echo "HUGO_VERSION=$(cat .hugo_version)" >> $GITHUB_ENV
- name: setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Get node version from package.json
run: echo "NODE_VERSION=$(cat package.json | jq -r '.volta.node')" >> $GITHUB_ENV
- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: fetch js dependencies from cache
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-${{ hashFiles('package-lock.json') }}
npm-
- name: install js dependencies
run: npm ci
- name: build site
run: hugo --minify
# this step makes the site's built html and css available for download
# from github; see the run in github actions to access it as a zipfile.
# we don't export image derivatives because it makes the build a lot
# slower.
- name: export built files for download
uses: actions/upload-artifact@v3
with:
name: public
path: |
public/
!public/issues/**/images/
# lighthouse is configured using the lighthouserc.js file in the project
# root, see that file for more details. output from runs is uploaded to
# free google cloud storage and accessible via the github action run
- name: audit site using lighthouse ci
uses: treosh/lighthouse-ci-action@v10
with:
configPath: './lighthouserc.js'
uploadArtifacts: true
temporaryPublicStorage: true