forked from project-chip/zap
-
Notifications
You must be signed in to change notification settings - Fork 4
454 lines (413 loc) · 16.3 KB
/
release.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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
name: Build and release packages
permissions:
contents: write
on:
push:
pull_request:
workflow_dispatch:
env:
ZAP_TEST_TIMEOUT: 3600000
ZAP_TEMPSTATE: 1
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
TRUSTED_CERTIFICATE_BASE64: ${{ secrets.TRUSTED_CERTIFICATE_BASE64 }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYCHAIN_PASSWORD: silabs
jobs:
cypress-zigbee:
name: Cypress UI tests with Zigbee data
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: sudo ./src-script/install-packages-ubuntu
- run: sudo apt-get install --fix-missing xvfb
- run: npm ci
- run: npm run version-stamp
- run: npm rebuild canvas --update-binary
- run: npm rebuild libxmljs --update-binary
- run: npm run build-spa
- run: npm run test:e2e-ci
cypress-matter:
name: Cypress UI tests with Matter data
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: sudo ./src-script/install-packages-ubuntu
- run: sudo apt-get install --fix-missing xvfb
- run: npm ci
- run: npm run version-stamp
- run: npm rebuild canvas --update-binary
- run: npm rebuild libxmljs --update-binary
- run: npm run build-spa
- run: npm run test:e2e-matter-ci
generate-and-backend-tests:
name: Generation and back-end tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: sudo ./src-script/install-packages-ubuntu
- run: sudo apt-get install --fix-missing libxml2-utils
- run: node --version
- run: npm --version
- run: npm ci
- run: npm run metafile-check
- run: npm run version-stamp
- run: npm rebuild canvas --update-binary
- run: npm rebuild libxmljs --update-binary
- run: npm run lic
- run: npm run build-spa
- run: npm run lint
- run: npm run xml-validate
- run: npm run self-check
- run: npm run test:unit
- name: Upload code coverage artifacts
uses: actions/upload-artifact@v3
with:
name: jest-coverage
path: jest-coverage/coverage-final.json
- run: npm run test:gen
code-coverage:
name: Code coverage
needs: [cypress-zigbee, cypress-matter, generate-and-backend-tests]
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.x]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Download jest coverage artifact
uses: actions/download-artifact@v3
with:
name: jest-coverage
- run: sudo ./src-script/install-packages-ubuntu
- run: npm ci
- run: npm run report
- name: Codecov
uses: codecov/[email protected]
build-zap:
name: Build ZAP
needs: [cypress-zigbee, cypress-matter, generate-and-backend-tests]
runs-on: ${{ matrix.os }}
# Platforms to build on/for
strategy:
matrix:
os: [macos-11, ubuntu-22.04]
fail-fast: false
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Node.js, NPM and Yarn
uses: actions/[email protected]
with:
node-version: 18.x
cache: 'npm'
- name: Prepare Linux build environment
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo ./src-script/install-packages-ubuntu
- name: Prepare macOS build environment
if: startsWith(matrix.os, 'macos')
run: ./src-script/install-packages-osx
- name: Prepare macOS certificate
if: startsWith(matrix.os, 'macos')
run: |
# create variables
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
if [ -n "$P12_PASSWORD" ]; then
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output ${RUNNER_TEMP}/build_certificate.p12
echo -n "$TRUSTED_CERTIFICATE_BASE64" | base64 --decode --output ${RUNNER_TEMP}/trusted_certificate.cer
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import ${RUNNER_TEMP}/trusted_certificate.cer -P "$P12_PASSWORD" -k $KEYCHAIN_PATH -A
security import ${RUNNER_TEMP}/build_certificate.p12 -P "$P12_PASSWORD" -k $KEYCHAIN_PATH -A
security find-identity -v
security list-keychain -d user -s $KEYCHAIN_PATH
fi
- name: Initialize...
run: |
npm rebuild canvas --update-binary
npm rebuild libxmljs --update-binary
npm ci
npm run version-stamp
- name: Building frontend / backend
run: |
npm run build
- name: Build & Release for Windows / Mac universal binary on macOS
if: startsWith(matrix.os, 'macos')
run: |
npm run pack:win
npm run pkg:win
ls ./dist/
npm run pack:cli:win
npm run pack:mac
npm run pkg:mac
ls ./dist/
npm run pack:cli:mac
env:
GH_TOKEN: ${{ secrets.github_token }}
# macOS notarization API key
# CSC_LINK: ${{ secrets.api_key_id }}
# CSC_KEY_PASSWORD: ${{ secrets.api_key_issuer_id }}
- name: Build & Release for Linux
if: startsWith(matrix.os, 'ubuntu')
run: |
npm run pack:linux
npm run pkg:linux
ls ./dist/
npm run pack:cli:linux
mv dist/zap-linux-amd64.deb dist/zap-linux-x64.deb
mv dist/zap-linux-x86_64.rpm dist/zap-linux-x64.rpm
env:
GH_TOKEN: ${{ secrets.github_token }}
# macOS notarization API key
# CSC_LINK: ${{ secrets.api_key_id }}
# CSC_KEY_PASSWORD: ${{ secrets.api_key_issuer_id }}
- name: Verify zap-cli exists in Linux x64 .zip package
if: startsWith(matrix.os, 'ubuntu')
run: |
output=$(./node_modules/7zip-bin/linux/x64/7za l ./dist/zap-linux-x64.zip)
expression=zap-cli
if [[ $output == *"$expression"* ]]; then
echo "Output contains $expression"
else
echo "Output does not contain $expression"
exit 1
fi
- name: Verify zap-cli exists in Linux arm64 .zip package
if: startsWith(matrix.os, 'ubuntu')
run: |
output=$(./node_modules/7zip-bin/linux/x64/7za l ./dist/zap-linux-arm64.zip)
expression=zap-cli
if [[ $output == *"$expression"* ]]; then
echo "Output contains $expression"
else
echo "Output does not contain $expression"
exit 1
fi
- name: Verify zap-cli exists in Windows x64 .zip package
if: startsWith(matrix.os, 'macos')
run: |
output=$(./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-win-x64.zip)
expression=zap-cli
if [[ $output == *"$expression"* ]]; then
echo "Output contains $expression"
else
echo "Output does not contain $expression"
exit 1
fi
- name: Verify zap-cli exists in Windows arm64 .zip package
if: startsWith(matrix.os, 'macos')
run: |
output=$(./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-win-arm64.zip)
expression=zap-cli
if [[ $output == *"$expression"* ]]; then
echo "Output contains $expression"
else
echo "Output does not contain $expression"
exit 1
fi
- name: Verify zap-cli exists in macOS x64 .zip package
if: startsWith(matrix.os, 'macos')
run: |
output=$(./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-mac-x64.zip | grep zap-cli)
expression=zap-cli
if [[ $output == *"$expression"* ]]; then
echo "Output contains $expression"
else
echo "Output does not contain $expression"
exit 1
fi
- name: ZAP binary check (macOS x64) - unzip
if: startsWith(matrix.os, 'macos')
run: unzip dist/zap-mac-x64.zip -d dist/zap-mac
- name: ZAP binary check (macOS x64) - check version is set
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./dist/zap-mac/zap.app/Contents/MacOS/zap --version
contains: '0.0.0'
expected_result: FAILED
- name: ZAP binary check (macOS x64) - check version is set via CLI
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./dist/zap-mac/zap-cli --version
contains: '0.0.0'
expected_result: FAILED
- name: ZAP binary check (macOS x64) - unzip cleanup
if: startsWith(matrix.os, 'macos')
run: rm -rf dist/zap-mac
- name: ZAP binary check (Linux) - unzip
if: startsWith(matrix.os, 'ubuntu')
run: unzip dist/zap-linux-x64.zip -d dist/zap-linux
- name: ZAP binary check (Linux) - check version is set
if: startsWith(matrix.os, 'ubuntu')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./dist/zap-linux/zap --version
contains: '0.0.0'
expected_result: FAILED
- name: ZAP binary check (Linux) - check version is set via CLI
if: startsWith(matrix.os, 'ubuntu')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./dist/zap-linux/zap-cli --version
contains: '0.0.0'
expected_result: FAILED
- name: ZAP binary check (Linux) - unzip cleanup
if: startsWith(matrix.os, 'ubuntu')
run: rm -rf dist/zap-linux
- name: Verify apack.json exists in package's base directory
if: startsWith(matrix.os, 'ubuntu')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./node_modules/7zip-bin/linux/x64/7za l ./dist/zap-linux-x64.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in package's app.asar archive
if: startsWith(matrix.os, 'ubuntu')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/linux-unpacked/resources/app.asar | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in Windows x64 .zip package
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-win-x64.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in Windows x64 .zip package's app.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/win-unpacked/resources/app.asar | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in Windows arm64 .zip package
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-win-arm64.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in Windows arm64 .zip package's app.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/win-arm64-unpacked/resources/app.asar | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS x64 .zip package
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-mac-x64.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS x64 .zip package's app-x64.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/mac/zap.app/Contents/Resources/app-x64.asar | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS arm64 .zip package
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: ./node_modules/7zip-bin/mac/x64/7za l ./dist/zap-mac-arm64.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS arm64 .zip package's app-arm64.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/mac-arm64/zap.app/Contents/Resources/app-arm64.asar | grep apack.json
contains: 'apack.json'
- name: Archive Windows (x64) .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: zap-win-x64-zip
path: dist/zap-win-x64.zip
- name: Archive Windows (arm64) .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: zap-win-arm64-zip
path: dist/zap-win-arm64.zip
- name: Archive macOS x64 .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: zap-mac-x64-zip
path: dist/zap-mac-x64.zip
- name: Archive Linux (x64) .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-x64-zip
path: dist/zap-linux-x64.zip
- name: Archive Linux (arm64) .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-arm64-zip
path: dist/zap-linux-arm64.zip
- name: Archive Linux .rpm file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-x64-rpm
path: dist/zap-linux-x64.rpm
- name: Archive Linux x64 .deb file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-x64-deb
path: dist/zap-linux-x64.deb
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-zap]
name: Create Github Release
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v3
- name: List downloaded files
run: ls -R
- name: Creating Github Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
prerelease: ${{ endsWith(github.ref, 'nightly') }}
artifacts: 'zap-linux-x64-deb/zap-linux-x64.deb, zap-linux-x64-rpm/zap-linux-x64.rpm, zap-linux-x64-zip/zap-linux-x64.zip, zap-linux-arm64-zip/zap-linux-arm64.zip, zap-mac-x64-zip/zap-mac-x64.zip, zap-win-x64-zip/zap-win-x64.zip, zap-win-arm64-zip/zap-win-arm64.zip'