Skip to content

Commit e7a0c2f

Browse files
committed
Update ci.yml to use -Werror and -fsanitize.
1 parent 619da33 commit e7a0c2f

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

.github/workflows/ci.yml

+32-14
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,47 @@ jobs:
1313
steps:
1414
- name: Clone This Repo
1515
uses: actions/checkout@v2
16-
- name: Build
16+
- name: Build Project
1717
run: |
18-
sudo apt-get install -y lcov
19-
cmake -S test -B build/ \
18+
CFLAGS=" --coverage -O0 -Wall -Wextra -Werror"
19+
CFLAGS+=" -DFORTIFY_SOURCE=1"
20+
CFLAGS+=" -fsanitize=address"
21+
CFLAGS+=" -fsanitize=pointer-compare -fsanitize=pointer-subtract"
22+
CFLAGS+=" -fsanitize=undefined"
23+
CFLAGS+=" -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict"
24+
cmake -S test -B build \
2025
-G "Unix Makefiles" \
2126
-DCMAKE_BUILD_TYPE=Debug \
22-
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
23-
make -C build/ all
24-
- name: Test
27+
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
28+
-DCMAKE_C_FLAGS="$CFLAGS"
29+
make -C build all
30+
- name: Run with Address Sanitizer
2531
run: |
26-
cd build/
32+
pushd build
2733
ctest -E system --output-on-failure
28-
cd ..
29-
- name: Run Coverage
34+
make coverage
35+
popd
36+
- name: Test for Coverage
3037
run: |
31-
make -C build/ coverage
38+
sudo apt-get install -y lcov
39+
CFLAGS=" --coverage -O0 -Wall -Wextra -Werror"
40+
CFLAGS+=" -DFORTIFY_SOURCE=0"
41+
CFLAGS+=" -DNDEBUG"
42+
cmake -S test -B build_cov \
43+
-G "Unix Makefiles" \
44+
-DCMAKE_BUILD_TYPE=Debug \
45+
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
46+
-DCMAKE_C_FLAGS="$CFLAGS"
47+
make -C build_cov coverage
3248
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
49+
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build_cov/coverage.info -o build_cov/coverage.info
50+
lcov --rc lcov_branch_coverage=1 --list build_cov/coverage.info
3551
- name: Check Coverage
3652
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
3753
with:
38-
path: ./build/coverage.info
54+
line-coverage-min: 100
55+
branch-coverage-min: 100
56+
path: ./build_cov/coverage.info
3957
complexity:
4058
runs-on: ubuntu-latest
4159
steps:
@@ -118,7 +136,7 @@ jobs:
118136
- name: Install Python3
119137
uses: actions/setup-python@v2
120138
with:
121-
python-version: '3.7.10'
139+
python-version: '3.8'
122140
- name: Measure sizes
123141
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
124142
with:

0 commit comments

Comments
 (0)