Skip to content

Commit

Permalink
fix: allow for os override
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov committed Oct 21, 2024
1 parent 2591517 commit 0e45e61
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 22 deletions.
29 changes: 18 additions & 11 deletions dist/codecov.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
CC_WRAPPER_VERSION="0.0.18"
CC_WRAPPER_VERSION="0.0.19"
say() {
echo -e "$1"
}
Expand Down Expand Up @@ -40,6 +40,7 @@ say " _____ _
"
CC_VERSION="${CC_VERSION:-latest}"
CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}"
CC_OS="linux"
if [ -n "$CC_BINARY" ];
then
if [ -f "$CC_BINARY" ];
Expand All @@ -49,16 +50,22 @@ then
exit_if_error "Could not find binary file $CC_BINARY"
fi
else
family=$(uname -s | tr '[:upper:]' '[:lower:]')
cc_os="windows"
[[ $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}
if [ -n "$CC_OS" ];
then
say "$g==>$x Overridden OS: $b${CC_OS}$x"
export cc_os=${CC_OS}
else
family=$(uname -s | tr '[:upper:]' '[:lower:]')
cc_os="windows"
[[ $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}
fi
export cc_version=${CC_VERSION}
cc_filename="codecov"
[[ $cc_os == "windows" ]] && cc_filename+=".exe"
Expand Down
1 change: 1 addition & 0 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ CC_NAME
CC_NETWORK_FILTER
CC_NETWORK_PREFIX
CC_NETWORK_ROOT_FOLDER
CC_OS
CC_PARENT_SHA
CC_PLUGINS
CC_PR
Expand Down
28 changes: 18 additions & 10 deletions scripts/download.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

CODECOV_OS="linux"

if [ -n "$CODECOV_BINARY" ];
then
if [ -f "$CODECOV_BINARY" ];
Expand All @@ -9,17 +11,23 @@ then
exit_if_error "Could not find binary file $CODECOV_BINARY"
fi
else
family=$(uname -s | tr '[:upper:]' '[:lower:]')
codecov_os="windows"
[[ $family == "darwin" ]] && codecov_os="macos"
if [ -n "$CODECOV_OS" ];
then
say "$g==>$x Overridden OS: $b${CODECOV_OS}$x"
export codecov_os=${CODECOV_OS}
else
family=$(uname -s | tr '[:upper:]' '[:lower:]')
codecov_os="windows"
[[ $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}
[[ $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}
fi
export codecov_version=${CODECOV_VERSION}

codecov_filename="codecov"
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
CODECOV_WRAPPER_VERSION="0.0.18"
CODECOV_WRAPPER_VERSION="0.0.19"

0 comments on commit 0e45e61

Please sign in to comment.