-
Notifications
You must be signed in to change notification settings - Fork 221
134 lines (106 loc) · 3.31 KB
/
pull-request.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Pull Request
on: pull_request
jobs:
install:
runs-on: ubuntu-latest
outputs:
cypress-version: ${{ steps.cypress-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
node_version: 16.x
check:
runs-on: ubuntu-latest
needs: 'install'
steps:
- uses: actions/checkout@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
node_version: 16.x
# Keep steps separate for Github Actions annotation matching: https://github.com/actions/setup-node/blob/83c9f7a7df54d6b57455f7c57ac414f2ae5fb8de/src/setup-node.ts#L26-L33
- name: Lint
run: yarn lint
- name: Dependency Check
run: yarn depcheck
- name: Type Check
run: yarn typecheck
- name: Unit tests
run: yarn test
build:
runs-on: ubuntu-latest
needs: 'install'
steps:
- uses: actions/checkout@v3
- uses: Workday/canvas-kit-actions/install@v1
with:
node_version: 16.x
- name: Build Storybook
run: yarn build-storybook --quiet
- name: Cache Build
id: build-cache
uses: actions/cache@v3
with:
path: docs
key: ${{ runner.os }}-build-${{ github.sha }}
visual-test:
runs-on: ubuntu-latest
needs: 'build'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to retrieve git history
- uses: Workday/canvas-kit-actions/install@v1
with:
node_version: 16.x
- name: Restore Build
uses: actions/cache@v3
with:
path: docs
key: ${{ runner.os }}-build-${{ github.sha }}
- uses: chromaui/action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
appCode: dlpro96xybh
storybookBuildDir: docs
exitOnceUploaded: false
exitZeroOnChanges: true
integration-test:
runs-on: ubuntu-latest
needs: ['install', 'build']
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Required to retrieve git history
- uses: Workday/canvas-kit-actions/install@v1
with:
node_version: 16.x
- name: Restore Build
uses: actions/cache@v3
with:
path: docs
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Start Server
run: npx http-server docs -p 9001 & npx wait-on http://localhost:9001
- name: Integration tests
run: yarn cypress run --record --parallel
env:
# Github Actions doesn't support encryption on forks
# If these keys become compromised, we will rotate and disable these features
# on forked PRs until a suitable workaround is found
CYPRESS_RECORD_KEY: 3a9347b6-36ab-4a36-823d-709f4078b148
CYPRESS_CACHE_FOLDER: .cache/cypress
verify:
runs-on: ubuntu-latest
if: always()
needs: ['check', 'integration-test', 'visual-test']
steps:
- name: Failure Test
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') # Test the result of all dependencies
run: exit 1
- name: Success
run: exit 0