-
Notifications
You must be signed in to change notification settings - Fork 57
345 lines (308 loc) · 11.6 KB
/
packchk.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
name: packchk
on:
workflow_call:
push:
branches:
- main
paths:
- '.github/workflows/packchk.yml'
- '.github/workflows/unit_test_results.yml'
- '.github/matrix_includes_packchk.json'
- 'CMakeLists.txt'
- 'tools/packchk/**'
- 'libs/xml**'
- 'libs/rte**'
- 'external/cxxopts'
- 'external/cxxopts.patch'
- 'external/xerces-c'
- 'external/xerces-c.patch'
- '!**/docs/**/*'
- '!**/*.md'
pull_request:
paths:
- '.github/workflows/packchk.yml'
- '.github/workflows/unit_test_results.yml'
- '.github/matrix_includes_packchk.json'
- 'CMakeLists.txt'
- 'tools/packchk/**'
- 'libs/xml**'
- 'libs/rte**'
- 'external/cxxopts'
- 'external/cxxopts.patch'
- 'external/xerces-c'
- 'external/xerces-c.patch'
- '!**/docs/**/*'
- '!**/*.md'
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_setup_env.yml@main
with:
run_if: ${{ fromJSON((github.event_name == 'pull_request') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/packchk/')) || ((github.event.schedule != '') && (!github.event.repository.private))) }}
matrix_prep:
needs: setup
uses: Open-CMSIS-Pack/devtools/.github/workflows/shared_matrix_prep.yml@main
with:
workflow_name: packchk
build:
needs: [ setup, matrix_prep ]
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 15
strategy:
fail-fast: true
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: recursive
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build packchk
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
target: packchkdist
arch: ${{ matrix.arch }}
- name: Archive packchk binary
if: ${{ github.event_name != 'release' }}
uses: actions/upload-artifact@v3
with:
name: packchk-${{ matrix.target }}-${{ matrix.arch }}
path: build/tools/packchk/packchk-*-${{ matrix.target }}-${{ matrix.arch }}.*
retention-days: ${{ needs.setup.outputs.retention_days }}
if-no-files-found: error
- name: Attach zipped binary to the release
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/tools/packchk/packchk-*-${{ matrix.target }}-${{ matrix.arch }}.*
test:
needs: [ setup, matrix_prep ]
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
steps:
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: recursive
- name: Testspace client install & config
if: ${{ !github.event.repository.private }}
uses: testspace-com/setup-testspace@v1
with:
domain: ${{github.repository_owner}}
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build PackChkUnitTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
arch: ${{ matrix.arch }}
build_type: Debug
target: PackChkUnitTests
- name: Run packchk unit tests
if: matrix.arch != 'arm64'
run: |
ctest -V -R PackChkUnitTests
working-directory: ./build
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build PackChkIntegTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
arch: ${{ matrix.arch }}
build_type: Debug
target: PackChkIntegTests
- name: Run packchk integ tests
if: matrix.arch != 'arm64'
run: |
ctest -V -R PackChkIntegTests
working-directory: ./build
- name: Archive unit test results
if: always() && (matrix.arch != 'arm64')
uses: actions/upload-artifact@v3
with:
name: unit_test_result-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/test_reports/packchkunittests-*.xml
if-no-files-found: error
retention-days: ${{ needs.setup.outputs.retention_days }}
- name: Archive integration test results
if: always() && (matrix.arch != 'arm64')
uses: actions/upload-artifact@v3
with:
name: integ_test_result-${{ matrix.target }}-${{ matrix.arch }}
path: ./build/test_reports/packchkintegtests-*.xml
if-no-files-found: error
retention-days: ${{ needs.setup.outputs.retention_days }}
- name: Testspace push test content
if: ${{ (!github.event.repository.private) && always() && (matrix.arch != 'arm64') }}
run: |
testspace "[${{ github.workflow }} / Test Report/ ${{ matrix.target }}-${{ matrix.arch }}]./build/test_reports/packchkunittests-*.xml"
testspace "[${{ github.workflow }} / Test Report/ ${{ matrix.target }}-${{ matrix.arch }}]./build/test_reports/packchkintegtests-*.xml"
coverage:
if: |
(github.event_name == 'pull_request') ||
(github.event_name == 'push') ||
(github.event_name == 'release' && startsWith(github.ref, 'refs/tags/tools/packchk/')) ||
((github.event.schedule != '') && (!github.event.repository.private))
env:
lcov_base: https://github.com/linux-test-project/lcov/releases/download/v1.15/
lcov_installer: lcov-1.15.tar.gz
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install \
lcov
- name: Checkout devtools
uses: actions/checkout@v3
with:
submodules: recursive
- name: Testspace client install & config
if: ${{ !github.event.repository.private }}
uses: testspace-com/setup-testspace@v1
with:
domain: ${{github.repository_owner}}
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build PackChkUnitTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
add_cmake_variables: -DCOVERAGE=ON
arch: amd64
build_type: Debug
target: PackChkUnitTests
# https://github.com/Open-CMSIS-Pack/devtools-build-action
- name: Build PackChkIntegTests
uses: Open-CMSIS-Pack/devtools-build-action@arm64
with:
add_cmake_variables: -DCOVERAGE=ON
arch: amd64
build_type: Debug
target: PackChkIntegTests
- name: Run packchk tests
run: |
ctest -V -C Debug -R PackChkUnitTests
ctest -V -C Debug -R PackChkIntegTests
working-directory: ./build
- name: Get retention days
id: var
run: |
echo "retention_days=$(echo '${{ (!github.event.repository.private && (github.event_name == 'push' || github.event.schedule != '')) && '7' || '1' }}')" >> $GITHUB_OUTPUT
- name: Archive unit test results
if: (github.event_name == 'push')
uses: actions/upload-artifact@v3
with:
name: unit_test_result-linux-amd64
path: ./build/test_reports/packchkunittests-*.xml
if-no-files-found: error
retention-days: ${{ steps.var.outputs.retention_days }}
- name: Archive integration test results
if: (github.event_name == 'push')
uses: actions/upload-artifact@v3
with:
name: integ_test_result-linux-amd64
path: ./build/test_reports/packchkintegtests-*.xml
if-no-files-found: error
retention-days: ${{ steps.var.outputs.retention_days }}
# Needs to be removed once the bug is resolved
# lcov reporting 1.14 on 1.15 version
# https://groups.google.com/g/linux.debian.bugs.dist/c/a9SZGCENJ2s?pli=1
- name: Setup lcov1.15
run: |
wget -q ${{ env.lcov_base }}/${{ env.lcov_installer }}
tar -xvf ${{ env.lcov_installer }}
working-directory: ./build/tools/packchk
- name: Generate coverage report
run: |
lcov-1.15/bin/lcov --rc lcov_branch_coverage=1 --rc geninfo_no_exception_branch=1 -c --directory . --output-file full_coverage.info
lcov-1.15/bin/lcov --rc lcov_branch_coverage=1 --rc geninfo_no_exception_branch=1 -e full_coverage.info '*/tools/packchk/include/*' '*/tools/packchk/src/*' -o coverage_packchk.info
genhtml coverage_packchk.info --output-directory coverage_packchk --branch-coverage
working-directory: ./build/tools/packchk
# testspace changes start
- name: Set up Python
if: ${{ !github.event.repository.private }}
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
if: ${{ !github.event.repository.private }}
run: |
python -m pip install --upgrade pip
pip install lcov_cobertura
- name: Convert to xml
if: ${{ !github.event.repository.private }}
run: |
lcov_cobertura ./build/tools/packchk/coverage_packchk.info
- name: Testspace push coverage
if: ${{ !github.event.repository.private }}
run: |
testspace "[${{ github.workflow }} / Code Coverage]./coverage.xml"
# testspace changes start
- name: Upload Report to Codecov
if: ${{ !github.event.repository.private }}
uses: Wandalen/[email protected]
with:
action: codecov/codecov-action@v3
with: |
files: ./build/tools/packchk/coverage_packchk.info
fail_ci_if_error: true
flags: packchk-cov
functionalities: fix
attempt_limit: 3
attempt_delay: 5000
- name: Archive coverage report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: |
./build/tools/packchk/coverage_packchk/
./build/tools/packchk/coverage_packchk.info
retention-days: ${{ steps.var.outputs.retention_days }}
if-no-files-found: error
release:
if: |
github.event_name == 'release' &&
startsWith(github.ref, 'refs/tags/tools/packchk/')
needs: [ build, test, coverage ]
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- name: Checkout devtools
uses: actions/checkout@v3
- name: Create distribution folders
run: |
mkdir -p tools/packchk/distribution/
- name: Download coverage report
uses: actions/download-artifact@v3
with:
name: coverage-report
path: tools/packchk/distribution/coverage/
- name: Zip distribution folder
run: zip -r code-coverage.zip *
working-directory: tools/packchk/distribution
- name: Attach zip archive to release assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: tools/packchk/distribution/code-coverage.zip
tag: ${{ github.ref }}
overwrite: true
asset_name: code-coverage.zip
test-results-preparation:
name: "Publish Tests Results"
needs: [ test ]
runs-on: ubuntu-22.04
steps:
- name: Event File
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}