This repository has been archived by the owner on Mar 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
266 lines (225 loc) · 7.75 KB
/
build_test.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: Build and Test
on:
- pull_request
jobs:
install_full_workspace:
runs-on: ubuntu-latest
env:
UNSKIP_DECR: 'false' # do not decrypt the .env files
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Restore Node_Modules # this step improves the yarn installation of node_modules by a significant amount
id: restore-node-modules
uses: actions/cache@v2
with:
key: ${{runner.os}}-node-modules-${{hashFiles('**/package.json')}}
path: |
cms/node_modules
site/node_modules
search/cloudflare/node_modules
webhooks/strapi/node_modules
restore-keys: |
${{ runner.os }}-node-modules-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
if: steps.restore-node-modules.outputs.cache-hit != 'true'
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore Yarn Cache
id: root-yarn-cache
if: steps.restore-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-v2.3
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Root (Lerna) Dependencies
run: yarn install --ignore-scripts
env:
NODE_ENV: development # otherwise dev dependencies are skipped
- name: Install Packages Dependencies
run: yarn bootstrap --ignore puppeteer
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true' # recheck working
NODE_ENV: development
#
- name: Bootstrap CMS Database
run: yarn bootstrap
working-directory: cms
- name: Cache cms Folder
uses: actions/cache@v2
id: cms-dir-cache
with:
path: cms
key: cms-${{github.sha}}
- name: Cache site Folder
uses: actions/cache@v2
id: site-dir-cache
with:
path: site
key: site-${{github.sha}}
- name: Cache webhooks/strapi
uses: actions/cache@v2
id: strapi-dir-cache
with:
path: webhooks/strapi
key: webhooks-strapi-${{github.sha}}
- name: Cache search/cloudflare
uses: actions/cache@v2
id: search-cloudflare-dir-cache
with:
path: search/cloudflare
key: search-cloudflare-${{github.sha}}
build_cms:
runs-on: ubuntu-latest
needs: install_full_workspace
env:
NODE_ENV: production
UNSKIP_DECR: 'false'
defaults:
run:
working-directory: cms
steps:
- name: restore cache
uses: actions/cache@v2
id: restore-cms-build
with:
path: cms
key: cms-${{github.sha}}
- name: build cms dashboard
run: yarn build
test_cms:
runs-on: ubuntu-latest
needs: install_full_workspace
defaults:
run:
working-directory: cms
steps:
- name: restore cache
uses: actions/cache@v2
id: restore-cms-test
with:
path: cms
key: cms-${{github.sha}}
- name: API Tests
run: yarn test --ci --coverage --coverageReporters="text-summary"
- name: save tests code coverage
uses: actions/upload-artifact@v2
with:
name: backend-integration-test-coverage-${{github.sha}}
path: cms/coverage
build_site:
runs-on: ubuntu-latest
needs: install_full_workspace
steps:
- name: restore site cache
uses: actions/cache@v2
id: restore-site-build
with:
path: site
key: site-${{github.sha}}
- name: restore cms cache
uses: actions/cache@v2
id: restore-cms
with:
path: cms
key: cms-${{github.sha}}
- name: start cms server
run: |
cd cms/
yarn pm2 start "yarn strapi start"
- name: build nextjs site
run: |
cd site/
yarn build
test_unit_site:
runs-on: ubuntu-latest
needs: install_full_workspace
defaults:
run:
working-directory: site
steps:
- name: restore site
uses: actions/cache@v2
id: restore-site-unit-test
with:
path: site
key: site-${{github.sha}}
- name: Run Unit Tests
run: yarn test:unit --ci --coverage --coverageReporters="text-summary"
build_search_cloudflare:
runs-on: ubuntu-latest
needs: install_full_workspace
env:
NODE_ENV: production
defaults:
run:
working-directory: search/cloudflare
steps:
- name: Restore search/cloudflare
uses: actions/cache@v2
id: restore-search-cloudflare-build
with:
path: search/cloudflare
key: search-cloudflare-${{github.sha}}
- name: Build worker.js
run: yarn build
test_search_cloudflare:
runs-on: ubuntu-latest
needs: install_full_workspace
env:
NODE_ENV: production
defaults:
run:
working-directory: search/cloudflare
steps:
- name: Restore search/cloudflare
uses: actions/cache@v2
id: restore-search-cloudflare-test
with:
path: search/cloudflare
key: search-cloudflare-${{github.sha}}
- name: Test Cloudflare Worker
run: yarn test
build_webhook_hapi:
runs-on: ubuntu-latest
needs: install_full_workspace
env:
NODE_ENV: production
defaults:
run:
working-directory: webhooks/strapi
steps:
- name: Restore webhooks/strapi cache
uses: actions/cache@v2
id: restore-webhook-strapi-build
with:
path: webhooks/strapi
key: webhooks-strapi-${{github.sha}}
- name: Build Hapi
run: yarn build
test_webhook_hapi:
runs-on: ubuntu-latest
needs:
- install_full_workspace
env:
NODE_ENV: production
defaults:
run:
working-directory: webhooks/strapi
steps:
- name: Restore webhooks/strapi cache
uses: actions/cache@v2
id: restore-webhook-strapi-test
with:
path: webhooks/strapi
key: webhooks-strapi-${{github.sha}}
- name: Test Hapi
run: yarn test