Skip to content

Commit 0e45e61

Browse files
fix: allow for os override
1 parent 2591517 commit 0e45e61

File tree

4 files changed

+38
-22
lines changed

4 files changed

+38
-22
lines changed

dist/codecov.sh

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
CC_WRAPPER_VERSION="0.0.18"
2+
CC_WRAPPER_VERSION="0.0.19"
33
say() {
44
echo -e "$1"
55
}
@@ -40,6 +40,7 @@ say " _____ _
4040
"
4141
CC_VERSION="${CC_VERSION:-latest}"
4242
CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}"
43+
CC_OS="linux"
4344
if [ -n "$CC_BINARY" ];
4445
then
4546
if [ -f "$CC_BINARY" ];
@@ -49,16 +50,22 @@ then
4950
exit_if_error "Could not find binary file $CC_BINARY"
5051
fi
5152
else
52-
family=$(uname -s | tr '[:upper:]' '[:lower:]')
53-
cc_os="windows"
54-
[[ $family == "darwin" ]] && cc_os="macos"
55-
[[ $family == "linux" ]] && cc_os="linux"
56-
[[ $cc_os == "linux" ]] && \
57-
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
58-
[[ $osID == "alpine" ]] && cc_os="alpine"
59-
[[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64"
60-
say "$g==>$x Detected $b${cc_os}$x"
61-
export cc_os=${cc_os}
53+
if [ -n "$CC_OS" ];
54+
then
55+
say "$g==>$x Overridden OS: $b${CC_OS}$x"
56+
export cc_os=${CC_OS}
57+
else
58+
family=$(uname -s | tr '[:upper:]' '[:lower:]')
59+
cc_os="windows"
60+
[[ $family == "darwin" ]] && cc_os="macos"
61+
[[ $family == "linux" ]] && cc_os="linux"
62+
[[ $cc_os == "linux" ]] && \
63+
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
64+
[[ $osID == "alpine" ]] && cc_os="alpine"
65+
[[ $(arch) == "aarch64" && $family == "linux" ]] && cc_os+="-arm64"
66+
say "$g==>$x Detected $b${cc_os}$x"
67+
export cc_os=${cc_os}
68+
fi
6269
export cc_version=${CC_VERSION}
6370
cc_filename="codecov"
6471
[[ $cc_os == "windows" ]] && cc_filename+=".exe"

env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CC_NAME
2727
CC_NETWORK_FILTER
2828
CC_NETWORK_PREFIX
2929
CC_NETWORK_ROOT_FOLDER
30+
CC_OS
3031
CC_PARENT_SHA
3132
CC_PLUGINS
3233
CC_PR

scripts/download.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
CODECOV_OS="linux"
4+
35
if [ -n "$CODECOV_BINARY" ];
46
then
57
if [ -f "$CODECOV_BINARY" ];
@@ -9,17 +11,23 @@ then
911
exit_if_error "Could not find binary file $CODECOV_BINARY"
1012
fi
1113
else
12-
family=$(uname -s | tr '[:upper:]' '[:lower:]')
13-
codecov_os="windows"
14-
[[ $family == "darwin" ]] && codecov_os="macos"
14+
if [ -n "$CODECOV_OS" ];
15+
then
16+
say "$g==>$x Overridden OS: $b${CODECOV_OS}$x"
17+
export codecov_os=${CODECOV_OS}
18+
else
19+
family=$(uname -s | tr '[:upper:]' '[:lower:]')
20+
codecov_os="windows"
21+
[[ $family == "darwin" ]] && codecov_os="macos"
1522

16-
[[ $family == "linux" ]] && codecov_os="linux"
17-
[[ $codecov_os == "linux" ]] && \
18-
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
19-
[[ $osID == "alpine" ]] && codecov_os="alpine"
20-
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
21-
say "$g==>$x Detected $b${codecov_os}$x"
22-
export codecov_os=${codecov_os}
23+
[[ $family == "linux" ]] && codecov_os="linux"
24+
[[ $codecov_os == "linux" ]] && \
25+
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
26+
[[ $osID == "alpine" ]] && codecov_os="alpine"
27+
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
28+
say "$g==>$x Detected $b${codecov_os}$x"
29+
export codecov_os=${codecov_os}
30+
fi
2331
export codecov_version=${CODECOV_VERSION}
2432

2533
codecov_filename="codecov"

scripts/version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
CODECOV_WRAPPER_VERSION="0.0.18"
2+
CODECOV_WRAPPER_VERSION="0.0.19"

0 commit comments

Comments
 (0)