From bbc03b2b0aa098cb446a17c7219a902764e085a8 Mon Sep 17 00:00:00 2001 From: Takatoshi Kondo Date: Tue, 14 Jan 2020 13:23:55 +0900 Subject: [PATCH] Limited codecov trigger. Focused coverage target to library code. Now, codecov supports tokenless upload. --- .github/workflows/coverage.yml | 22 ++++++++++++++------- codecov.yml | 36 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e70db8fc..a92575de 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,6 +1,13 @@ name: coverage -on: push +on: + pull_request: + types: [opened, synchronize] + push: + branches: + - master + tags: + - '*' jobs: @@ -39,16 +46,17 @@ jobs: mkdir -p ${BASE}/usr/lib mv *.a ${BASE}/usr/lib cd .. - + mkdir build && cd build CMAKE_LIBRARY_PATH="${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/gcc/lib64/cmake" cmake -DMSGPACK_CXX17=ON -DMSGPACK_32BIT=OFF -DMSGPACK_BOOST=ON -DBUILD_SHARED_LIBS=ON -DMSGPACK_CHAR_SIGN=signed -DMSGPACK_USE_X3_PARSE=ON -DMSGPACK_ENABLE_CXX=ON -DMSGPACK_BUILD_EXAMPLES=ON -DMSGPACK_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DMSGPACK_GEN_COVERAGE=ON .. make -j4 make test - name: Upload coverage to Codecov working-directory: build - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - wget https://codecov.io/bash -O codecov - chmod +x codecov - ./codecov -t $CODECOV_TOKEN -B $GITHUB_REF -s . + # Create lcov report + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files + lcov --list coverage.info # debug info + # Uploading report to CodeCov + bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports" diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..caa30058 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,36 @@ +codecov: + notify: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + + status: + project: yes + patch: yes + changes: no + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "header, diff" + behavior: default + require_changes: no + +ignore: + - "test" + - "fuzz" + - "erb" + - "ci" + - "cmake" + - "examle" + - "external" + - "usr"