Skip to content

Commit b095fc2

Browse files
Merge pull request #37 from codecov/th/fix-binary-as-relative
fix: update binary to pull relative
2 parents 8d3a8c6 + ef8e8e2 commit b095fc2

File tree

4 files changed

+36
-43
lines changed

4 files changed

+36
-43
lines changed

dist/codecov.sh

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,41 +52,38 @@ then
5252
if [ -f "$CC_BINARY" ];
5353
then
5454
cc_filename=$CC_BINARY
55+
cc_command=$CC_BINARY
5556
else
5657
exit_if_error "Could not find binary file $CC_BINARY"
5758
fi
5859
else
5960
if [ -n "$CC_OS" ];
6061
then
6162
say "$g==>$x Overridden OS: $b${CC_OS}$x"
62-
export cc_os=${CC_OS}
6363
else
64-
CC_OS="linux"
64+
CC_OS="windows"
6565
family=$(uname -s | tr '[:upper:]' '[:lower:]')
66-
cc_os="windows"
67-
[[ $family == "darwin" ]] && cc_os="macos"
68-
[[ $family == "linux" ]] && cc_os="linux"
69-
[[ $cc_os == "linux" ]] && \
66+
[[ $family == "darwin" ]] && CC_OS="macos"
67+
[[ $family == "linux" ]] && CC_OS="linux"
68+
[[ $CC_OS == "linux" ]] && \
7069
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
71-
[[ $osID == "alpine" ]] && cc_os="alpine"
72-
[[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64"
73-
say "$g==>$x Detected $b${cc_os}$x"
74-
export cc_os=${cc_os}
70+
[[ $osID == "alpine" ]] && CC_OS="alpine"
71+
[[ $(arch) == "aarch64" && $family == "linux" ]] && CC_OS+="-arm64"
72+
say "$g==>$x Detected $b${CC_OS}$x"
7573
fi
76-
export cc_version=${CC_VERSION}
7774
cc_filename="codecov"
78-
[[ $cc_os == "windows" ]] && cc_filename+=".exe"
79-
export cc_filename=${cc_filename}
80-
[[ $cc_os == "macos" ]] && \
75+
[[ $CC_OS == "windows" ]] && cc_filename+=".exe"
76+
cc_command="./$cc_filename"
77+
[[ $CC_OS == "macos" ]] && \
8178
! command -v gpg 2>&1 >/dev/null && \
8279
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
8380
cc_url="https://cli.codecov.io"
8481
cc_url="$cc_url/${CC_VERSION}"
85-
cc_url="$cc_url/${cc_os}/${cc_filename}"
82+
cc_url="$cc_url/${CC_OS}/${cc_filename}"
8683
say "$g ->$x Downloading $b${cc_url}$x"
8784
curl -Os "$cc_url"
88-
say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x"
89-
version_url="https://cli.codecov.io/api/${cc_os}/${CC_VERSION}"
85+
say "$g==>$x Finishing downloading $b${CC_OS}:${CC_VERSION}$x"
86+
version_url="https://cli.codecov.io/api/${CC_OS}/${CC_VERSION}"
9087
version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version')
9188
say " Version: $b$version$x"
9289
say " "
@@ -101,7 +98,7 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
10198
# One-time step
10299
say "$g==>$x Verifying GPG signature integrity"
103100
sha_url="https://cli.codecov.io"
104-
sha_url="${sha_url}/${cc_version}/${cc_os}"
101+
sha_url="${sha_url}/${CC_VERSION}/${CC_OS}"
105102
sha_url="${sha_url}/${cc_filename}.SHA256SUM"
106103
say "$g ->$x Downloading $b${sha_url}$x"
107104
say "$g ->$x Downloading $b${sha_url}.sig$x"
@@ -192,7 +189,7 @@ cc_uc_args+=( $(k_arg SWIFT_PROJECT) $(v_arg SWIFT_PROJECT))
192189
IFS=$OLDIFS
193190
unset NODE_OPTIONS
194191
# See https://github.com/codecov/uploader/issues/475
195-
chmod +x $cc_filename
192+
chmod +x $cc_command
196193
if [ -n "$CC_TOKEN_VAR" ];
197194
then
198195
token="$(eval echo \$$CC_TOKEN_VAR)"
@@ -208,8 +205,8 @@ then
208205
token_arg+=( " -t " "$token")
209206
fi
210207
say "$g==>$x Running upload-coverage"
211-
say " $b./$cc_filename $(echo "${cc_cli_args[@]}") upload-coverage$token_str $(echo "${cc_uc_args[@]}")$x"
212-
if ! ./$cc_filename \
208+
say " $b$cc_command $(echo "${cc_cli_args[@]}") upload-coverage$token_str $(echo "${cc_uc_args[@]}")$x"
209+
if ! $cc_command \
213210
${cc_cli_args[*]} \
214211
upload-coverage \
215212
${token_arg[*]} \

scripts/download.sh

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,40 @@ then
55
if [ -f "$CODECOV_BINARY" ];
66
then
77
codecov_filename=$CODECOV_BINARY
8+
codecov_command=$CODECOV_BINARY
89
else
910
exit_if_error "Could not find binary file $CODECOV_BINARY"
1011
fi
1112
else
1213
if [ -n "$CODECOV_OS" ];
1314
then
1415
say "$g==>$x Overridden OS: $b${CODECOV_OS}$x"
15-
export codecov_os=${CODECOV_OS}
1616
else
17-
CODECOV_OS="linux"
17+
CODECOV_OS="windows"
1818
family=$(uname -s | tr '[:upper:]' '[:lower:]')
19-
codecov_os="windows"
20-
[[ $family == "darwin" ]] && codecov_os="macos"
21-
22-
[[ $family == "linux" ]] && codecov_os="linux"
23-
[[ $codecov_os == "linux" ]] && \
19+
[[ $family == "darwin" ]] && CODECOV_OS="macos"
20+
[[ $family == "linux" ]] && CODECOV_OS="linux"
21+
[[ $CODECOV_OS == "linux" ]] && \
2422
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
25-
[[ $osID == "alpine" ]] && codecov_os="alpine"
26-
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
27-
say "$g==>$x Detected $b${codecov_os}$x"
28-
export codecov_os=${codecov_os}
23+
[[ $osID == "alpine" ]] && CODECOV_OS="alpine"
24+
[[ $(arch) == "aarch64" && $family == "linux" ]] && CODECOV_OS+="-arm64"
25+
say "$g==>$x Detected $b${CODECOV_OS}$x"
2926
fi
30-
export codecov_version=${CODECOV_VERSION}
3127

3228
codecov_filename="codecov"
33-
[[ $codecov_os == "windows" ]] && codecov_filename+=".exe"
34-
export codecov_filename=${codecov_filename}
35-
[[ $codecov_os == "macos" ]] && \
29+
[[ $CODECOV_OS == "windows" ]] && codecov_filename+=".exe"
30+
codecov_command="./$codecov_filename"
31+
[[ $CODECOV_OS == "macos" ]] && \
3632
! command -v gpg 2>&1 >/dev/null && \
3733
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
3834
codecov_url="https://cli.codecov.io"
3935
codecov_url="$codecov_url/${CODECOV_VERSION}"
40-
codecov_url="$codecov_url/${codecov_os}/${codecov_filename}"
36+
codecov_url="$codecov_url/${CODECOV_OS}/${codecov_filename}"
4137
say "$g ->$x Downloading $b${codecov_url}$x"
4238
curl -Os "$codecov_url"
43-
say "$g==>$x Finishing downloading $b${codecov_os}:${CODECOV_VERSION}$x"
39+
say "$g==>$x Finishing downloading $b${CODECOV_OS}:${CODECOV_VERSION}$x"
4440

45-
version_url="https://cli.codecov.io/api/${codecov_os}/${CODECOV_VERSION}"
41+
version_url="https://cli.codecov.io/api/${CODECOV_OS}/${CODECOV_VERSION}"
4642
version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version')
4743
say " Version: $b$version$x"
4844
say " "

scripts/upload.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
unset NODE_OPTIONS
44
# See https://github.com/codecov/uploader/issues/475
55

6-
chmod +x $codecov_filename
6+
chmod +x $codecov_command
77

88
if [ -n "$CODECOV_TOKEN_VAR" ];
99
then
@@ -22,8 +22,8 @@ then
2222
fi
2323

2424
say "$g==>$x Running upload-coverage"
25-
say " $b./$codecov_filename $(echo "${codecov_cli_args[@]}") upload-coverage$token_str $(echo "${codecov_uc_args[@]}")$x"
26-
if ! ./$codecov_filename \
25+
say " $b$codecov_command $(echo "${codecov_cli_args[@]}") upload-coverage$token_str $(echo "${codecov_uc_args[@]}")$x"
26+
if ! $codecov_command \
2727
${codecov_cli_args[*]} \
2828
upload-coverage \
2929
${token_arg[*]} \

scripts/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ else
1010
# One-time step
1111
say "$g==>$x Verifying GPG signature integrity"
1212
sha_url="https://cli.codecov.io"
13-
sha_url="${sha_url}/${codecov_version}/${codecov_os}"
13+
sha_url="${sha_url}/${CODECOV_VERSION}/${CODECOV_OS}"
1414
sha_url="${sha_url}/${codecov_filename}.SHA256SUM"
1515
say "$g ->$x Downloading $b${sha_url}$x"
1616
say "$g ->$x Downloading $b${sha_url}.sig$x"

0 commit comments

Comments
 (0)