forked from Open-CMSIS-Pack/cmsis-toolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
300 lines (258 loc) · 10.6 KB
/
nightly.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
name: nightly
# This workflow picks up the latest changes of toolbox binaries
# and runs end-to-end tests to detect regressions. It is triggered by:
# 1. A schedule set for every midnight
# 2. Manual triggering of the workflow
# 3. Changes to the workflow file
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
pull_request:
paths:
- '.github/workflows/nightly.yml'
- '.github/matrix_includes.json'
- 'test/**'
- '!test/RobotTests.md'
- '!test/tests.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: JoshuaTheMiller/conditional-build-matrix@v2.0.1
id: set-matrix
with:
inputFile: '.github/matrix_includes.json'
filter: '[?runOnBranch==`always`]'
create-toolbox:
needs: [ matrix_prep ]
runs-on: ${{ matrix.runs_on }}
continue-on-error: true
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Authenticate with GitHub CLI
shell: bash
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
- name: Get latest nightly Run ID
id: get_run_id
shell: bash
run: |
RUN_ID=$(gh run list --limit 1 --workflow nightly --repo Open-CMSIS-Pack/devtools --json databaseId --jq '.[0].databaseId')
echo "NIGHTLY_RUN_ID=$RUN_ID" >> $GITHUB_OUTPUT
# Download and build cbuild executable
- name: Checkout cbuild repository
uses: actions/checkout@v4
with:
repository: Open-CMSIS-PACK/cbuild
path: cbuild
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: cbuild/go.mod
cache-dependency-path: |
**/go.mod
**/go.sum
- name: Build cbuild executable
working-directory: cbuild
shell: bash
run: |
GOOS=${{ matrix.target }} GOARCH=${{ matrix.arch }} go build -ldflags "-X main.version=$(git describe --tags)" -o build/cbuild${{ matrix.binary_extension }} ./cmd/cbuild
# Download and build cpackget executable
- name: Checkout cpackget repository
uses: actions/checkout@v4
with:
repository: Open-CMSIS-PACK/cpackget
path: cpackget
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: cpackget/go.mod
cache-dependency-path: |
cpackget/go.mod
cpackget/go.sum
- name: Build cpackget executable
working-directory: cpackget
shell: bash
run: |
GOOS=${{ matrix.target }} GOARCH=${{ matrix.arch }} go build -ldflags "-X main.version=$(git describe --tags)" -o build/cpackget${{ matrix.binary_extension }} ./cmd
# Download and build cbuild2cmake executable
- name: Checkout cbuild2cmake repository
uses: actions/checkout@v4
with:
repository: Open-CMSIS-PACK/cbuild2cmake
path: cbuild2cmake
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: cbuild2cmake/go.mod
cache-dependency-path: |
cbuild2cmake/go.mod
cbuild2cmake/go.sum
- name: Build cbuild2cmake executable
working-directory: cbuild2cmake
shell: bash
run: |
GOOS=${{ matrix.target }} GOARCH=${{ matrix.arch }} go build -ldflags "-X main.version=$(git describe --tags)" -o build/cbuild2cmake${{ matrix.binary_extension }} ./cmd/cbuild2cmake
# Download projmgr and cbuildgen from nightly
- name: Download Open-CMSIS-Pack/devtools nightly artifacts
shell: bash
run : |
gh run download -D projmgr-${{ matrix.target }}-${{ matrix.arch }} ${{ steps.get_run_id.outputs.NIGHTLY_RUN_ID }} -n projmgr-${{ matrix.target }}-${{ matrix.arch }} -R Open-CMSIS-Pack/devtools
gh run download -D cbuildgen-${{ matrix.target }}-${{ matrix.arch }} ${{ steps.get_run_id.outputs.NIGHTLY_RUN_ID }} -n cbuildgen-${{ matrix.target }}-${{ matrix.arch }} -R Open-CMSIS-Pack/devtools
- name: Checkout cmsis-toolbox repo
uses: actions/checkout@v4
with:
repository: Open-CMSIS-PACK/devtools
path: devtools
- name: Copy Files
shell: bash
run: |
mkdir -p ./cmsis-toolbox/bin
mkdir -p ./cmsis-toolbox/etc
cp ./projmgr-${{ matrix.target }}-${{ matrix.arch }}/csolution${{ matrix.binary_extension }} ./cmsis-toolbox/bin/csolution${{ matrix.binary_extension }}
cp ./cbuildgen-${{ matrix.target }}-${{ matrix.arch }}/cbuildgen${{ matrix.binary_extension }}* ./cmsis-toolbox/bin/cbuildgen${{ matrix.binary_extension }}
cp ./cbuild/build/cbuild${{ matrix.binary_extension }} ./cmsis-toolbox/bin/cbuild${{ matrix.binary_extension }}
cp ./cpackget/build/cpackget${{ matrix.binary_extension }} ./cmsis-toolbox/bin/cpackget${{ matrix.binary_extension }}
cp ./cbuild2cmake/build/cbuild2cmake${{ matrix.binary_extension }} ./cmsis-toolbox/bin/cbuild2cmake${{ matrix.binary_extension }}
cp -r devtools/tools/projmgr/templates/* ./cmsis-toolbox/etc
cp -r devtools/tools/projmgr/schemas/* ./cmsis-toolbox/etc
cp -r devtools/tools/buildmgr/cbuildgen/scripts/* ./cmsis-toolbox/etc
cp -r devtools/tools/buildmgr/cbuildgen/config/* ./cmsis-toolbox/etc
- name: Update toolchain config files
if: ${{ matrix.target == 'windows' }}
shell: bash
run: |
sed -i '/set(EXT/c\ set(EXT .exe)' ./cmsis-toolbox/etc/AC6.6.16.2.cmake
sed -i '/set(EXT/c\ set(EXT .exe)' ./cmsis-toolbox/etc/GCC.10.3.1.cmake
sed -i '/set(EXT/c\ set(EXT .exe)' ./cmsis-toolbox/etc/IAR.9.32.1.cmake
sed -i '/set(EXT/c\ set(EXT .exe)' ./cmsis-toolbox/etc/CLANG.17.0.1.cmake
- name: Archieve test results
if: always()
uses: actions/upload-artifact@v4
with:
name: cmsis-toolbox-${{ matrix.target }}-${{ matrix.arch }}
path: cmsis-toolbox
run-tests:
needs: [ matrix_prep, create-toolbox ]
runs-on: ${{ matrix.runs_on }}
continue-on-error: true
strategy:
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Checkout toolbox repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install pip dependencies
run: |
pip install --upgrade pip
pip install -r test/requirements.txt
- name: Setup vcpkg environment
uses: ARM-software/cmsis-actions/vcpkg@v1
with:
config: "./test/vcpkg-configuration.json"
vcpkg-downloads: "${{ github.workspace }}/.vcpkg/downloads"
cache: "-"
- name: Activate Arm tool license
run: |
armlm activate --server https://mdk-preview.keil.arm.com --product KEMDK-COM0
working-directory: ./test
- name: Download cmsis toolbox ${{ matrix.target }} ${{ matrix.arch }}
uses: actions/download-artifact@v4
with:
name: cmsis-toolbox-${{ matrix.target }}-${{ matrix.arch }}
path: cmsis-toolbox
- name: Set execution permissions
run: |
chmod -R +x ./cmsis-toolbox/bin/*
- name: Get toolbox path
if: always()
id: toolbox_path
shell: bash
run: |
echo "path=$(echo "$(pwd)/cmsis-toolbox/bin")" >> $GITHUB_OUTPUT
- name: Binary version info
if: always()
shell: bash
run: |
export PATH="${{steps.toolbox_path.outputs.path}}:$PATH"
csolution -V
cpackget -V
cbuild -V
cbuild2cmake -V
cbuildgen -V
- name: Run Test
shell: bash
continue-on-error: true
run: |
export PATH="${{steps.toolbox_path.outputs.path}}:$PATH"
robot --outputdir reports-${{ matrix.target }}-${{ matrix.arch }} \
--variable TEST_ENV_FILE:test-env-${{ matrix.target }}-${{ matrix.arch }}.md \
--consolewidth=150 --settag ${{ matrix.target }}-${{ matrix.arch }} \
--name ${{ matrix.target }}-${{ matrix.arch }} \
./test
- name: Archieve test results
if: always()
uses: actions/upload-artifact@v4
with:
name: reports-${{ matrix.target }}-${{ matrix.arch }}
path: reports-${{ matrix.target }}-${{ matrix.arch }}
consolidate-report:
if: always()
needs: [run-tests]
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install pip dependencies
run: |
pip install --upgrade pip
pip install -r test/requirements.txt
- name: Download reports
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: reports-*
- name: Consolidate robot test results
working-directory: artifacts
continue-on-error: true
run: |
python -m robot.rebot --name Collective_Robot_Results --outputdir collective_robot_results --output output.xml \
./reports-windows-amd64/output.xml \
./reports-linux-amd64/output.xml \
./reports-darwin-amd64/output.xml
- name: Generate Summary report
if: always()
run: |
python ./test/lib/execution_summary.py artifacts \
-o artifacts/collective_robot_results/output.xml \
-r ./test/reference.md \
-m summary_report.md
- name: Print E2E Report
if: always()
run: cat summary_report.md >> $GITHUB_STEP_SUMMARY
- name: Archieve consolidated test results
if: always()
uses: actions/upload-artifact@v4
with:
name: consolidated-reports
path: artifacts/collective_robot_results