Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new codecov uploader #4600

Merged
merged 2 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: ghcr.io/espressomd/docker/ubuntu-20.04:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/ubuntu-20.04:efd89c5f66b8a65f579a7807d0059939fcb4b12f

stages:
- prepare
Expand Down Expand Up @@ -136,7 +136,7 @@ no_rotation:
ubuntu:wo-dependencies:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/ubuntu-wo-dependencies:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
myconfig: 'maxset'
with_cuda: 'false'
Expand All @@ -154,7 +154,7 @@ ubuntu:wo-dependencies:
debian:10:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/debian:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/debian:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
with_cuda: 'false'
myconfig: 'maxset'
Expand All @@ -169,7 +169,7 @@ debian:10:
fedora:36:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/fedora:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/fedora:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
with_cuda: 'false'
myconfig: 'maxset'
Expand Down Expand Up @@ -210,7 +210,7 @@ clang-sanitizer:
fast_math:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/cuda:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/cuda:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-9'
CXX: 'g++-9'
Expand All @@ -230,7 +230,7 @@ fast_math:
cuda11-maxset-ubuntu20.04:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/cuda:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/cuda:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-9'
CXX: 'g++-9'
Expand All @@ -251,7 +251,7 @@ cuda11-maxset-ubuntu20.04:
cuda11-maxset-ubuntu22.04:
<<: *global_job_definition
stage: build
image: ghcr.io/espressomd/docker/ubuntu-22.04:adb6ad0892de1fb1ecdd9f29c1115cfc16ea5f4b
image: ghcr.io/espressomd/docker/ubuntu-22.04:efd89c5f66b8a65f579a7807d0059939fcb4b12f
variables:
CC: 'gcc-10'
CXX: 'g++-10'
Expand Down
38 changes: 29 additions & 9 deletions maintainer/CI/build_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ fi
if [ "${with_coverage}" = true ]; then
build_type="Coverage"
fi
if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ] ; then
bash <(curl -s https://codecov.io/env) 1>/dev/null 2>&1
fi

if [ "${with_fast_math}" = true ]; then
cmake_param_protected="-DCMAKE_CXX_FLAGS=-ffast-math -fno-finite-math-only"
Expand Down Expand Up @@ -341,8 +338,24 @@ fi
if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ]; then
start "COVERAGE"
cd "${builddir}"

# import codecov key
gpg --import "${CODECOV_PUBLIC_KEY}"

# download uploader and signatures
curl -OSs https://uploader.codecov.io/latest/linux/codecov
curl -OSs https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -OSs https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig

# check uploader integrity, exit script in case of failure
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
chmod +x codecov

codecov_opts=""
if [ "${with_coverage}" = true ]; then
echo "Running lcov and gcov..."
codecov_opts="${codecov_opts} --gcov"
lcov --gcov-tool "${GCOV:-gcov}" -q --directory . --ignore-errors graph --capture --output-file coverage.info # capture coverage info
lcov --gcov-tool "${GCOV:-gcov}" -q --remove coverage.info '/usr/*' --output-file coverage.info # filter out system
lcov --gcov-tool "${GCOV:-gcov}" -q --remove coverage.info '*/doc/*' --output-file coverage.info # filter out docs
Expand All @@ -353,12 +366,19 @@ if [ "${with_coverage}" = true ] || [ "${with_coverage_python}" = true ]; then
python3 -m coverage xml
fi
echo "Uploading to Codecov..."
codecov_opts="-X gcov -X coveragepy"
if [ -z "${CODECOV_TOKEN}" ]; then
codecov_opts="${codecov_opts} -t '${CODECOV_TOKEN}'"
fi
bash <(curl --fail --silent --show-error https://codecov.io/bash 2>./codecov_stderr) ${codecov_opts} || echo "Codecov did not collect coverage reports"
cat ./codecov_stderr
for codecov_trial in 1 2 3; do
codecov_errno="0"
./codecov ${codecov_opts} -t "${CODECOV_TOKEN}" --nonZero || codecov_errno="${?}"
if [ ! "${codecov_errno}" = "0" ]; then
echo "Codecov did not upload coverage reports (return code: ${codecov_errno})" >&2
echo "That was attempt ${codecov_trial}/3"
echo ""
if [ ! "${codecov_trial}" = "3" ]; then
sleep 10s
fi
fi
done

end "COVERAGE"
fi

Expand Down