From 4db146c39c3f29d68093c9678af4a8ed97cb4160 Mon Sep 17 00:00:00 2001 From: Ryo Onodera Date: Fri, 10 Jan 2020 03:39:33 +0900 Subject: [PATCH] Correctly integrate buildkite with codecov (#7718) * Correctly integrate buildkite with codecov * Fix shellcheck... * Really detect Buildkite (cherry picked from commit 287995ffdf1db361dcdf7075c9f572c0207f8603) --- ci/docker-run.sh | 12 +++++++++--- ci/test-coverage.sh | 3 ++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ci/docker-run.sh b/ci/docker-run.sh index 6d6b59400faa93..94faf48232acc0 100755 --- a/ci/docker-run.sh +++ b/ci/docker-run.sh @@ -72,10 +72,14 @@ ARGS+=( --env CI_JOB_ID --env CI_PULL_REQUEST --env CI_REPO_SLUG - --env CODECOV_TOKEN --env CRATES_IO_TOKEN ) +# Also propagate environment variables needed for codecov +# https://docs.codecov.io/docs/testing-with-docker#section-codecov-inside-docker +# We normalize CI to `1`; but codecov expects it to be `true` to detect Buildkite... +CODECOV_ENVS=$(CI=true bash <(curl -s https://codecov.io/env)) + if $INTERACTIVE; then if [[ -n $1 ]]; then echo @@ -83,8 +87,10 @@ if $INTERACTIVE; then echo fi set -x - exec docker run --interactive --tty "${ARGS[@]}" "$IMAGE" bash + # shellcheck disable=SC2086 + exec docker run --interactive --tty "${ARGS[@]}" $CODECOV_ENVS "$IMAGE" bash fi set -x -exec docker run "${ARGS[@]}" "$IMAGE" "$@" +# shellcheck disable=SC2086 +exec docker run "${ARGS[@]}" $CODECOV_ENVS "$IMAGE" "$@" diff --git a/ci/test-coverage.sh b/ci/test-coverage.sh index 7b4568b67ac19e..57695060a264bd 100755 --- a/ci/test-coverage.sh +++ b/ci/test-coverage.sh @@ -41,7 +41,8 @@ if [[ -z "$CODECOV_TOKEN" ]]; then echo "^^^ +++" echo CODECOV_TOKEN undefined, codecov.io upload skipped else - bash <(curl -s https://codecov.io/bash) -X gcov -f target/cov/lcov.info + # We normalize CI to `1`; but codecov expects it to be `true` to detect Buildkite... + CI=true bash <(curl -s https://codecov.io/bash) -X gcov -f target/cov/lcov.info annotate --style success --context codecov.io \ "CodeCov report: https://codecov.io/github/solana-labs/solana/commit/${CI_COMMIT:0:9}"