Run Lighthouse against the docs #1476
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
name: Run Lighthouse against the docs | |
on: | |
# Run every night at midnight UTC. | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
lighthouseci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Install Node and configure its cache. | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
# https://github.com/actions/cache/blob/master/examples.md#node---yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v4 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
# Install Ruby and configure the Bundler cache. | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2.3 | |
# https://github.com/actions/cache/blob/master/examples.md#ruby---bundler | |
- name: Set up Bundler cache | |
uses: actions/cache@v4 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
# Build the documentation site. | |
# This is needed so we can determine the list of URLs to test. | |
- name: Build documentation site | |
run: yarn build-netlify | |
# Run Lighthouse CI | |
- name: Run Lighthouse CI | |
run: yarn lhci autorun | |
env: | |
LHCI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Attach results as artifact to GitHub Actions run | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lighthouse-results | |
path: .lighthouseci |