Skip to content

Commit

Permalink
chore: build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly authored Nov 19, 2024
1 parent 23fb353 commit 1fb5f4a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
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

0 comments on commit 1fb5f4a

Please sign in to comment.