From 95dd89f6dedad56c10e77fb212f01190ae7d6fb2 Mon Sep 17 00:00:00 2001 From: Adam Seitz Date: Thu, 2 May 2024 13:00:42 -0400 Subject: [PATCH] Collect CPP and Python coverage separately --- .ci/gitlab-ci.yml | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/.ci/gitlab-ci.yml b/.ci/gitlab-ci.yml index a9cf0f323..bfdc7270e 100644 --- a/.ci/gitlab-ci.yml +++ b/.ci/gitlab-ci.yml @@ -193,16 +193,20 @@ test-capstone-example: - make -j - '[[ -f bin/ex-jumps ]]' -coverage: +generate-coverage: stage: build needs: [check-format] image: $DOCKER_REGISTRY/rewriting/gtirb/ubuntu20:$IMAGE_TAG - # TODO: The documentation states: - # > If there is more than one matched line in the job output, the last line is used - # https://docs.gitlab.com/ee/ci/yaml/index.html#coverage - # We output two coverage values here that will match: CPP and Python. - # Only the latter, Python, will be displayed by GitLab in the MR UI. - coverage: '/^TOTAL.*\s+(\d+\%)$/' + artifacts: + # Upload coverage reports and source for report-coverage-* jobs to use. + paths: + - build/**/*.gcno + - build/**/*.gcda + - build/python/.coverage + - build/**/*.py + - build/**/*.h + - build/**/*.cc + - build/**/*.cpp script: - mkdir build - cd build @@ -211,10 +215,32 @@ coverage: - cmake --build . - pip3 install -e python - ctest --output-on-failure + +# > If there is more than one matched line in the job output, the last line is used +# https://docs.gitlab.com/ee/ci/yaml/index.html#coverage +# We output the two coverage numbers in separate jobs(report-coverage-*) so +# that both can be reported to GitLab. +report-coverage-cpp: + stage: build + needs: [generate-coverage] + image: $DOCKER_REGISTRY/rewriting/gtirb/ubuntu20:$IMAGE_TAG + coverage: '/^TOTAL.*\s+(\d+\%)$/' + script: + - pip install gcovr + - cd build - gcovr --exclude=googletest-src --exclude=doc --exclude=..*/proto --exclude=..*/test --root .. - - cd python + +report-coverage-py: + stage: build + needs: [generate-coverage] + image: $DOCKER_REGISTRY/rewriting/gtirb/ubuntu20:$IMAGE_TAG + coverage: '/^TOTAL.*\s+(\d+\%)$/' + script: + - pip install coverage + - cd build/python - coverage report --omit=gtirb/proto/* --show-missing + test-default-install: stage: test-packages1 image: $DOCKER_REGISTRY/rewriting/gtirb/ubuntu20:$IMAGE_TAG