Run Lighthouse against the docs #1098
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@v3 | |
# Install Node and configure its cache. | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
# 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@v3 | |
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.0.0 | |
# https://github.com/actions/cache/blob/master/examples.md#ruby---bundler | |
- name: Set up Bundler cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
name: lighthouse-results | |
path: .lighthouseci |