-
Notifications
You must be signed in to change notification settings - Fork 221
189 lines (154 loc) · 5.07 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Pull Request
on: pull_request
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Get Cypress Version
id: cypress-version
run: echo "::set-output name=version::$(node utils/get-cypress-version.js)"
- name: Cache Cypress
id: cypress-cache
uses: actions/cache/@v2
with:
path: .cache/cypress
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }}
- name: Cache node modules
id: yarn-cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }}
- name: Install Packages
if:
steps.yarn-cache.outputs.cache-hit != 'true' || steps.cypress-cache.outputs.cache-hit !=
'true'
run: yarn install --production=false
env:
CYPRESS_CACHE_FOLDER: .cache/cypress
check:
runs-on: ubuntu-latest
needs: 'install'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/cache/@v2
with:
path: .cache/cypress
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }}
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }}
# 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@v2
- uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/cache/@v2
with:
path: .cache/cypress
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }}
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }}
- name: Build Storybook
run: yarn build-storybook --quiet
- name: Cache Build
id: build-cache
uses: actions/cache/@v2
with:
path: docs
key: ${{ runner.os }}-build-${{ github.sha }}
visual-test:
runs-on: ubuntu-latest
needs: 'build'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Required to retrieve git history
- uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/cache/@v2
with:
path: .cache/cypress
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }}
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }}
- name: Restore Build
uses: actions/cache/@v2
with:
path: docs
key: ${{ runner.os }}-build-${{ github.sha }}
- uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
appCode: dlpro96xybh
storybookBuildDir: docs
exitOnceUploaded: true
exitZeroOnChanges: true
integration-test:
runs-on: ubuntu-latest
needs: '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: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/cache/@v2
with:
path: .cache/cypress
key: ${{ runner.os }}-cypress-cache-version-${{ steps.cypress-version.outputs.version }}
- uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-hash-${{ hashFiles('yarn.lock') }}
- name: Restore Build
uses: actions/cache/@v2
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
needs: ['check', 'integration-test']
steps:
- name: Done
run: echo "Done"