From b74dc64a37f594c0c7d6f41fb3f1a2aea1cedab7 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Mon, 25 Mar 2024 14:21:47 +0100 Subject: [PATCH] codecov --- .ci_support/run_docker_linux.sh | 9 ++++++++- .github/workflows/build.yml | 7 +++++++ README.rst | 3 +++ codecov.yml | 6 ++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 codecov.yml diff --git a/.ci_support/run_docker_linux.sh b/.ci_support/run_docker_linux.sh index a631d17..19c8cb4 100755 --- a/.ci_support/run_docker_linux.sh +++ b/.ci_support/run_docker_linux.sh @@ -6,7 +6,7 @@ cd /tmp mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=~/.local \ -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=32 \ - -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -D_GLIBCXX_ASSERTIONS" \ + -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror -D_GLIBCXX_ASSERTIONS --coverage" \ -DSWIG_COMPILE_FLAGS="-O1 -Wno-unused-parameter" \ -DSPHINX_FLAGS="-W -T -j4" \ /io @@ -14,6 +14,13 @@ make install make tests ctest --output-on-failure --timeout 100 ${MAKEFLAGS} +# coverage +gcov `find lib/src/ -name "*.gcno"` +lcov --capture --directory ./lib/src/ -o coverage.info +lcov --remove coverage.info "/usr/include/*" -o coverage.info +genhtml coverage.info --output-directory ~/.local/share/doc/*/html/coverage +cp -v coverage.info ~/.local/share/doc/*/html/coverage + uid=$1 gid=$2 if test -n "${uid}" -a -n "${gid}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2a1abd..59b7d7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,13 @@ jobs: git add -A . git commit -a -m "GitHub Actions build ${GITHUB_REPOSITORY} ${GITHUB_RUN_ID}" || exit 0 git push --quiet origin master > /dev/null 2>&1 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: openturns/otsvm + file: ./html/coverage/coverage.info + verbose: true mingw: runs-on: ubuntu-latest diff --git a/README.rst b/README.rst index b55d71f..116ba3f 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,9 @@ .. image:: https://github.com/openturns/otsvm/actions/workflows/build.yml/badge.svg?branch=master :target: https://github.com/openturns/otsvm/actions/workflows/build.yml +.. image:: https://codecov.io/gh/openturns/otsvm/graph/badge.svg?token=A7L8E5O0W2 + :target: https://codecov.io/gh/openturns/otsvm + OTSVM Module ============ diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..816f524 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + status: + patch: false + project: + default: + threshold: 0.5%