forked from project-chip/zap
-
Notifications
You must be signed in to change notification settings - Fork 0
235 lines (209 loc) · 7.72 KB
/
matter.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
name: Matter code generation
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:
prepare-zap:
name: Prepare zap for Matter generation
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20.x]
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
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
build-zap:
name: Build ZAP
needs: [prepare-zap]
runs-on: ${{ matrix.os }}
# Platforms to build on/for
strategy:
matrix:
os: [ubuntu-22.04]
fail-fast: false
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Prepare Linux build environment
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo ./src-script/install-packages-ubuntu
- 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 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: 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/assert-command-line-output@v2.1
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/assert-command-line-output@v2.1
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/assert-command-line-output@v2.1
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/assert-command-line-output@v2.1
with:
command_line: npx asar l ./dist/linux-unpacked/resources/app.asar | grep apack.json
contains: 'apack.json'
- name: Archive Linux (x64) .zip file
uses: actions/upload-artifact@v4
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@v4
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@v4
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@v4
if: startsWith(matrix.os, 'ubuntu')
with:
name: zap-linux-x64-deb
path: dist/zap-linux-x64.deb
matter-sdk-codegen:
name: Test matter sdk codegen changes
needs: [build-zap]
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
# CHIP container required because clang-format version needs to match
container:
image: connectedhomeip/chip-build:0.6.11
steps:
- uses: actions/download-artifact@v4
with:
name: zap-linux-x64-zip
- name: Unpack linux artifact
run: |
mkdir zap-release && cd zap-release && unzip ../zap-linux-x64.zip
# Checkout without actions/checkout@v4 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
./scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux
ZAP_INSTALL_PATH=$(pwd)/../zap-release scripts/run_in_build_env.sh "scripts/tools/zap_regen_all.py --type global"
ZAP_INSTALL_PATH=$(pwd)/../zap-release scripts/run_in_build_env.sh "scripts/tools/zap_regen_all.py --type specific"
- 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 --