-
Notifications
You must be signed in to change notification settings - Fork 0
1916 lines (1684 loc) · 75 KB
/
Copy pathci.yml
File metadata and controls
1916 lines (1684 loc) · 75 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
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
build-linux-gcc:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset debug
- name: Build and test
run: cmake --build --preset debug --target junit BddTargetTests
- name: Run BDD target tests
run: cd build/debug && ./Tests/Bdd/Targets/BddTargetTests -ojunit -k BddTargetTests
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (GCC)
path: build/debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-build-linux-gcc
path: build/debug/cpputest_*.xml
retention-days: 1
integration-linux-openssl:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset debug
- name: Build integration tests
run: cmake --build --preset debug --target OpenSslIntegrationTests
- name: Run integration tests
run: cd build/debug && ./Tests/OpenSslIntegration/OpenSslIntegrationTests -v -ojunit -k OpenSslIntegrationTests
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (OpenSSL Integration)
path: build/debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-integration-linux-openssl
path: build/debug/cpputest_*.xml
retention-days: 1
integration-linux-mbedtls:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
# cpputest-freertos image carries /opt/mbedtls (and exports MBEDTLS_DIR);
# Tests/MbedTlsIntegration/CMakeLists.txt requires that env var.
container:
image: ghcr.io/cososo-ltd/cpputest-freertos@sha256:476cfeab90e8179ab909dba8c77c8e9ef3b594e67ba98dca39108747583f5c41 # sha-ad10bf2
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset debug
- name: Build integration tests
run: cmake --build --preset debug --target MbedTlsIntegrationTests
- name: Run integration tests
run: cd build/debug && ./Tests/MbedTlsIntegration/MbedTlsIntegrationTests -v -ojunit -k MbedTlsIntegrationTests
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (mbedTLS Integration)
path: build/debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-integration-linux-mbedtls
path: build/debug/cpputest_*.xml
retention-days: 1
integration-windows-openssl:
runs-on: windows-latest
permissions:
contents: read
checks: write
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Enable vcpkg binary cache
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# Cache vcpkg's classic-mode installed tree across runs and branches.
# x-gha (above) is per-workflow scope and goes cold on a fresh branch;
# actions/cache survives across branches with a static key. Bump the
# `v1` suffix to force a rebuild (e.g. when adding a package).
# C:\vcpkg is the standard VCPKG_INSTALLATION_ROOT on github-hosted
# windows runners — hardcoded here so the cache step doesn't depend
# on a runner-image-set env var (the linter can't see those).
- name: Cache vcpkg installed tree
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
# The cache is a pure speed optimisation — a flaky restore must never
# skip the build+test. actions/cache can fail mid-restore (even after
# reporting a hit); without continue-on-error that failure trips the
# default `if: success()` on every following step, so Install / Configure
# / Build-and-test all skip and the job goes red without ever compiling.
# On a miss or partial restore the `vcpkg install` below rebuilds the
# tree (backed by the x-gha binary cache), so the only cost is a slower
# run.
continue-on-error: true
with:
path: C:\vcpkg\installed
key: ${{ runner.os }}-vcpkg-cpputest-openssl-v1
- name: Install CppUTest and OpenSSL
run: |
vcpkg install cpputest openssl
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
- name: Configure
run: cmake --preset msvc-debug
- name: Build integration tests
run: cmake --build --preset msvc-debug --target OpenSslIntegrationTests
- name: Run integration tests
shell: pwsh
run: |
Set-Location build/msvc-debug/Tests/OpenSslIntegration/Debug
./OpenSslIntegrationTests.exe -v -ojunit -k OpenSslIntegrationTests
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (OpenSSL Integration Windows)
path: build/msvc-debug/Tests/OpenSslIntegration/Debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-integration-windows-openssl
path: build/msvc-debug/Tests/OpenSslIntegration/Debug/cpputest_*.xml
retention-days: 1
build-linux-tunable-override:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure with tunable override
run: cmake --preset tunable-override-debug
# The host BDD target is built here rather than against the defaults --
# see the @requires_message_size_1500 entry in docs/bdd.md.
- name: Build and test
run: cmake --build --preset tunable-override-debug --target junit SolidSyslogBddTarget
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (Tunable Override)
path: build/tunable-override-debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-build-linux-tunable-override
path: build/tunable-override-debug/cpputest_*.xml
retention-days: 1
- name: Upload BDD target binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: solid-syslog-bdd-targets
path: |
build/tunable-override-debug/Bdd/Targets/SolidSyslogBddTarget
retention-days: 1
compression-level: 0
# BDD-side mirror of build-time tunables, generated by configure_file.
# bdd-linux-syslog-ng downloads this into Bdd/features/steps/ so behave
# can `import solidsyslog_tunables` (the file is gitignored, not in checkout).
- name: Upload BDD Python tunables (Linux)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bdd-tunables-linux
path: Bdd/features/steps/solidsyslog_tunables.py
retention-days: 1
build-linux-clang:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest-clang@sha256:95e8a1b076aa2faab98af1415c89a36feaa12e0a9e42950194f9775d0ed27c35 # sha-5905aea
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset clang-debug
- name: Build and test
run: cmake --build --preset clang-debug --target junit
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (Clang)
path: build/clang-debug/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-build-linux-clang
path: build/clang-debug/cpputest_*.xml
retention-days: 1
# Proves the public claim that Core compiles as C99, then checks the POSIX and
# OpenSSL packs have not drifted off it. Library only, no tests.
# See docs/builds.md.
build-linux-c99:
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure Core at C99
run: cmake --preset c99
- name: Build Core at C99
run: cmake --build --preset c99
- name: Configure POSIX and OpenSSL packs at C99
run: cmake --preset c99-platforms
- name: Build POSIX and OpenSSL packs at C99
run: cmake --build --preset c99-platforms
# The library is C99; the code that includes its headers need not be. Compiles
# every public header standalone at -std=c89 -pedantic-errors, so an
# integrator on an older toolchain can include them. See docs/build-integration.md.
build-linux-c89-headers:
runs-on: ubuntu-latest
permissions:
contents: read
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Compile every public header as C89
run: python3 scripts/check_headers_c89.py --cc gcc
sanitize-linux-gcc:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset sanitize
- name: Build and test
run: cmake --build --preset sanitize --target junit
- name: Test Report
uses: dorny/test-reporter@a43b3a5f7366b97d083190328d2c652e1a8b6aa2 # v3.0.0
if: success() || failure()
with:
name: Test Results (Sanitize)
path: build/sanitize/cpputest_*.xml
reporter: java-junit
- name: Upload JUnit XML
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: junit-sanitize-linux-gcc
path: build/sanitize/cpputest_*.xml
retention-days: 1
coverage-linux-gcc:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset coverage
- name: Build and generate coverage report
run: cmake --build --preset coverage --target coverage
- name: Post coverage summary
run: |
echo '## Coverage Summary' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
lcov --summary build/coverage/coverage.filtered.info --rc branch_coverage=1 2>&1 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Enforce coverage thresholds
env:
LINE_THRESHOLD: 90
BRANCH_THRESHOLD: 90
run: |
SUMMARY=$(lcov --summary build/coverage/coverage.filtered.info --rc branch_coverage=1 2>&1)
LINE_COV=$(echo "$SUMMARY" | sed -n 's/.*lines\.*: \([0-9.]*\)%.*/\1/p')
BRANCH_COV=$(echo "$SUMMARY" | sed -n 's/.*branches\.*: \([0-9.]*\)%.*/\1/p')
FAIL=0
if [ -n "$LINE_COV" ]; then
echo "Line coverage: ${LINE_COV}% (threshold: ${LINE_THRESHOLD}%)"
if awk "BEGIN{exit !($LINE_COV < $LINE_THRESHOLD)}"; then
echo "FAIL: line coverage ${LINE_COV}% is below ${LINE_THRESHOLD}%"
FAIL=1
fi
else
echo "FAIL: could not determine line coverage"
FAIL=1
fi
if [ -n "$BRANCH_COV" ]; then
echo "Branch coverage: ${BRANCH_COV}% (threshold: ${BRANCH_THRESHOLD}%)"
if awk "BEGIN{exit !($BRANCH_COV < $BRANCH_THRESHOLD)}"; then
echo "FAIL: branch coverage ${BRANCH_COV}% is below ${BRANCH_THRESHOLD}%"
FAIL=1
fi
else
echo "Branch coverage: no branch data found (skipping threshold check)"
fi
exit $FAIL
# GitHub Pages now serves the docs site (see deploy-docs-pages), not the
# coverage report. The HTML report stays available as a downloadable run
# artifact for anyone who wants to inspect it; success()||failure() keeps
# it uploaded even when the threshold gate above fails, which is exactly
# when you want to read it.
- name: Upload coverage report artifact
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-report-linux-gcc
path: build/coverage/coverage_report/
retention-days: 7
analyze-tidy:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset tidy
- name: Build with clang-tidy
shell: bash
run: set -o pipefail && cmake --build --preset tidy 2>&1 | tee build/tidy/clang-tidy-output.txt
- name: Upload clang-tidy output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: clang-tidy-report
path: build/tidy/clang-tidy-output.txt
retention-days: 1
analyze-iwyu:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest-clang@sha256:95e8a1b076aa2faab98af1415c89a36feaa12e0a9e42950194f9775d0ed27c35 # sha-5905aea
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset iwyu
# IWYU is advisory: the two-pass "should add / should remove" output is
# hard to interpret correctly under time pressure, and the per-PR
# friction it causes outweighs the steady-state value (S24.13 / E24).
# Findings still surface via the uploaded artifact below; release prep
# is responsible for clearing them.
- name: Run include-what-you-use (advisory)
shell: bash
continue-on-error: true
run: set -o pipefail && cmake --build --preset iwyu --target iwyu 2>&1 | tee build/iwyu/iwyu-output.txt
- name: Upload iwyu output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: iwyu-report
path: build/iwyu/iwyu-output.txt
retention-days: 1
# Mirrors analyze-tidy but runs on cpputest-freertos so the Platform/{FreeRtos,
# PlusTcp,LwipRaw,MbedTls,FatFs} trees and their Tests/* siblings enter the
# CMake configure (gated by FREERTOS_KERNEL_PATH / MBEDTLS_DIR / LWIP_PATH /
# FATFS_PATH, all set in the freertos image). The base lane on cpputest skips
# those trees because the env vars are absent.
analyze-tidy-freertos-plustcp:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest-freertos@sha256:476cfeab90e8179ab909dba8c77c8e9ef3b594e67ba98dca39108747583f5c41 # sha-ad10bf2
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset tidy
- name: Build with clang-tidy
shell: bash
run: set -o pipefail && cmake --build --preset tidy 2>&1 | tee build/tidy/clang-tidy-output.txt
- name: Upload clang-tidy output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: clang-tidy-report-freertos-plustcp
path: build/tidy/clang-tidy-output.txt
retention-days: 1
# Same freertos coverage rationale as analyze-tidy-freertos-plustcp. Overrides
# CMAKE_C_COMPILER explicitly to clang-19 because the cpputest-freertos image
# (chained from the cpputest gcc base) ships clang-19/clang++-19 but no
# `clang`/`clang++` alternative — only the cpputest-clang image creates that
# alias. A future image bump could add the alternative to the gcc base and
# drop these overrides.
analyze-iwyu-freertos-plustcp:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest-freertos@sha256:476cfeab90e8179ab909dba8c77c8e9ef3b594e67ba98dca39108747583f5c41 # sha-ad10bf2
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset iwyu -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19
# Advisory per S24.13 — see analyze-iwyu above for rationale.
- name: Run include-what-you-use (advisory)
shell: bash
continue-on-error: true
run: set -o pipefail && cmake --build --preset iwyu --target iwyu 2>&1 | tee build/iwyu/iwyu-output.txt
- name: Upload iwyu output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: iwyu-report-freertos-plustcp
path: build/iwyu/iwyu-output.txt
retention-days: 1
# lwIP twin of analyze-tidy-freertos-plustcp. Same cpputest-freertos image and
# tidy preset, with Plus-TCP deselected so the configure exercises the lwIP
# wiring path with Platform/PlusTcp absent. Since S30.06 that is said directly
# — a platform is deselected by its own switch — rather than inferred from a
# FreeRTOS networking-backend variable. Guards the LwipRaw tree and its Tests
# under clang-tidy as a named required check.
analyze-tidy-freertos-lwip:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest-freertos@sha256:476cfeab90e8179ab909dba8c77c8e9ef3b594e67ba98dca39108747583f5c41 # sha-ad10bf2
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset tidy -DSOLIDSYSLOG_PLUSTCP=OFF
- name: Build with clang-tidy
shell: bash
run: set -o pipefail && cmake --build --preset tidy 2>&1 | tee build/tidy/clang-tidy-output.txt
- name: Upload clang-tidy output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: clang-tidy-report-freertos-lwip
path: build/tidy/clang-tidy-output.txt
retention-days: 1
# NET=LWIP twin of analyze-iwyu-freertos-plustcp — see that lane for the
# clang-19 override rationale and analyze-tidy-freertos-lwip for the NET scope.
# Advisory per S24.13.
analyze-iwyu-freertos-lwip:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest-freertos@sha256:476cfeab90e8179ab909dba8c77c8e9ef3b594e67ba98dca39108747583f5c41 # sha-ad10bf2
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset iwyu -DSOLIDSYSLOG_PLUSTCP=OFF -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19
# Advisory per S24.13 — see analyze-iwyu above for rationale.
- name: Run include-what-you-use (advisory)
shell: bash
continue-on-error: true
run: set -o pipefail && cmake --build --preset iwyu --target iwyu 2>&1 | tee build/iwyu/iwyu-output.txt
- name: Upload iwyu output
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: iwyu-report-freertos-lwip
path: build/iwyu/iwyu-output.txt
retention-days: 1
analyze-format:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check clang-format
run: |
find Core/Interface Core/Source Platform Tests Bdd/Targets -name '*.c' -o -name '*.cpp' -o -name '*.h' \
| xargs clang-format --dry-run --Werror
# README.md claims Core's implementation has no conditional compilation.
# Keep that true rather than aspirational.
- name: Assert Core's implementation has no conditional compilation
run: |
if grep -rnE '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else)' Core/Source/*.c; then
echo "::error::Core/Source/*.c must contain no conditional compilation (see README.md, Architecture)"
exit 1
fi
# A bare _Create in a comment or in Markdown stops meaning anything the
# moment the surrounding text names a second class, and the header tables
# name several per row. See docs/NAMING.md, "Writing identifiers in prose".
#
# The sed neutralises the reserved identifiers that legitimately begin _X
# before the second grep, so filtering is per match rather than per line —
# one line can carry both a legitimate _Atomic and a bare _Destroy, and
# discarding the whole line would hide the second. Tracked files only, so
# an untracked local `site/` build never trips it. NAMING.md is exempt: it
# is the one file that has to quote the form it forbids.
- name: Assert API identifiers are written in full in prose
run: |
violations=$(git ls-files '*.md' '*.c' '*.h' '*.cpp' \
| grep -v '^docs/NAMING\.md$' \
| xargs -r grep -nE '(^|[^A-Za-z0-9_>])_[A-Z][a-z]' \
| sed -E 's/_(Atomic|Bool|Static_assert|Noreturn|Thread_local|Generic|Alignas|Alignof|Complex|Imaginary|Pragma|Exit)\b/KEYWORD/g' \
| grep -E '(^|[^A-Za-z0-9_>])_[A-Z][a-z]' \
| cut -d: -f1,2)
if [ -n "$violations" ]; then
echo "$violations"
echo "::error::Write API identifiers in full in prose — SolidSyslogFoo_Create, or <Class>_Create for a pattern-level statement (see docs/NAMING.md, 'Writing identifiers in prose')"
exit 1
fi
# Asserts every shipped source file carries the licence header, and that none
# of them claims anyone else's copyright. Both halves matter: the header is
# the only statement of terms that travels with a file copied out of the tree
# by a Path B integrator, and the no-third-party-code invariant in Core/ and
# Platform/ is what makes it safe to stamp our copyright across all of them.
# Pure file scan, no toolchain — runs in about a second.
analyze-spdx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check licence headers
run: python3 scripts/check_spdx_headers.py
analyze-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Same pinned engine (markdownlint-cli2 v0.22.1) used locally and by
# CodeRabbit. Config + ignores come from .markdownlint-cli2.jsonc.
- name: Lint markdown
run: |
docker run --rm -v "$PWD:/workdir" \
davidanson/markdownlint-cli2@sha256:0ed9a5f4c77ef447da2a2ac6e67caf74b214a7f80288819565e8b7d2ac148fe5
# Builds the MkDocs + mkdoxy documentation site with the pinned toolchain
# image (see docs/containers.md) so the site cannot silently rot. Runs on every
# PR as a required check; on main it also stages the built site as the Pages
# artifact for the deploy-docs-pages job to publish. PRs build but never deploy.
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Platforms are declared in SOLIDSYSLOG_PLATFORM_REGISTRY and roles by
# their Core/Interface/SolidSyslog<Role>Definition.h header. This asserts
# the docs enumerate exactly what the code declares — a platform's pages,
# nav entry, description and matrix row; a role's link from the porting
# guide, the roles index and the nav — and the reverse in both cases. It
# also holds the three boundaries hand review kept losing: no platform
# names another, every class a platform declares carries its registry
# token, and every class a platform ships is on its page.
- name: Check the docs match what the code declares
run: python3 scripts/check_platform_docs.py
# A path written in code font in a sentence, or in a CMake list, a
# Compose mount or a path filter, is text nothing reads back out — the
# link check below sees Markdown links only. Nor does anything read back
# the library symbols a page names, in prose or in a fenced example. This
# asserts both still exist, so a rename cannot leave a green reference to
# nothing, and a page cannot offer an integrator a symbol that never
# compiled.
- name: Check the paths and symbols documents and build files name exist
run: python3 scripts/check_references.py
# Guard the build hooks against regression — the source-link rewrite's
# Markdown parsing, and the meta-description map's nav validation.
# Image digest below is mkdocs-mkdoxy sha-34173c0 (see docs/containers.md).
- name: Test docs build hooks
run: |
docker run --rm -v "$PWD:/docs" \
ghcr.io/cososo-ltd/mkdocs-mkdoxy@sha256:9ab3d41807a941f3d5a7077fb7288d0ffe2a926729ce13a4fc889cc8b6630d43 \
python3 -m unittest discover -s /docs/hooks -p 'test_*.py'
# --strict fails the build on broken nav, config, or links. Out-of-docs
# source links (../Core/…, ../SECURITY.md) are rewritten to canonical
# GitHub URLs by hooks/source_links.py, so not_found validation is fatal;
# the api/ reference is generated from Core/Interface/*.h by mkdoxy.
# Image digest below is mkdocs-mkdoxy sha-34173c0 (see docs/containers.md).
- name: Build docs site
run: |
docker run --rm -v "$PWD:/docs" \
ghcr.io/cososo-ltd/mkdocs-mkdoxy@sha256:9ab3d41807a941f3d5a7077fb7288d0ffe2a926729ce13a4fc889cc8b6630d43 \
mkdocs build --strict
- name: Upload site artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: docs-site
path: site/
retention-days: 7
# On main only, restage the built site as the GitHub Pages artifact so
# deploy-docs-pages can publish it. PRs stop at the build+artifact above.
- name: Upload Pages artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site/
# Publishes the built docs site to GitHub Pages. Main-only; PRs never deploy.
# GitHub Pages permits a single deployment to the github-pages environment, so
# the pages concurrency group serialises overlapping main pushes.
deploy-docs-pages:
needs: docs-build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
pages: write # to deploy the built site to GitHub Pages
id-token: write # to verify the deployment originates from this workflow
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
analyze-cppcheck:
runs-on: ubuntu-latest
container:
image: ghcr.io/cososo-ltd/cpputest@sha256:68e7fbb6f02996717ce9211fd8089a0c52763da4990dfe69653c00ad697551b9 # sha-6715942
options: --user root
env:
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: safe.directory
GIT_CONFIG_VALUE_0: '*'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Configure
run: cmake --preset cppcheck
- name: Build with cppcheck
run: cmake --build --preset cppcheck
- name: Generate cppcheck XML report
if: success() || failure()
run: >
cppcheck
--enable=warning,style,performance,portability
--suppress=missingIncludeSystem
--suppressions-list=cppcheck_suppressions_tests.txt
--inline-suppr
--std=c11
-DLWIP_DNS=1
-DLWIP_UDP=1
-DLWIP_TCP=1
-DconfigSUPPORT_STATIC_ALLOCATION=1
-DconfigUSE_MUTEXES=1
-DipconfigUSE_TCP=1
-ICore/Interface
-IPlatform/StdAtomic/Interface
-IPlatform/Posix/Interface
-IPlatform/Windows/Interface
-IPlatform/OpenSsl/Interface
-IPlatform/MbedTls/Interface
-IPlatform/FreeRtos/Interface
-IPlatform/PlusTcp/Interface
-IPlatform/LwipRaw/Interface
-IPlatform/FatFs/Interface
-IPlatform/PlusFat/Interface
--xml --xml-version=2
Core/Source/
Platform/StdAtomic/Source/
Platform/Posix/Source/
Platform/Windows/Source/
Platform/OpenSsl/Source/
Platform/MbedTls/Source/
Platform/FreeRtos/Source/
Platform/PlusTcp/Source/
Platform/LwipRaw/Source/
Platform/FatFs/Source/
Platform/PlusFat/Source/
2> build/cppcheck/cppcheck-report.xml
- name: Upload cppcheck report
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cppcheck-report
path: build/cppcheck/cppcheck-report.xml
retention-days: 1
# ----------------------------------------------------------------
# cppcheck-misra addon — runs the MISRA C:2012 addon over Strict +
# Pragmatic tiers (Core/Source/ + Platform/*/Source/). Findings
# fail CI (--error-exitcode=1); suppressions live in
# misra_suppressions.txt with rationales in docs/misra-deviations.md.
# ----------------------------------------------------------------
- name: Run cppcheck-misra
if: success() || failure()
run: >
cppcheck
--addon=misra
--suppressions-list=misra_suppressions.txt
--error-exitcode=1
--inline-suppr
--std=c11
-DLWIP_DNS=1
-DLWIP_UDP=1
-DLWIP_TCP=1
-DconfigSUPPORT_STATIC_ALLOCATION=1
-DconfigUSE_MUTEXES=1
-DipconfigUSE_TCP=1
-ICore/Interface
-IPlatform/StdAtomic/Interface
-IPlatform/Posix/Interface
-IPlatform/Windows/Interface
-IPlatform/OpenSsl/Interface
-IPlatform/MbedTls/Interface
-IPlatform/FreeRtos/Interface
-IPlatform/PlusTcp/Interface
-IPlatform/LwipRaw/Interface
-IPlatform/FatFs/Interface
-IPlatform/PlusFat/Interface
Core/Source/
Platform/StdAtomic/Source/
Platform/Posix/Source/
Platform/Windows/Source/
Platform/OpenSsl/Source/
Platform/MbedTls/Source/
Platform/FreeRtos/Source/
Platform/PlusTcp/Source/
Platform/LwipRaw/Source/
Platform/FatFs/Source/
Platform/PlusFat/Source/
- name: Generate cppcheck-misra XML report
if: success() || failure()
run: |
mkdir -p build/cppcheck-misra
cppcheck \
--addon=misra \
--suppressions-list=misra_suppressions.txt \
--error-exitcode=1 \
--inline-suppr \
--std=c11 \
-DLWIP_DNS=1 \
-DLWIP_UDP=1 \
-DLWIP_TCP=1 \
-DconfigSUPPORT_STATIC_ALLOCATION=1 \
-DconfigUSE_MUTEXES=1 \
-DipconfigUSE_TCP=1 \
-ICore/Interface \