forked from SiliconLabs/zap
-
Notifications
You must be signed in to change notification settings - Fork 0
394 lines (347 loc) · 13.4 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
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: [16.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: xvfb-run -a npm run test:e2e-ci
cypress-matter:
name: Cypress UI tests with Matter data
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.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: xvfb-run -a npm run test:e2e-matter-ci
generate-and-backend-tests:
name: Generation and back-end tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.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 apt-get update
- run: sudo apt-get install --fix-missing libpixman-1-dev libcairo-dev libsdl-pango-dev libjpeg-dev libgif-dev 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
- 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: [16.x]
os: [ubuntu-22.04]
steps:
- run: echo "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: 16.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
npm run pack:cli:win
npm run pack:mac
npm run pkg:mac
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
npm run pack:cli:linux
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: ZAP binary check (macOS) - unzip
if: startsWith(matrix.os, 'macos')
run: unzip dist/zap-mac.zip -d dist/zap-mac
- name: ZAP binary check (macOS) - 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) - 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) - 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.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.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 .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.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in Windows .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 macOS .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.zip | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS .zip package's app-x64.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/mac-universal/zap.app/Contents/Resources/app-x64.asar | grep apack.json
contains: 'apack.json'
- name: Verify apack.json exists in macOS .zip package's app-arm64.asar archive
if: startsWith(matrix.os, 'macos')
uses: GuillaumeFalourd/[email protected]
with:
command_line: npx asar l ./dist/mac-universal/zap.app/Contents/Resources/app-arm64.asar | grep apack.json
contains: 'apack.json'
- name: Archive Windows .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: zap-win-zip
path: dist/zap*-win.zip
- name: Archive macOS .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'macos')
with:
name: zap-mac-zip
path: dist/zap*-mac.zip
- name: Archive Linux .zip file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-zip
path: dist/zap*-linux.zip
- name: Archive Linux .rpm file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-rpm
path: dist/zap*.rpm
- name: Archive Linux .deb file
uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-deb
path: dist/zap*.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-deb/zap-linux.deb, zap-linux-rpm/zap-linux.rpm, zap-linux-zip/zap-linux.zip, zap-mac-zip/zap-mac.zip, zap-win-zip/zap-win.zip'
matter-sdk-codegen:
name: Test matter sdk codegen changes
needs: [build-zap]
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [16.x]
# CHIP container required because clang-format version needs to match
container:
image: connectedhomeip/chip-build:0.6.11
steps:
- uses: actions/download-artifact@v3
with:
name: zap-linux-zip
- name: Unpack linux artifact
run: |
mkdir zap-release && cd zap-release && unzip ../zap-linux.zip
# Checkout without actions/checkout@v3 since that one uses a repository specific token
- name: Checkout Matter SDK
run: |
git clone --depth 1 https://github.com/project-chip/connectedhomeip.git chip_repo
- name: Ensure matter embedded zap is not available
run: |
rm -f /usr/bin/zap-cli
rm -rf /opt/zap-*
- name: Generate all
run: |
cd chip_repo
ZAP_INSTALL_PATH=$(pwd)/../zap-release scripts/run_in_build_env.sh scripts/tools/zap_regen_all.py
- name: Ensure git works in the chip repository checkout
run: git config --global --add safe.directory `pwd`/chip_repo
- name: Check for uncommited changes
run: |
cd chip_repo
git add .
# Show the full diff
git diff-index -p HEAD --
# Also show just the files that are different, to make it easy
# to tell at a glance what might be going on. And throw in
# --exit-code to make this job fail if there is a difference.
git diff-index --exit-code HEAD --