mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 12:36:20 -04:00
trigger lighthouse audits on Netlify deploy previews
This commit is contained in:
parent
5e5678a699
commit
c33d8f9f18
42
.github/workflows/ci.yml
vendored
Normal file
42
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lighthouse:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Install utilities
|
||||||
|
run: npm install -g netlify-cli @lhci/cli
|
||||||
|
- name: Wait for Netlify
|
||||||
|
run: netlify watch
|
||||||
|
env:
|
||||||
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||||
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||||
|
- name: Audit deploy preview
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
lhci autorun --config=./lighthouserc.json \
|
||||||
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/ \
|
||||||
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/ \
|
||||||
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/how-to-pull-request-fork-github/ \
|
||||||
|
--collect.url=https://deploy-preview-${{ github.event.number }}--jakejarvis.netlify.com/notes/how-to-pull-request-fork-github/amp.html
|
||||||
|
env:
|
||||||
|
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
||||||
|
- name: Audit jarv.is
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
lhci autorun --config=./lighthouserc.json \
|
||||||
|
--collect.url=https://jarv.is/ \
|
||||||
|
--collect.url=https://jarv.is/notes/ \
|
||||||
|
--collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/ \
|
||||||
|
--collect.url=https://jarv.is/notes/how-to-pull-request-fork-github/amp.html
|
||||||
|
env:
|
||||||
|
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
37
.github/workflows/lighthouse.yml
vendored
37
.github/workflows/lighthouse.yml
vendored
@ -1,37 +0,0 @@
|
|||||||
name: Lighthouse
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lhci:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 12.x
|
|
||||||
# https://github.com/actions/cache/blob/master/examples.md#node---yarn
|
|
||||||
# https://github.com/actions/cache/issues/60
|
|
||||||
- name: Get yarn cache location
|
|
||||||
id: yarn-cache
|
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
||||||
- name: Cache dependencies
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
|
||||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-yarn-
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
yarn install --no-ignore-optional --frozen-lockfile
|
|
||||||
# - uses: jakepartusch/wait-for-netlify-action@v1
|
|
||||||
# id: wait
|
|
||||||
# with:
|
|
||||||
# site_name: "jakejarvis"
|
|
||||||
- name: Run Lighthouse CI
|
|
||||||
run: |
|
|
||||||
npm install -g @lhci/cli@0.3.x
|
|
||||||
lhci autorun --config=./lighthouserc.json
|
|
||||||
env:
|
|
||||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
@ -1,20 +1,13 @@
|
|||||||
{
|
{
|
||||||
"ci": {
|
"ci": {
|
||||||
"collect": {
|
"collect": {
|
||||||
"url": [
|
"numberOfRuns": 1
|
||||||
"http://localhost:1337/",
|
|
||||||
"http://localhost:1337/notes/",
|
|
||||||
"http://localhost:1337/notes/how-to-pull-request-fork-github/",
|
|
||||||
"http://localhost:1337/notes/how-to-pull-request-fork-github/amp.html"
|
|
||||||
],
|
|
||||||
"numberOfRuns": 1,
|
|
||||||
"startServerCommand": "yarn start --disableLiveReload",
|
|
||||||
"startServerReadyPattern": "Web Server is available at"
|
|
||||||
},
|
},
|
||||||
"assert": {
|
"assert": {
|
||||||
"preset": "lighthouse:no-pwa",
|
"preset": "lighthouse:no-pwa",
|
||||||
"assertions": {
|
"assertions": {
|
||||||
"color-contrast": ["warn", {"minScore": 0.9}],
|
"color-contrast": ["warn", {"minScore": 0.9}],
|
||||||
|
"errors-in-console": "warn",
|
||||||
"link-text": "warn",
|
"link-text": "warn",
|
||||||
"tap-targets": ["warn", {"minScore": 0.6}],
|
"tap-targets": ["warn", {"minScore": 0.6}],
|
||||||
"total-byte-weight": ["warn", {"minScore": 0.9}],
|
"total-byte-weight": ["warn", {"minScore": 0.9}],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user