Skip to content

Commit 21aadf7

Browse files
committed
Upload coverage report by hand
Curl in older Go executors (1.17-) does not support `--retry-all-errors`. But Codecov Orb uses that option from v5.4.0. Replace Codecov Orb with shell commands.
1 parent 1184031 commit 21aadf7

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

.circleci/config.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ version: 2.1
22

33
orbs:
44
go: circleci/[email protected]
5-
codecov: codecov/[email protected]
65

76
jobs:
87
MegaLinter:
@@ -39,8 +38,32 @@ jobs:
3938
- go/test:
4039
coverprofile: coverage.txt
4140
covermode: atomic
42-
- codecov/upload:
43-
files: coverage.txt
41+
42+
- run:
43+
name: Upload Coverage Report
44+
# Do not use Codecov Orb, download Codecov CLI and upload coverage
45+
# report by hand.
46+
#
47+
# Codecov Orb v5.4.0 added `--retry-all-errors` into Curl command.
48+
# That option, which is added in Curl 7.71.0, is not available in Go
49+
# executor 1.17-.
50+
#
51+
# https://github.com/codecov/codecov-circleci-orb/commit/12e27248956a647fe5ca2ad3898fb14cb91f9c4a
52+
# https://github.com/codecov/wrapper/commit/61989fd8503ba5dd9b6c3f340d1196ca75d0303b
53+
# https://github.com/codecov/wrapper/pull/54
54+
# https://daniel.haxx.se/blog/2020/06/24/curl-7-71-0-blobs-and-retries/
55+
# https://curl.se/docs/manpage.html#--retry-all-errors
56+
command: |
57+
CODECOV_BIN="$(mktemp -d)/codecov/bin"
58+
# `mktemp` on codecov doesn't support long options, use short
59+
# options instead.
60+
61+
CODECOV="${CODECOV_BIN}/codecov"
62+
curl --output "${CODECOV}" --create-dirs --silent --show-error https://cli.codecov.io/latest/alpine/codecov
63+
chmod +x "${CODECOV}"
64+
65+
"${CODECOV}" upload-process --file coverage.txt --slug "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
66+
# `CIRCLE_PROJECT_ID` is a UUID, do not use it.
4467
4568
workflows:
4669
CI:

0 commit comments

Comments
 (0)