1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 05:58:26 -04:00

110 lines
3.5 KiB
YAML

name: CI
on:
push:
branches:
- master
pull_request:
jobs:
deploy:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install netlify-cli
run: npm install -g netlify-cli
- name: Wait for Netlify
run: netlify watch
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
lighthouse:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
needs: deploy
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install LHCI
run: npm install -g @lhci/cli
- 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/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/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 }}
- name: Upload results as artifact
uses: actions/upload-artifact@v1
with:
name: lhci-results
path: './.lighthouseci'
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
lfs: false
- 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-
- run: |
yarn install --no-ignore-optional --frozen-lockfile
yarn build:preview
- run: yarn lint
continue-on-error: true
- name: Include .percy.yml in artifact
run: cp .percy.yml public/
- uses: actions/upload-artifact@v1
with:
name: public
path: './public'
percy:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
needs: build
steps:
- uses: actions/download-artifact@v1
with:
name: public
- uses: percy/snapshot-action@v0.1.0
with:
flags: --config public/.percy.yml
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}