diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24d627f7..a7039924 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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: