@@ -13,29 +13,58 @@ jobs:
1313 steps :
1414 - name : Clone This Repo
1515 uses : actions/checkout@v2
16- - name : Build
16+ - name : Build with Sanitizers
1717 run : |
18- sudo apt-get install -y lcov
19- cmake -S test -B build/ \
18+ sudo apt-get install -y cmake lcov
19+ CFLAGS=" --coverage -O0 -Wall -Wextra"
20+ CFLAGS+=" -Werror -Wno-error=pedantic"
21+ CFLAGS+=" -D_FORTIFY_SOURCE=2"
22+ CFLAGS+=" -Wformat"
23+ CLFAGS+=" -Wformat-security"
24+ CFLAGS+=" -Warray-bounds"
25+ CFLAGS+=" -fsanitize=address,undefined"
26+ CFLAGS+=" -fsanitize=pointer-compare -fsanitize=pointer-subtract"
27+ CFLAGS+=" -fsanitize-recover=undefined"
28+ CFLAGS+=" -fsanitize-address-use-after-scope"
29+ CFLAGS+=" -fsanitize-undefined-trap-on-error"
30+ CFLAGS_=" -fstack-protector-all"
31+ cmake -S test -B build \
2032 -G "Unix Makefiles" \
2133 -DCMAKE_BUILD_TYPE=Debug \
22- -DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
23- make -C build/ all
24- - name : Test
34+ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
35+ -DCMAKE_C_FLAGS="${CFLAGS}"
36+ make -C build all
37+ - name : Run Tests with Sanitizers
2538 run : |
26- cd build/
39+ cd build
40+ make coverage
2741 ctest -E system --output-on-failure
2842 cd ..
29- - name : Run Coverage
43+ - name : Build Tests for Coverage
3044 run : |
31- make -C build/ coverage
45+ CFLAGS=" --coverage -O0 -Wall -Wextra"
46+ CFLAGS+=" -Werror -Wno-error=pedantic"
47+ CFLAGS+=" -DFORTIFY_SOURCE=0"
48+ CFLAGS+=" -DNDEBUG"
49+ cmake -S test -B build_cov \
50+ -G "Unix Makefiles" \
51+ -DCMAKE_BUILD_TYPE=Debug \
52+ -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
53+ -DCMAKE_C_FLAGS="${CFLAGS}"
54+ make -C build_cov all
55+ - name : Run Tests for Coverage
56+ run : |
57+ cd build_cov
58+ make coverage
59+ ctest -E system --output-on-failure
60+ cd ..
3261 declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*3rdparty\*")
33- echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build /coverage.info -o build /coverage.info
34- lcov --rc lcov_branch_coverage=1 --list build /coverage.info
62+ echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build_cov /coverage.info -o build_cov /coverage.info
63+ lcov --rc lcov_branch_coverage=1 --list build_cov /coverage.info
3564 - name : Check Coverage
3665 uses : FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
3766 with :
38- path : ./build /coverage.info
67+ path : ./build_cov /coverage.info
3968 complexity :
4069 runs-on : ubuntu-latest
4170 steps :
0 commit comments