From 0e45e61fdb35bcf2eea97d2b518cf07125b10f3f Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 21 Oct 2024 15:16:01 -0500 Subject: [PATCH] fix: allow for os override --- dist/codecov.sh | 29 ++++++++++++++++++----------- env | 1 + scripts/download.sh | 28 ++++++++++++++++++---------- scripts/version.sh | 2 +- 4 files changed, 38 insertions(+), 22 deletions(-) diff --git a/dist/codecov.sh b/dist/codecov.sh index 557a001..2a03b76 100755 --- a/dist/codecov.sh +++ b/dist/codecov.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -CC_WRAPPER_VERSION="0.0.18" +CC_WRAPPER_VERSION="0.0.19" say() { echo -e "$1" } @@ -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" ]; @@ -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" diff --git a/env b/env index d93199c..9308138 100644 --- a/env +++ b/env @@ -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 diff --git a/scripts/download.sh b/scripts/download.sh index 2829cd1..a401020 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +CODECOV_OS="linux" + if [ -n "$CODECOV_BINARY" ]; then if [ -f "$CODECOV_BINARY" ]; @@ -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" diff --git a/scripts/version.sh b/scripts/version.sh index 38bb1ef..bf77b1a 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -CODECOV_WRAPPER_VERSION="0.0.18" +CODECOV_WRAPPER_VERSION="0.0.19"