-
Notifications
You must be signed in to change notification settings - Fork 319
70 lines (57 loc) · 1.65 KB
/
tests.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Tests
on:
pull_request:
push:
branches:
- main
- 'feature/**'
- 'support/**'
workflow_dispatch:
concurrency:
group: tests-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
run-tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
id: npm-cache
with:
key: npm-cache-${{ hashFiles('package-lock.json') }}
path: node_modules
- name: Cache tasks
uses: actions/cache@v3
with:
key: task-cache
path: |
.cache/eslint
.cache/jest
.cache/stylelint
- name: Setup Node.js
uses: actions/setup-node@v3
with:
cache: ${{ steps.npm-cache.outputs.cache-hit != 'true' && 'npm' || '' }}
node-version-file: .nvmrc
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: |
npm run build:compile
npm run build:package
npm run build:dist
- name: Run test projects
run: |
npx jest --color --selectProjects "Nunjucks macro tests"
npx jest --color --selectProjects "JavaScript unit tests"
npx jest --color --selectProjects "JavaScript behaviour tests"
- name: Send screenshots to Percy
run: npx percy exec -- jest --color --selectProjects "JavaScript component tests"
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}