Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update binary to pull relative #37

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions dist/codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,38 @@ then
if [ -f "$CC_BINARY" ];
then
cc_filename=$CC_BINARY
cc_command=$CC_BINARY
else
exit_if_error "Could not find binary file $CC_BINARY"
fi
else
if [ -n "$CC_OS" ];
then
say "$g==>$x Overridden OS: $b${CC_OS}$x"
export cc_os=${CC_OS}
else
CC_OS="linux"
CC_OS="windows"
family=$(uname -s | tr '[:upper:]' '[:lower:]')
cc_os="windows"
[[ $family == "darwin" ]] && cc_os="macos"
[[ $family == "linux" ]] && cc_os="linux"
[[ $cc_os == "linux" ]] && \
[[ $family == "darwin" ]] && CC_OS="macos"
[[ $family == "linux" ]] && CC_OS="linux"
[[ $CC_OS == "linux" ]] && \
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
[[ $osID == "alpine" ]] && cc_os="alpine"
[[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64"
say "$g==>$x Detected $b${cc_os}$x"
export cc_os=${cc_os}
[[ $osID == "alpine" ]] && CC_OS="alpine"
[[ $(arch) == "aarch64" && $family == "linux" ]] && CC_OS+="-arm64"
say "$g==>$x Detected $b${CC_OS}$x"
fi
export cc_version=${CC_VERSION}
cc_filename="codecov"
[[ $cc_os == "windows" ]] && cc_filename+=".exe"
export cc_filename=${cc_filename}
[[ $cc_os == "macos" ]] && \
[[ $CC_OS == "windows" ]] && cc_filename+=".exe"
cc_command="./$cc_filename"
[[ $CC_OS == "macos" ]] && \
! command -v gpg 2>&1 >/dev/null && \
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
cc_url="https://cli.codecov.io"
cc_url="$cc_url/${CC_VERSION}"
cc_url="$cc_url/${cc_os}/${cc_filename}"
cc_url="$cc_url/${CC_OS}/${cc_filename}"
say "$g ->$x Downloading $b${cc_url}$x"
curl -Os "$cc_url"
say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x"
version_url="https://cli.codecov.io/api/${cc_os}/${CC_VERSION}"
say "$g==>$x Finishing downloading $b${CC_OS}:${CC_VERSION}$x"
version_url="https://cli.codecov.io/api/${CC_OS}/${CC_VERSION}"
version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version')
say " Version: $b$version$x"
say " "
Expand All @@ -101,7 +98,7 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
# One-time step
say "$g==>$x Verifying GPG signature integrity"
sha_url="https://cli.codecov.io"
sha_url="${sha_url}/${cc_version}/${cc_os}"
sha_url="${sha_url}/${CC_VERSION}/${CC_OS}"
sha_url="${sha_url}/${cc_filename}.SHA256SUM"
say "$g ->$x Downloading $b${sha_url}$x"
say "$g ->$x Downloading $b${sha_url}.sig$x"
Expand Down Expand Up @@ -192,7 +189,7 @@ cc_uc_args+=( $(k_arg SWIFT_PROJECT) $(v_arg SWIFT_PROJECT))
IFS=$OLDIFS
unset NODE_OPTIONS
# See https://github.com/codecov/uploader/issues/475
chmod +x $cc_filename
chmod +x $cc_command
if [ -n "$CC_TOKEN_VAR" ];
then
token="$(eval echo \$$CC_TOKEN_VAR)"
Expand All @@ -208,8 +205,8 @@ then
token_arg+=( " -t " "$token")
fi
say "$g==>$x Running upload-coverage"
say " $b./$cc_filename $(echo "${cc_cli_args[@]}") upload-coverage$token_str $(echo "${cc_uc_args[@]}")$x"
if ! ./$cc_filename \
say " $b$cc_command $(echo "${cc_cli_args[@]}") upload-coverage$token_str $(echo "${cc_uc_args[@]}")$x"
if ! $cc_command \
${cc_cli_args[*]} \
upload-coverage \
${token_arg[*]} \
Expand Down
32 changes: 14 additions & 18 deletions scripts/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,40 @@ then
if [ -f "$CODECOV_BINARY" ];
then
codecov_filename=$CODECOV_BINARY
codecov_command=$CODECOV_BINARY
else
exit_if_error "Could not find binary file $CODECOV_BINARY"
fi
else
if [ -n "$CODECOV_OS" ];
then
say "$g==>$x Overridden OS: $b${CODECOV_OS}$x"
export codecov_os=${CODECOV_OS}
else
CODECOV_OS="linux"
CODECOV_OS="windows"
family=$(uname -s | tr '[:upper:]' '[:lower:]')
codecov_os="windows"
[[ $family == "darwin" ]] && codecov_os="macos"

[[ $family == "linux" ]] && codecov_os="linux"
[[ $codecov_os == "linux" ]] && \
[[ $family == "darwin" ]] && CODECOV_OS="macos"
[[ $family == "linux" ]] && CODECOV_OS="linux"
[[ $CODECOV_OS == "linux" ]] && \
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
[[ $osID == "alpine" ]] && codecov_os="alpine"
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
say "$g==>$x Detected $b${codecov_os}$x"
export codecov_os=${codecov_os}
[[ $osID == "alpine" ]] && CODECOV_OS="alpine"
[[ $(arch) == "aarch64" && $family == "linux" ]] && CODECOV_OS+="-arm64"
say "$g==>$x Detected $b${CODECOV_OS}$x"
fi
export codecov_version=${CODECOV_VERSION}

codecov_filename="codecov"
[[ $codecov_os == "windows" ]] && codecov_filename+=".exe"
export codecov_filename=${codecov_filename}
[[ $codecov_os == "macos" ]] && \
[[ $CODECOV_OS == "windows" ]] && codecov_filename+=".exe"
codecov_command="./$codecov_filename"
[[ $CODECOV_OS == "macos" ]] && \
! command -v gpg 2>&1 >/dev/null && \
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
codecov_url="https://cli.codecov.io"
codecov_url="$codecov_url/${CODECOV_VERSION}"
codecov_url="$codecov_url/${codecov_os}/${codecov_filename}"
codecov_url="$codecov_url/${CODECOV_OS}/${codecov_filename}"
say "$g ->$x Downloading $b${codecov_url}$x"
curl -Os "$codecov_url"
say "$g==>$x Finishing downloading $b${codecov_os}:${CODECOV_VERSION}$x"
say "$g==>$x Finishing downloading $b${CODECOV_OS}:${CODECOV_VERSION}$x"

version_url="https://cli.codecov.io/api/${codecov_os}/${CODECOV_VERSION}"
version_url="https://cli.codecov.io/api/${CODECOV_OS}/${CODECOV_VERSION}"
version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version')
say " Version: $b$version$x"
say " "
Expand Down
6 changes: 3 additions & 3 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
unset NODE_OPTIONS
# See https://github.com/codecov/uploader/issues/475

chmod +x $codecov_filename
chmod +x $codecov_command

if [ -n "$CODECOV_TOKEN_VAR" ];
then
Expand All @@ -22,8 +22,8 @@ then
fi

say "$g==>$x Running upload-coverage"
say " $b./$codecov_filename $(echo "${codecov_cli_args[@]}") upload-coverage$token_str $(echo "${codecov_uc_args[@]}")$x"
if ! ./$codecov_filename \
say " $b$codecov_command $(echo "${codecov_cli_args[@]}") upload-coverage$token_str $(echo "${codecov_uc_args[@]}")$x"
if ! $codecov_command \
${codecov_cli_args[*]} \
upload-coverage \
${token_arg[*]} \
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else
# One-time step
say "$g==>$x Verifying GPG signature integrity"
sha_url="https://cli.codecov.io"
sha_url="${sha_url}/${codecov_version}/${codecov_os}"
sha_url="${sha_url}/${CODECOV_VERSION}/${CODECOV_OS}"
sha_url="${sha_url}/${codecov_filename}.SHA256SUM"
say "$g ->$x Downloading $b${sha_url}$x"
say "$g ->$x Downloading $b${sha_url}.sig$x"
Expand Down
Loading