-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (53 loc) · 2.04 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
on: [push]
name: CI
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
cache: npm
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install dependencies
run: npm ci
# run eslint
- name: Lint
run: npm run lint
# start server so we can run lighthouse against it
- name: Start server in bg
run: |
npm run dev &
# give enough time for the server to start and be ready to accept
# connections... can get fancier but this should do
sleep 3
- name: Run Lighthouse Audit and assert 100% accessibility
# https://github.com/treosh/lighthouse-ci-action
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
http://localhost:3000/
uploadArtifacts: true
temporaryPublicStorage: true
configPath: ".github/lighthouse/lighthouserc.yml"
- name: Run axe
run: |
# I have to keep setting the chromedriver version to whatever version
# is present on the CI box, eventually I should figure out how to pin
# the version of chrome that I'm using, or to pull it dynamically and
# insert it here
npm install -g @axe-core/cli@4.6.0 chromedriver@111
# https://github.com/dequelabs/axe-core-npm/issues/679#issuecomment-1456590620
axe --chromedriver-path $(npm root -g)/chromedriver/bin/chromedriver http://localhost:3000 --exit