1
1
#! /usr/bin/env bash
2
- CC_WRAPPER_VERSION=" 0.0.30 "
2
+ CC_WRAPPER_VERSION=" 0.0.31 "
3
3
set +u
4
4
say () {
5
5
echo -e " $1 "
52
52
if [ -f " $CC_BINARY " ];
53
53
then
54
54
cc_filename=$CC_BINARY
55
+ cc_command=$CC_BINARY
55
56
else
56
57
exit_if_error " Could not find binary file $CC_BINARY "
57
58
fi
58
59
else
59
60
if [ -n " $CC_OS " ];
60
61
then
61
62
say " $g ==>$x Overridden OS: $b ${CC_OS} $x "
62
- export cc_os=${CC_OS}
63
63
else
64
- CC_OS=" linux "
64
+ CC_OS=" windows "
65
65
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" ]] && \
70
69
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 "
75
73
fi
76
- export cc_version=${CC_VERSION}
77
74
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" ]] && \
81
78
! command -v gpg 2>&1 > /dev/null && \
82
79
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
83
80
cc_url=" https://cli.codecov.io"
84
81
cc_url=" $cc_url /${CC_VERSION} "
85
- cc_url=" $cc_url /${cc_os } /${cc_filename} "
82
+ cc_url=" $cc_url /${CC_OS } /${cc_filename} "
86
83
say " $g ->$x Downloading $b ${cc_url} $x "
87
84
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} "
90
87
version=$( curl -s " $version_url " -H " Accept:application/json" | jq -r ' .version' )
91
88
say " Version: $b$version$x "
92
89
say " "
@@ -101,7 +98,7 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
101
98
# One-time step
102
99
say " $g ==>$x Verifying GPG signature integrity"
103
100
sha_url=" https://cli.codecov.io"
104
- sha_url=" ${sha_url} /${cc_version } /${cc_os } "
101
+ sha_url=" ${sha_url} /${CC_VERSION } /${CC_OS } "
105
102
sha_url=" ${sha_url} /${cc_filename} .SHA256SUM"
106
103
say " $g ->$x Downloading $b ${sha_url} $x "
107
104
say " $g ->$x Downloading $b ${sha_url} .sig$x "
@@ -192,7 +189,7 @@ cc_uc_args+=( $(k_arg SWIFT_PROJECT) $(v_arg SWIFT_PROJECT))
192
189
IFS=$OLDIFS
193
190
unset NODE_OPTIONS
194
191
# See https://github.com/codecov/uploader/issues/475
195
- chmod +x $cc_filename
192
+ chmod +x $cc_command
196
193
if [ -n " $CC_TOKEN_VAR " ];
197
194
then
198
195
token=" $( eval echo \$ $CC_TOKEN_VAR ) "
208
205
token_arg+=( " -t " " $token " )
209
206
fi
210
207
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 \
213
210
${cc_cli_args[*]} \
214
211
upload-coverage \
215
212
${token_arg[*]} \
0 commit comments