Skip to content

Commit

Permalink
Update ci.yml to use -Werror and -fsanitize.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbartell committed Apr 28, 2021
1 parent 619da33 commit e7a0c2f
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,47 @@ jobs:
steps:
- name: Clone This Repo
uses: actions/checkout@v2
- name: Build
- name: Build Project
run: |
sudo apt-get install -y lcov
cmake -S test -B build/ \
CFLAGS=" --coverage -O0 -Wall -Wextra -Werror"
CFLAGS+=" -DFORTIFY_SOURCE=1"
CFLAGS+=" -fsanitize=address"
CFLAGS+=" -fsanitize=pointer-compare -fsanitize=pointer-subtract"
CFLAGS+=" -fsanitize=undefined"
CFLAGS+=" -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,bounds-strict"
cmake -S test -B build \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS='--coverage -Wall -Wextra -DNDEBUG'
make -C build/ all
- name: Test
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="$CFLAGS"
make -C build all
- name: Run with Address Sanitizer
run: |
cd build/
pushd build
ctest -E system --output-on-failure
cd ..
- name: Run Coverage
make coverage
popd
- name: Test for Coverage
run: |
make -C build/ coverage
sudo apt-get install -y lcov
CFLAGS=" --coverage -O0 -Wall -Wextra -Werror"
CFLAGS+=" -DFORTIFY_SOURCE=0"
CFLAGS+=" -DNDEBUG"
cmake -S test -B build_cov \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="$CFLAGS"
make -C build_cov coverage
declare -a EXCLUDE=("\*test\*" "\*CMakeCCompilerId\*" "\*mocks\*" "\*3rdparty\*")
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build/coverage.info -o build/coverage.info
lcov --rc lcov_branch_coverage=1 --list build/coverage.info
echo ${EXCLUDE[@]} | xargs lcov --rc lcov_branch_coverage=1 -r build_cov/coverage.info -o build_cov/coverage.info
lcov --rc lcov_branch_coverage=1 --list build_cov/coverage.info
- name: Check Coverage
uses: FreeRTOS/CI-CD-Github-Actions/coverage-cop@main
with:
path: ./build/coverage.info
line-coverage-min: 100
branch-coverage-min: 100
path: ./build_cov/coverage.info
complexity:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -118,7 +136,7 @@ jobs:
- name: Install Python3
uses: actions/setup-python@v2
with:
python-version: '3.7.10'
python-version: '3.8'
- name: Measure sizes
uses: FreeRTOS/CI-CD-Github-Actions/memory_statistics@main
with:
Expand Down

0 comments on commit e7a0c2f

Please sign in to comment.