1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-27 10:25:50 -04:00

percy visual tests via CI

This commit is contained in:
2020-03-29 09:37:06 -04:00
parent 1de471fdab
commit 5dff27dcb5

View File

@@ -1,6 +1,10 @@
name: CI name: CI
on: [push, pull_request] on:
push:
branches:
- master
pull_request:
jobs: jobs:
deploy: deploy:
@@ -9,7 +13,7 @@ jobs:
steps: steps:
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: '12.x'
- name: Install netlify-cli - name: Install netlify-cli
run: npm install -g netlify-cli run: npm install -g netlify-cli
- name: Wait for Netlify - name: Wait for Netlify
@@ -26,7 +30,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: 12.x node-version: '12.x'
- name: Install LHCI - name: Install LHCI
run: npm install -g @lhci/cli run: npm install -g @lhci/cli
- name: Audit deploy preview - name: Audit deploy preview
@@ -56,4 +60,49 @@ jobs:
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: lhci-results name: lhci-results
path: ./.lighthouseci 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
- run: yarn build:preview
- 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:
build-directory: public
flags: --snapshot-files "**/index.html,notes/**/amp.html"
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}