From cacb1279a840938a73e4b0cef41ac17d63fc1cb1 Mon Sep 17 00:00:00 2001 From: Michael Platings Date: Tue, 23 Jan 2024 17:06:59 +0000 Subject: [PATCH] Publish coverage report --- .gitignore | 1 + .gitlab-ci.yml | 4 ++++ scripts/ci.sh | 15 +++++++-------- scripts/generate_coverage_report.sh | 20 +++----------------- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 34a8741b7..d87d84493 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ # SPDX-License-Identifier: Apache-2.0 build/ +public/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d12633a5c..1a56e0f7e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,8 +11,12 @@ build: - scripts/ci.sh artifacts: when: always + expire_in: 1 day reports: junit: build/test-results/**/*.xml coverage_report: coverage_format: cobertura path: build/cobertura-coverage.xml + paths: + # GitLab Pages https://docs.gitlab.com/ee/user/project/pages/ + - public diff --git a/scripts/ci.sh b/scripts/ci.sh index e13201880..a4ac89fb8 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -11,6 +11,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.." # Ensure we're doing a clean build rm -rf build +rm -rf public apt-get -y --no-install-recommends install qemu-user @@ -49,13 +50,11 @@ scripts/prefix_testsuite_names.py build/test-results/sve2/intrinsiccv-api-test.x scripts/prefix_testsuite_names.py build/test-results/sme/intrinsiccv-api-test.xml "SME." # Generate test coverage report -gcovr \ - -j \ - --gcov-executable "llvm-cov gcov" \ - --exclude-noncode-lines \ - --cobertura build/cobertura-coverage.xml \ - --print-summary \ - --exclude build \ - build +scripts/generate_coverage_report.sh + +# Set up GitLab Pages (https://docs.gitlab.com/ee/user/project/pages/) +mkdir public +mv build/coverage public +echo "">public/index.html exit $TESTRESULT diff --git a/scripts/generate_coverage_report.sh b/scripts/generate_coverage_report.sh index 3cc968893..4fbca1575 100755 --- a/scripts/generate_coverage_report.sh +++ b/scripts/generate_coverage_report.sh @@ -11,14 +11,7 @@ set -exu -# ------------------------------------------------------------------------------ -# Mandatory arguments check -# ------------------------------------------------------------------------------ - -if [[ -z "${LLVM_COV}" ]]; then - echo "Required variable 'LLVM_COV' is not set. Please set it to point to llvm-cov command." - exit 1 -fi +: "${LLVM_COV:=llvm-cov}" # ------------------------------------------------------------------------------ # Automatic configuration @@ -35,13 +28,14 @@ coverage_path="${build_path}"/coverage rm -rf "${coverage_path}" mkdir "${coverage_path}" -pushd "${coverage_path}" || exit 1 +cd "${coverage_path}" gcovr \ --gcov-executable "${LLVM_COV} gcov" \ --root "${build_path}" \ --filter "${source_path}" \ --gcov-filter "${build_path}" \ + --cobertura "${build_path}/cobertura-coverage.xml" \ --html-details "${coverage_path}"/coverage_report.html \ --html-title "IntrinsicCV Coverage Report" \ --html-details-syntax-highlighting \ @@ -53,11 +47,3 @@ gcovr \ --exclude ".*/CompilerIdCXX/" \ --print-summary \ -j - -popd || exit 1 - -tar -czf "${build_path}"/coverage.tar.gz -C "${build_path}" coverage - -# ------------------------------------------------------------------------------ -# End of script -# ------------------------------------------------------------------------------ -- GitLab