forked from FreeRTOS/CI-CD-Github-Actions
-
Notifications
You must be signed in to change notification settings - Fork 0
342 lines (294 loc) · 10.6 KB
/
test.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
name: Test Actions
on:
push:
branches: ["**"]
pull_request:
branches: [main,v2]
workflow_dispatch:
env:
# The bash escape character is \033
bashPass: \033[32;1mPASSED -
bashInfo: \033[33;1mINFO -
bashFail: \033[31;1mFAILED -
bashEnd: \033[0m
jobs:
test-format-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
path: coreMQTT
- name: Test formatting check action
uses: ./formatting
with:
path: coreMQTT
exclude-dirs: build,docs
test-complexity-check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- name: Test complexity check action
uses: ./complexity
with:
path: coreMQTT
# The default threshold for all repos is 10 but coreMQTT requires 12.
horrid_threshold: 12
test-doxygen-zip-check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: aws/aws-iot-device-sdk-embedded-C
submodules: recursive
ref: main
path: aws-iot-device-sdk-embedded-C
- name: Test doxygen build action
uses: ./doxygen
with:
path: ./aws-iot-device-sdk-embedded-C
libs_parent_dir_path: libraries/standard,libraries/aws
generate_zip: true
test-doxygen-non-zip-check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- name: Test doxygen build action
uses: ./doxygen
with:
path: coreMQTT
test-spell-check:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- name: Test spell check action
uses: ./spellings
with:
path: coreMQTT
test-spell-checker-find-mistake:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- name: Empty the lexicon
shell: bash
working-directory: coreMQTT
run: file=$(find . -name .cSpellWords.txt); readlink -f "$file" ; > "$file"
- name: Test Spell Check Fails on Misspelled Word
continue-on-error: true
id: test-spellings-find-mistake
uses: ./spellings
with:
path: coreMQTT
- env:
stepName: Check Failure Test Case
name: ${{ env.stepName }}
id: check-failure-test-cases
shell: bash
run: |
# ${{ env.stepName }}
exitStatus=0
if [ "${{ steps.test-spellings-find-mistake.outcome}}" = "failure" ]; then
echo -e "${{ env.bashPass }} Functional | Failure | Fail on Misspelled Word | Had Expected "failure" ${{ env.bashEnd }}"
else
echo -e "${{ env.bashFail }} Functional | Failure | Fail on Misspelled Word | Had Unexpected "success" ${{ env.bashEnd }}"
exitStatus=1
fi
exit $exitStatus
test-coverage-cop:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
repository: FreeRTOS/coreMQTT
ref: main
path: coreMQTT
- env:
stepName: Build Core MQTT
name: ${{ env.stepName }}
run: |
# ${{ env.stepName }}
exitStatus=0
echo -e "::group::Install Lcov"
sudo apt-get install -y lcov
echo -e "::endgroup::"
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
cmake -S ./coreMQTT/test -B build/ \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_CLONE_SUBMODULES=ON \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -Werror -DNDEBUG -DLIBRARY_LOG_LEVEL=LOG_DEBUG'
make -C build/ all
exitStatus=$?
echo -e "::endgroup::"
# Only get to here if we passed the build
echo -e "${{ env.bashPass }} ${{ env.stepName }} ${{ env.bashEnd }}"
- name: Run CTest for CoreMQTT
run: ctest --test-dir build -E system --output-on-failure
- env:
stepName: Passing Coverage Test
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::Build Coverage for coreMQTT"
make -C build/ coverage
echo -e "::endgroup::"
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
declare -a EXCLUDE=("\*test/\*" "\*CMakeCCompilerId\*" "\*mocks\*")
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 --remove build/coverage.info -o build/coverage.info
echo -e "::endgroup::"
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}"
- name: Test Coverage Cop Action
id: success-coverage-cop
uses: ./coverage-cop
with:
coverage-file: ./build/coverage.info
branch-coverage-min: 70
line-coverage-min: 100
- env:
stepName: Create Lower Branch and Line Coverage Report
id: failure-coverage-action
continue-on-error: true
shell: bash
run: |
# ${{ env.stepName }}
echo -e "::group::Build Coverage for coreMQTT"
make -C build/ clean
make -C build/ coverage
echo -e "::endgroup::"
echo -e "::group::${{ env.bashInfo }} ${{ env.stepName }} ${{ env.bashEnd }}"
declare -a EXCLUDE=("\*test/\*")
set +e
lcov --directory build/ --base-directory build/ --initial --capture --rc lcov_branch_coverage=1 --output-file=build/base_coverage.info
lcov --base-directory build/ --directory build/ --add-tracefile build/base_coverage.info --add-tracefile build/second_coverage.info --output-file build/coverage.info --rc lcov_branch_coverage=1
echo -e "::endgroup::"
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
set -e
echo -e "${{ env.bashPass }} ${{env.stepName }} ${{ env.bashEnd }}"
- name: Functional | Failure | Coverage Cop Failure Test Case
id: failure-coverage-cop-action
continue-on-error: true
uses: ./coverage-cop
with:
coverage-file: ./build/coverage.info
branch-coverage-min: 100
line-coverage-min: 100
- env:
stepName: Check Failure Test Case
name: ${{ env.stepName }}
if: success() || failure()
id: check-failure-test-cases
shell: bash
run: |
# ${{ env.stepName }}
exitStatus=0
if [ "${{ steps.failure-coverage-cop-action.outcome }}" = "failure" ]; then
echo -e "${{ env.bashPass }} Functional | Failure | Coverage Cop Failure Test Case | Had Expected "failure" ${{ env.bashEnd }}"
else
echo -e "${{ env.bashFail }} Functional | Failure | Coverage Cop Failure Test Case | Had Unexpected "success" ${{ env.bashEnd }}"
exitStatus=1
fi
exit $exitStatus
test-memory-statistics:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Test memory statistics action
uses: ./memory_statistics
with:
path: memory_statistics/test
config: ./memory_statistics_config.json
output: ./size_table_new.html
check_against: ./size_table_expected.html
test-link-verifier:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Setup python environment
uses: actions/[email protected]
- env:
stepName: "Functional | Success | Link Verifier Works & Excludes Directory"
name: ${{ env.stepName }}
id: link-verifier-success-case
uses: ./link-verifier
with:
path: ./
exclude-dirs: complexity, formatting, badFiles
allowlist-file: link-verifier/badUrls.md
- env:
stepName: "Functional | Success | Links being Excluded"
name: ${{ env.stepName }}
id: link-verifier-exclude-url-success-case
uses: ./link-verifier
with:
path: ./
exclude-dirs: complexity, formatting
exclude-urls: https://dummy-url.com/ota.bin, https://dummy-url.com/ota.com, https://dummy-url-three.com/ota.bin, https://github.com/FreeRTOS/A-Repo-That-Wins-You-The-Lottery
- env:
stepName: "Functional | Failure | Link Does Not Exist"
name: ${{ env.stepName }}
id: link-verifier-fail-case
continue-on-error: true
uses: ./link-verifier
with:
path: ./
exclude-dirs: complexity, formatting
allowlist-file: badUrls.md
- env:
stepName: Check Failure Test Case
name: ${{ env.stepName }}
id: check-failure-test-cases
shell: bash
run: |
# ${{ env.stepName }}
exitStatus=0
if [ "${{ steps.link-verifier-fail-case.outcome}}" = "failure" ]; then
echo -e "${{ env.bashPass }} Functional | Failure | Link Does Not Exist | Had Expected "failure" ${{ env.bashEnd }}"
else
echo -e "${{ env.bashFail }} Functional | Failure | Link Does Not Exist | Had Unexpected "success" ${{ env.bashEnd }}"
exitStatus=1
fi
exit $exitStatus
test-manifest-verifier:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Setup python environment
uses: actions/[email protected]
- name: Checkout the FreeRTOS/FreeRTOS repository for testing action on.
uses: actions/[email protected]
with:
repository: FreeRTOS/FreeRTOS
ref: '202107.00'
path: FreeRTOS
submodules: recursive
- name: Test manifest verifier
uses: ./manifest-verifier
with:
path: ./FreeRTOS
exclude-submodules: FreeRTOS-Plus/Test/CMock,FreeRTOS/Test/CMock/CMock,FreeRTOS/Test/litani
fail-on-incorrect-version: true