forked from Open-CMSIS-Pack/cmsis-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
354 lines (319 loc) · 17 KB
/
toolbox.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
name: toolbox
on:
push:
branches:
- main
paths:
- '.github/workflows/toolbox.yml'
- '**'
pull_request:
paths:
- '.github/workflows/toolbox.yml'
- '**'
release:
types: [published]
jobs:
create_archives:
if: |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }}
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Checkout devtools
uses: actions/checkout@v3
- name: Create folders
run: |
mkdir -p toolbox/cbuild
mkdir -p toolbox/packchk
mkdir -p toolbox/svdconv
mkdir -p toolbox/distribution/bin
mkdir -p toolbox/distribution/etc
mkdir -p toolbox/distribution/doc
- name: Download cbuild release asset
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "Open-CMSIS-Pack/devtools"
version: tags/tools/buildmgr/2.0.0
file: cbuild_install.sh
target: toolbox/cbuild/cbuild_install.sh
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download packchk release assets
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "Open-CMSIS-Pack/devtools"
version: tags/tools/packchk/1.4.1
regex: true
file: "packchk-.*\\.(zip|tbz2)"
target: "toolbox/packchk/"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download svdconv release assets
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "Open-CMSIS-Pack/devtools"
version: tags/tools/svdconv/3.3.45
regex: true
file: "svdconv-.*\\.(zip|tbz2)"
target: "toolbox/svdconv/"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip and copy files
run: |
curl https://raw.githubusercontent.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/v1.7.25/schema/PACK.xsd --output distribution/etc/PACK.xsd
sudo chmod +x ./cbuild/cbuild_install.sh
./cbuild/cbuild_install.sh -x cbuild
cp -r cbuild/bin/* distribution/bin
cp -r cbuild/etc/* distribution/etc
tar -xvf packchk/packchk-*-darwin-amd64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.mac-amd64
tar -xvf packchk/packchk-*-darwin-arm64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.mac-arm64
tar -xvf packchk/packchk-*-linux-amd64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.lin-amd64
tar -xvf packchk/packchk-*-linux-arm64.tbz2 -C packchk && mv packchk/packchk distribution/bin/packchk.lin-arm64
unzip packchk/packchk-\*-windows-amd64.zip -d packchk && mv packchk/packchk.exe distribution/bin/packchk.exe-amd64
unzip packchk/packchk-\*-windows-arm64.zip -d packchk && mv packchk/packchk.exe distribution/bin/packchk.exe-arm64
tar -xvf svdconv/svdconv-*-darwin-amd64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.mac-amd64
tar -xvf svdconv/svdconv-*-darwin-arm64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.mac-arm64
tar -xvf svdconv/svdconv-*-linux-amd64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.lin-amd64
tar -xvf svdconv/svdconv-*-linux-arm64.tbz2 -C svdconv && mv svdconv/svdconv distribution/bin/svdconv.lin-arm64
unzip svdconv/svdconv-\*-windows-amd64.zip -d svdconv && mv svdconv/svdconv.exe distribution/bin/svdconv.exe-amd64
unzip svdconv/svdconv-\*-windows-arm64.zip -d svdconv && mv svdconv/svdconv.exe distribution/bin/svdconv.exe-arm64
cp ../docs/LICENSE.txt distribution
cp ../docs/index.html distribution/doc
working-directory: toolbox
- name: Add execution permission to the binaries and set files ownership
run: |
sudo chmod -R +x bin/*
sudo chown -R root:root *
working-directory: toolbox/distribution
- name: list file permission
run: |
ls -l
ls -l toolbox/distribution
ls -l toolbox/distribution/etc/setup
- name: Copy files separated by target for archiving
run: |
mkdir -p zip/cmsis-toolbox-windows-amd64/bin zip/cmsis-toolbox-windows-amd64/etc zip/cmsis-toolbox-windows-amd64/doc
mkdir -p zip/cmsis-toolbox-windows-arm64/bin zip/cmsis-toolbox-windows-arm64/etc zip/cmsis-toolbox-windows-arm64/doc
mkdir -p zip/cmsis-toolbox-linux-amd64/bin zip/cmsis-toolbox-linux-amd64/etc zip/cmsis-toolbox-linux-amd64/doc
mkdir -p zip/cmsis-toolbox-linux-arm64/bin zip/cmsis-toolbox-linux-arm64/etc zip/cmsis-toolbox-linux-arm64/doc
mkdir -p zip/cmsis-toolbox-darwin-amd64/bin zip/cmsis-toolbox-darwin-amd64/etc zip/cmsis-toolbox-darwin-amd64/doc
mkdir -p zip/cmsis-toolbox-darwin-arm64/bin zip/cmsis-toolbox-darwin-arm64/etc zip/cmsis-toolbox-darwin-arm64/doc
cp distribution/bin/cbuild.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbuild.exe
cp distribution/bin/cbuildgen.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cbuildgen.exe
cp distribution/bin/cpackget.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/cpackget.exe
cp distribution/bin/csolution.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/csolution.exe
cp distribution/bin/packchk.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/packchk.exe
cp distribution/bin/svdconv.exe-amd64 zip/cmsis-toolbox-windows-amd64/bin/svdconv.exe
cp distribution/bin/cbuild.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbuild.exe
cp distribution/bin/cbuildgen.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cbuildgen.exe
cp distribution/bin/cpackget.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/cpackget.exe
cp distribution/bin/csolution.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/csolution.exe
cp distribution/bin/packchk.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/packchk.exe
cp distribution/bin/svdconv.exe-arm64 zip/cmsis-toolbox-windows-arm64/bin/svdconv.exe
cp distribution/bin/cbuild.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbuild
cp distribution/bin/cbuildgen.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cbuildgen
cp distribution/bin/cpackget.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/cpackget
cp distribution/bin/csolution.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/csolution
cp distribution/bin/packchk.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/packchk
cp distribution/bin/svdconv.lin-amd64 zip/cmsis-toolbox-linux-amd64/bin/svdconv
cp distribution/bin/cbuild.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbuild
cp distribution/bin/cbuildgen.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cbuildgen
cp distribution/bin/cpackget.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/cpackget
cp distribution/bin/csolution.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/csolution
cp distribution/bin/packchk.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/packchk
cp distribution/bin/svdconv.lin-arm64 zip/cmsis-toolbox-linux-arm64/bin/svdconv
cp distribution/bin/cbuild.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbuild
cp distribution/bin/cbuildgen.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cbuildgen
cp distribution/bin/cpackget.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/cpackget
cp distribution/bin/csolution.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/csolution
cp distribution/bin/packchk.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/packchk
cp distribution/bin/svdconv.mac-amd64 zip/cmsis-toolbox-darwin-amd64/bin/svdconv
cp distribution/bin/cbuild.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbuild
cp distribution/bin/cbuildgen.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cbuildgen
cp distribution/bin/cpackget.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/cpackget
cp distribution/bin/csolution.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/csolution
cp distribution/bin/packchk.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/packchk
cp distribution/bin/svdconv.mac-arm64 zip/cmsis-toolbox-darwin-arm64/bin/svdconv
cp distribution/LICENSE.txt zip/cmsis-toolbox-windows-amd64/LICENSE.txt
cp distribution/LICENSE.txt zip/cmsis-toolbox-windows-arm64/LICENSE.txt
cp distribution/LICENSE.txt zip/cmsis-toolbox-linux-amd64/LICENSE.txt
cp distribution/LICENSE.txt zip/cmsis-toolbox-linux-arm64/LICENSE.txt
cp distribution/LICENSE.txt zip/cmsis-toolbox-darwin-amd64/LICENSE.txt
cp distribution/LICENSE.txt zip/cmsis-toolbox-darwin-arm64/LICENSE.txt
sudo rm distribution/etc/setup
cp -r distribution/etc/* zip/cmsis-toolbox-windows-amd64/etc
cp -r distribution/etc/* zip/cmsis-toolbox-windows-arm64/etc
cp -r distribution/etc/* zip/cmsis-toolbox-linux-amd64/etc
cp -r distribution/etc/* zip/cmsis-toolbox-linux-arm64/etc
cp -r distribution/etc/* zip/cmsis-toolbox-darwin-amd64/etc
cp -r distribution/etc/* zip/cmsis-toolbox-darwin-arm64/etc
cp -r distribution/doc/* zip/cmsis-toolbox-windows-amd64/doc
cp -r distribution/doc/* zip/cmsis-toolbox-windows-arm64/doc
cp -r distribution/doc/* zip/cmsis-toolbox-linux-amd64/doc
cp -r distribution/doc/* zip/cmsis-toolbox-linux-arm64/doc
cp -r distribution/doc/* zip/cmsis-toolbox-darwin-amd64/doc
cp -r distribution/doc/* zip/cmsis-toolbox-darwin-arm64/doc
working-directory: toolbox
- name: Set toolchain default paths
run: |
./scripts/set-default.sh Windows toolbox/zip/cmsis-toolbox-windows-amd64/etc
./scripts/set-default.sh Windows toolbox/zip/cmsis-toolbox-windows-arm64/etc
./scripts/set-default.sh Linux toolbox/zip/cmsis-toolbox-linux-amd64/etc
./scripts/set-default.sh Linux toolbox/zip/cmsis-toolbox-linux-arm64/etc
./scripts/set-default.sh Darwin toolbox/zip/cmsis-toolbox-darwin-amd64/etc
./scripts/set-default.sh Darwin toolbox/zip/cmsis-toolbox-darwin-arm64/etc
- name: Zip folders
run: |
zip -r cmsis-toolbox-windows-amd64.zip cmsis-toolbox-windows-amd64
zip -r cmsis-toolbox-windows-arm64.zip cmsis-toolbox-windows-arm64
tar -czvf cmsis-toolbox-linux-amd64.tar.gz cmsis-toolbox-linux-amd64
tar -czvf cmsis-toolbox-linux-arm64.tar.gz cmsis-toolbox-linux-arm64
tar -czvf cmsis-toolbox-darwin-amd64.tar.gz cmsis-toolbox-darwin-amd64
tar -czvf cmsis-toolbox-darwin-arm64.tar.gz cmsis-toolbox-darwin-arm64
working-directory: toolbox/zip
- name: Archive windows amd64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-windows-amd64
path: ./toolbox/zip/cmsis-toolbox-windows-amd64.zip
retention-days: 1
if-no-files-found: error
- name: Archive windows arm64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-windows-arm64
path: ./toolbox/zip/cmsis-toolbox-windows-arm64.zip
retention-days: 1
if-no-files-found: error
- name: Archive linux amd64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-linux-amd64
path: ./toolbox/zip/cmsis-toolbox-linux-amd64.tar.gz
retention-days: 1
if-no-files-found: error
- name: Archive linux arm64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-linux-arm64
path: ./toolbox/zip/cmsis-toolbox-linux-arm64.tar.gz
retention-days: 1
if-no-files-found: error
- name: Archive darwin amd64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-darwin-amd64
path: ./toolbox/zip/cmsis-toolbox-darwin-amd64.tar.gz
retention-days: 1
if-no-files-found: error
- name: Archive darwin arm64 binaries
uses: actions/upload-artifact@v3
with:
name: cmsis-toolbox-darwin-arm64
path: ./toolbox/zip/cmsis-toolbox-darwin-arm64.tar.gz
retention-days: 1
if-no-files-found: error
tests:
if: |
${{ github.event_name == 'pull_request' || github.event_name == 'release' }}
needs: [ create_archives ]
timeout-minutes: 15
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: true
matrix:
config:
- { os: macos-12, target: darwin, arch: amd64 }
- { os: macos-12, target: darwin, arch: arm64 }
- { os: windows-2019, target: windows, arch: amd64}
- { os: windows-2019, target: windows, arch: arm64}
- { os: ubuntu-20.04, target: linux, arch: amd64}
- { os: ubuntu-20.04, target: linux, arch: arm64}
steps:
- name: Checkout cmsis-toolbox
uses: actions/checkout@v3
with:
submodules: recursive
- name: Download cmsis toolbox ${{ matrix.config.target }} ${{ matrix.config.arch }}
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }}
path: archive
- name: Create directory
run: |
mkdir -p toolbox
- name: unzip cmsis-toolbox windows archive
if: ${{ startsWith(matrix.config.os, 'windows') }}
run: unzip archive/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }}.zip -d toolbox
- name: unzip cmsis-toolbox macos/linux archive
if: ${{ startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'ubuntu') }}
run: tar -xvf archive/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }}.tar.gz -C toolbox
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Test with pytest
run: |
pytest --base-path=toolbox/cmsis-toolbox-${{ matrix.config.target }}-${{ matrix.config.arch }} test/tests.py -rA --junitxml=test-results-${{ matrix.config.target }}-${{ matrix.config.arch }}.xml
- name: Archive test report
uses: actions/upload-artifact@v2
with:
name: toolbox_test-${{ matrix.config.target }}-${{ matrix.config.arch }}
path: ./test-results-*.xml
retention-days: 1
if-no-files-found: error
- name: Publish Toolbox Test Results
uses: mikepenz/action-junit-report@v2
with:
check_name: toolbox_test-${{ matrix.config.target }}-${{ matrix.config.arch }}
report_paths: test-results-${{ matrix.config.target }}-${{ matrix.config.arch }}.xml
release:
if: ${{ github.event_name == 'release' }}
needs: [ create_archives ]
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Download cmsis toolbox windows amd64 zip
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-windows-amd64
path: toolbox/zip
- name: Download cmsis toolbox windows arm64 zip
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-windows-arm64
path: toolbox/zip
- name: Download cmsis toolbox linux amd64 zip
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-linux-amd64
path: toolbox/zip
- name: Download cmsis toolbox linux arm64 zip
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-linux-arm64
path: toolbox/zip
- name: Download cmsis toolbox darwin amd64 zip
uses: actions/download-artifact@v3
with:
name: cmsis-toolbox-darwin-amd64
path: toolbox/zip
- name: Calculate checksums
run: |
sha256sum cmsis-toolbox-windows-amd64.zip --text > cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-windows-arm64.zip --text >> cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-linux-amd64.tar.gz --text >> cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-linux-arm64.tar.gz --text >> cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-darwin-amd64.tar.gz --text >> cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-darwin-arm64.tar.gz --text >> cmsis-toolbox-checksums.txt
working-directory: toolbox/zip
- name: Attach installer to release assets
id: release_assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: toolbox/zip/cmsis-toolbox-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true