From 2a78210c22519947436386fc2e3cf097ccba2c4a Mon Sep 17 00:00:00 2001 From: MoonlightSentinel Date: Thu, 13 Jan 2022 12:32:46 +0100 Subject: [PATCH] Azure: Fix CodeCov upload by using a proper login shell The CodeCov script needs to be run with a `--login` shell s.t. it has access to `shasum`,... . (The previous draft PR was merged with an allowed failure...) --- .azure-pipelines/windows.yml | 8 ++++---- ci/codecov.sh | 13 ++++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/windows.yml b/.azure-pipelines/windows.yml index b2482eb218..56f9d1f24a 100644 --- a/.azure-pipelines/windows.yml +++ b/.azure-pipelines/windows.yml @@ -13,10 +13,10 @@ steps: sh --login .azure-pipelines/windows.sh displayName: Build and test - - bash: | - set -eux - source .azure-pipelines/lib.sh - OS_NAME=windows source ci/codecov.sh + # Try to upload the coverage files from the previous step to CodeCov + # This job is allowed to fail s.t. it does not block PR's in case of + # environmental issues + - script: bash --login -c "OS_NAME=windows source ci/codecov.sh" displayName: "Upload coverage report" condition: eq( variables.DMD_TEST_COVERAGE, 1) continueOnError: true diff --git a/ci/codecov.sh b/ci/codecov.sh index e112038192..9fee141be9 100644 --- a/ci/codecov.sh +++ b/ci/codecov.sh @@ -1,7 +1,15 @@ #!/usr/bin/env bash +set -euox pipefail # Uploads coverage reports to CodeCov +# Check whether this script was called on it's own +if [[ "${CURL_USER_AGENT:-}" == "" ]] +then + CI_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + source "$CI_DIR/../.azure-pipelines/lib.sh" +fi + # CodeCov gets confused by lst files which it can't match rm -rf test/runnable/extra-files test/*.lst @@ -57,8 +65,11 @@ fi gpg --verify "$UPLOADER.SHA256SUM.sig" "$UPLOADER.SHA256SUM" shasum -a 256 -c "$UPLOADER.SHA256SUM" +# Remove signature files as the uploader apparently includes them... +rm $UPLOADER.* + # Upload the sources chmod +x "$UPLOADER" "./$UPLOADER" -p . -Z $UPLOADER_ARGS -rm codecov* +rm "$UPLOADER"