forked from Open-CMSIS-Pack/devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
276 lines (248 loc) · 10.6 KB
/
toolbox.yml
File metadata and controls
276 lines (248 loc) · 10.6 KB
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
name: toolbox
on:
push:
branches:
- main
paths:
- '.github/workflows/toolbox.yml'
- '.github/matrix_includes_toolbox.json'
- 'CMakeLists.txt'
- 'tools/toolbox/**'
pull_request:
paths:
- '.github/workflows/toolbox.yml'
- '.github/matrix_includes_toolbox.json'
- 'CMakeLists.txt'
- 'tools/toolbox/**'
release:
types: [published]
jobs:
matrix_prep:
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/toolbox/'))
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Check out repo
uses: actions/checkout@v2
- id: set-matrix
run: |
publicRepo=$(echo '${{ github.event.repository.private && 'privateRepo' || 'publicRepo' }}')
matrix=$(jq --arg publicRepo "$publicRepo" 'map(. | select((.runOn==$publicRepo) or (.runOn=="always")) )' matrix_includes_toolbox.json)
echo ::set-output name=matrix::{\"include\":$(echo $matrix)}\"
working-directory: .github/
create_installer:
needs: matrix_prep
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Checkout devtools
uses: actions/checkout@v2
- name: Create folders
run: |
mkdir -p tools/toolbox/cbuild
mkdir -p tools/toolbox/projmgr
mkdir -p tools/toolbox/packchk
mkdir -p tools/toolbox/distribution/bin
mkdir -p tools/toolbox/distribution/etc
mkdir -p tools/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/0.11.2
file: cbuild_install.sh
target: tools/toolbox/cbuild/cbuild_install.sh
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download projmgr release asset
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: "Open-CMSIS-Pack/devtools"
version: tags/tools/projmgr/0.9.6
file: projmgr.zip
target: tools/toolbox/projmgr/projmgr.zip
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.3.95
regex: true
file: "packchk-.*\\.zip"
target: "tools/toolbox/packchk/"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip and copy files
run: |
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
unzip projmgr/projmgr.zip -d projmgr
cp projmgr/bin/darwin64/csolution distribution/bin/csolution.mac
cp projmgr/bin/linux64/csolution distribution/bin/csolution.lin
cp projmgr/bin/windows64/csolution.exe distribution/bin/csolution.exe
cp -r projmgr/etc/* distribution/etc
unzip packchk/packchk-\*-darwin64.zip -d packchk && mv packchk/packchk distribution/bin/packchk.mac
unzip packchk/packchk-\*-linux64.zip -d packchk && mv packchk/packchk distribution/bin/packchk.lin
unzip packchk/packchk-\*-windows64.zip -d packchk && mv packchk/packchk.exe distribution/bin/packchk.exe
cp docs/LICENSE.txt distribution
cp docs/index.html distribution/doc
working-directory: tools/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: tools/toolbox/distribution
- name: Create installer
id: installer
run: |
export VERSION=$(echo ${{ github.ref }} | cut -d/ -f5)
./create_installer.sh --input=../distribution --output=. --version=$VERSION
working-directory: tools/toolbox/installer
- name: Archive cmsis-toolbox installer
uses: actions/upload-artifact@v2
with:
name: cmsis-toolbox
path: tools/toolbox/installer/cmsis-toolbox.sh
retention-days: 1
if-no-files-found: error
release:
if: |
github.event_name == 'release' &&
startsWith(github.ref, 'refs/tags/tools/toolbox/')
needs: [ create_installer ]
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- name: Checkout devtools
uses: actions/checkout@v2
- name: Download cmsis-toolbox installer
uses: actions/download-artifact@v2
with:
name: cmsis-toolbox
path: ${{ github.workspace }}
- name: Attach installer to release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: cmsis-toolbox.sh
tag: ${{ github.ref }}
overwrite: true
asset_name: cmsis-toolbox.sh
- name: Extract cmsis-toolbox installer files
run: |
chmod +x cmsis-toolbox.sh
./cmsis-toolbox.sh -x tools/toolbox/zip
- name: Copy files separated by target for archiving
run: |
mkdir -p zip/cmsis-toolbox-windows64/bin zip/cmsis-toolbox-windows64/etc zip/cmsis-toolbox-windows64/doc
mkdir -p zip/cmsis-toolbox-linux64/bin zip/cmsis-toolbox-linux64/etc zip/cmsis-toolbox-linux64/doc
mkdir -p zip/cmsis-toolbox-darwin64/bin zip/cmsis-toolbox-darwin64/etc zip/cmsis-toolbox-darwin64/doc
cp zip/bin/cbuild.exe zip/cmsis-toolbox-windows64/bin/cbuild.exe
cp zip/bin/cbuildgen.exe zip/cmsis-toolbox-windows64/bin/cbuildgen.exe
cp zip/bin/cpackget.exe zip/cmsis-toolbox-windows64/bin/cpackget.exe
cp zip/bin/csolution.exe zip/cmsis-toolbox-windows64/bin/csolution.exe
cp zip/bin/packchk.exe zip/cmsis-toolbox-windows64/bin/packchk.exe
cp zip/bin/cbuild.lin zip/cmsis-toolbox-linux64/bin/cbuild
cp zip/bin/cbuildgen.lin zip/cmsis-toolbox-linux64/bin/cbuildgen
cp zip/bin/cpackget.lin zip/cmsis-toolbox-linux64/bin/cpackget
cp zip/bin/csolution.lin zip/cmsis-toolbox-linux64/bin/csolution
cp zip/bin/packchk.lin zip/cmsis-toolbox-linux64/bin/packchk
cp zip/bin/cbuild.mac zip/cmsis-toolbox-darwin64/bin/cbuild
cp zip/bin/cbuildgen.mac zip/cmsis-toolbox-darwin64/bin/cbuildgen
cp zip/bin/cpackget.mac zip/cmsis-toolbox-darwin64/bin/cpackget
cp zip/bin/csolution.mac zip/cmsis-toolbox-darwin64/bin/csolution
cp zip/bin/packchk.mac zip/cmsis-toolbox-darwin64/bin/packchk
cp zip/LICENSE.txt zip/cmsis-toolbox-windows64/LICENSE.txt
cp zip/LICENSE.txt zip/cmsis-toolbox-linux64/LICENSE.txt
cp zip/LICENSE.txt zip/cmsis-toolbox-darwin64/LICENSE.txt
rm zip/etc/setup
cp -r zip/etc/* zip/cmsis-toolbox-windows64/etc
cp -r zip/etc/* zip/cmsis-toolbox-linux64/etc
cp -r zip/etc/* zip/cmsis-toolbox-darwin64/etc
cp -r zip/doc/* zip/cmsis-toolbox-windows64/doc
cp -r zip/doc/* zip/cmsis-toolbox-linux64/doc
cp -r zip/doc/* zip/cmsis-toolbox-darwin64/doc
working-directory: tools/toolbox
- name: Set toolchain default paths
run: |
./scripts/set-default.sh Windows zip/cmsis-toolbox-windows64/etc
./scripts/set-default.sh Linux zip/cmsis-toolbox-linux64/etc
./scripts/set-default.sh Darwin zip/cmsis-toolbox-darwin64/etc
working-directory: tools/toolbox
- name: Zip folders
run: |
zip -r cmsis-toolbox-windows64.zip cmsis-toolbox-windows64
tar -czvf cmsis-toolbox-linux64.tar.gz cmsis-toolbox-linux64
tar -czvf cmsis-toolbox-darwin64.tar.gz cmsis-toolbox-darwin64
working-directory: tools/toolbox/zip
- name: Calculate checksums
run: |
sha256sum cmsis-toolbox-windows64.zip --text > cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-linux64.tar.gz --text >> cmsis-toolbox-checksums.txt
sha256sum cmsis-toolbox-darwin64.tar.gz --text >> cmsis-toolbox-checksums.txt
working-directory: tools/toolbox/zip
- name: Attach installer to release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tools/toolbox/zip/cmsis-toolbox-*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
tests:
needs: [ create_installer, matrix_prep ]
timeout-minutes: 15
runs-on: ${{ matrix.runs_on }}
env:
CI_TOOLBOX_INSTALLER: ${{ github.workspace }}/cmsis-toolbox.sh
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Checkout devtools
uses: actions/checkout@v2
with:
submodules: true
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Download cmsis-toolbox installer
uses: actions/download-artifact@v2
with:
name: cmsis-toolbox
path: ${{ github.workspace }}
- name: Set correct cmsis-toolbox file permission
if: ${{ startsWith(matrix.runs_on, 'macos') || startsWith(matrix.runs_on, 'ubuntu') }}
run: chmod +x cmsis-toolbox.sh
- name: Build ToolboxTests
uses: Open-CMSIS-Pack/devtools-build-action@v1.1
with:
arch: ${{ matrix.arch }}
build_type: Debug
target: ToolboxTests
- name: Run Toolbox tests
run: |
ctest -V -C Debug -R ToolboxTests
working-directory: ./build
- name: Archive tests results
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: toolboxtest-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/Testing/Temporary/LastTest.log
retention-days: 1
if-no-files-found: error
- name: Archive gtest report
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: toolbox_test-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/test_reports/toolboxtests-*.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.target }}-${{ matrix.arch }}
report_paths: build/test_reports/toolboxtests-${{ matrix.target }}.xml