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

Add use_python option #25

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
25 changes: 18 additions & 7 deletions dist/codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ say " _____ _
"
CC_VERSION="${CC_VERSION:-latest}"
CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}"
CC_USE_PYTHON="${CC_USE_PYTHON:-false}"
if [ -n "$CC_USE_PYTHON" ]; then
echo "CC_USE_PYTHON is set, skipping download and validation steps."
else
if [ -n "$CC_BINARY" ];
then
if [ -f "$CC_BINARY" ];
Expand Down Expand Up @@ -114,6 +118,7 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
say "$g==>$x CLI integrity verified"
say
fi
fi
cc_cli_args=()
cc_cli_args+=( $(write_existing_args CC_AUTO_LOAD_PARAMS_FROM) )
cc_cli_args+=( $(write_existing_args CC_ENTERPRISE_URL) )
Expand Down Expand Up @@ -189,7 +194,13 @@ cc_du_args+=( $(write_existing_args CC_SWIFT_PROJECT) )
IFS=$OLDIFS
unset NODE_OPTIONS
# See https://github.com/codecov/uploader/issues/475
chmod +x $cc_filename
if [ -z "$CC_USE_PYTHON" ];
then
chmod +x $cc_filename
bin="./$cc_filename"
else
bin="codecov-cli"
fi
if [ -n "$CC_TOKEN_VAR" ];
then
token="$(eval echo \$$CC_TOKEN_VAR)"
Expand All @@ -205,8 +216,8 @@ then
token_arg+=( " -t " "$token")
fi
say "$g==>$x Running create-commit"
say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-commit$token_str $(echo "${cc_cc_args[@]}")$x"
if ! ./$cc_filename \
say " $b$bin $(echo "${cc_cli_args[@]}") create-commit$token_str $(echo "${cc_cc_args[@]}")$x"
if ! $bin \
${cc_cli_args[*]} \
create-commit \
${token_arg[*]} \
Expand All @@ -216,8 +227,8 @@ then
fi
say " "
say "$g==>$x Running create-report"
say " $b./$cc_filename $(echo "${cc_cli_args[@]}") create-report$token_str $(echo "${cc_cr_args[@]}")$x"
if ! ./$cc_filename \
say " $b$bin $(echo "${cc_cli_args[@]}") create-report$token_str $(echo "${cc_cr_args[@]}")$x"
if ! $bin \
${cc_cli_args[*]} \
create-report \
${token_arg[*]} \
Expand All @@ -227,8 +238,8 @@ then
fi
say " "
say "$g==>$x Running do-upload"
say " $b./$cc_filename $(echo "${cc_cli_args[@]}") do-upload$token_str $(echo "${cc_du_args[@]}")$x"
if ! ./$cc_filename \
say " $b$bin $(echo "${cc_cli_args[@]}") do-upload$token_str $(echo "${cc_du_args[@]}")$x"
if ! $bin \
${cc_cli_args[*]} \
do-upload \
${token_arg[*]} \
Expand Down
1 change: 1 addition & 0 deletions env
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ CC_SLUG
CC_SWIFT_PROJECT
CC_TOKEN
CC_TOKEN_VAR
CC_USE_PYTHON
CC_VERBOSE
CC_VERSION
CC_WRAPPER_VERSION
Expand Down
9 changes: 7 additions & 2 deletions scripts/run.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

. ./version.sh
. ./set_defaults.sh
. ./download.sh
. ./validate.sh

if [ -n "$CC_USE_PYTHON" ]; then
echo "CC_USE_PYTHON is set, skipping download and validation steps."
else
. ./download.sh
. ./validate.sh
fi

. ./set_cli_args.sh
. ./set_create_commit_args.sh
Expand Down
1 change: 1 addition & 0 deletions scripts/set_defaults.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ say " _____ _

CODECOV_VERSION="${CODECOV_VERSION:-latest}"
CODECOV_FAIL_ON_ERROR="${CODECOV_FAIL_ON_ERROR:-false}"
CC_USE_PYTHON="${CC_USE_PYTHON:-false}"
20 changes: 13 additions & 7 deletions scripts/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
unset NODE_OPTIONS
# See https://github.com/codecov/uploader/issues/475

chmod +x $codecov_filename
if [ -z "$CC_USE_PYTHON" ];
then
chmod +x $codecov_filename
bin="./$codecov_filename"
else
bin="codecov-cli"
fi

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

say "$g==>$x Running create-commit"
say " $b./$codecov_filename $(echo "${codecov_cli_args[@]}") create-commit$token_str $(echo "${codecov_cc_args[@]}")$x"
if ! ./$codecov_filename \
say " $b$bin $(echo "${codecov_cli_args[@]}") create-commit$token_str $(echo "${codecov_cc_args[@]}")$x"
if ! $bin \
${codecov_cli_args[*]} \
create-commit \
${token_arg[*]} \
Expand All @@ -34,8 +40,8 @@ fi
say " "

say "$g==>$x Running create-report"
say " $b./$codecov_filename $(echo "${codecov_cli_args[@]}") create-report$token_str $(echo "${codecov_cr_args[@]}")$x"
if ! ./$codecov_filename \
say " $b$bin $(echo "${codecov_cli_args[@]}") create-report$token_str $(echo "${codecov_cr_args[@]}")$x"
if ! $bin \
${codecov_cli_args[*]} \
create-report \
${token_arg[*]} \
Expand All @@ -46,8 +52,8 @@ fi
say " "

say "$g==>$x Running do-upload"
say " $b./$codecov_filename $(echo "${codecov_cli_args[@]}") do-upload$token_str $(echo "${codecov_du_args[@]}")$x"
if ! ./$codecov_filename \
say " $b$bin $(echo "${codecov_cli_args[@]}") do-upload$token_str $(echo "${codecov_du_args[@]}")$x"
if ! $bin \
${codecov_cli_args[*]} \
do-upload \
${token_arg[*]} \
Expand Down