From ddd81e57bfe5d3a28221f26aaeffb273d9a92e1c Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 5 Dec 2024 13:02:03 -0300 Subject: [PATCH 1/3] chore(release): 0.0.29 and some small fixes --- .github/workflows/ci.yml | 11 +++++++++++ dist/codecov.sh | 12 ++++++------ scripts/download.sh | 6 +++--- scripts/set_cli_args.sh | 2 +- scripts/set_defaults.sh | 2 +- scripts/set_upload_coverage_args.sh | 0 scripts/version.sh | 2 +- 7 files changed, 23 insertions(+), 12 deletions(-) mode change 100644 => 100755 scripts/set_upload_coverage_args.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61a7a7e..818ca93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,3 +23,14 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_FAIL_ON_ERROR: true CODECOV_FLAGS: flag1,flag2 + shellcheck: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install shellcheck + run: brew install shellcheck + - name: Run shellcheck + # TODO: fix shellcheck + # run: shellcheck dist/codecov.sh -x + run: shellcheck dist/codecov.sh diff --git a/dist/codecov.sh b/dist/codecov.sh index 51a22a8..839bf88 100755 --- a/dist/codecov.sh +++ b/dist/codecov.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -CC_WRAPPER_VERSION="0.0.28" +CC_WRAPPER_VERSION="0.0.29" set +u say() { echo -e "$1" } exit_if_error() { say "$r==> $1$x" - if [ $CC_FAIL_ON_ERROR = true ]; + if [ "$CC_FAIL_ON_ERROR" = true ]; then say "$r Exiting...$x" exit 1; @@ -78,16 +78,16 @@ else [[ $cc_os == "windows" ]] && cc_filename+=".exe" export cc_filename=${cc_filename} [[ $cc_os == "macos" ]] && \ - ! command -v gpg 2>&1 >/dev/null && \ + ! command -v gpg 2>&1 && \ HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg cc_url="https://cli.codecov.io" cc_url="$cc_url/${CC_VERSION}" cc_url="$cc_url/${cc_os}/${cc_filename}" say "$g ->$x Downloading $b${cc_url}$x" - curl -Os $cc_url + curl -Os "$cc_url" say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x" version_url="https://cli.codecov.io/${cc_os}/${CC_VERSION}" - version=$(curl -s $version_url -H "Accept:application/json" | jq -r '.version') + version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version') say " Version: $b$version$x" say " " fi @@ -123,7 +123,7 @@ fi cc_cli_args=() cc_cli_args+=( $(k_arg AUTO_LOAD_PARAMS_FROM) $(v_arg AUTO_LOAD_PARAMS_FROM)) cc_cli_args+=( $(k_arg ENTERPRISE_URL) $(v_arg ENTERPRISE_URL)) -if [ -n $CC_YML_PATH ] +if [ -n "$CC_YML_PATH" ] then cc_cli_args+=( "--codecov-yml-path" ) cc_cli_args+=( "$CC_YML_PATH" ) diff --git a/scripts/download.sh b/scripts/download.sh index 59b16f7..b8bc80d 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -33,17 +33,17 @@ else [[ $codecov_os == "windows" ]] && codecov_filename+=".exe" export codecov_filename=${codecov_filename} [[ $codecov_os == "macos" ]] && \ - ! command -v gpg 2>&1 >/dev/null && \ + ! command -v gpg 2>&1 && \ HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg codecov_url="https://cli.codecov.io" codecov_url="$codecov_url/${CODECOV_VERSION}" codecov_url="$codecov_url/${codecov_os}/${codecov_filename}" say "$g ->$x Downloading $b${codecov_url}$x" - curl -Os $codecov_url + curl -Os "$codecov_url" say "$g==>$x Finishing downloading $b${codecov_os}:${CODECOV_VERSION}$x" version_url="https://cli.codecov.io/${codecov_os}/${CODECOV_VERSION}" - version=$(curl -s $version_url -H "Accept:application/json" | jq -r '.version') + version=$(curl -s "$version_url" -H "Accept:application/json" | jq -r '.version') say " Version: $b$version$x" say " " fi diff --git a/scripts/set_cli_args.sh b/scripts/set_cli_args.sh index b586893..e71a955 100755 --- a/scripts/set_cli_args.sh +++ b/scripts/set_cli_args.sh @@ -4,7 +4,7 @@ codecov_cli_args=() codecov_cli_args+=( $(k_arg AUTO_LOAD_PARAMS_FROM) $(v_arg AUTO_LOAD_PARAMS_FROM)) codecov_cli_args+=( $(k_arg ENTERPRISE_URL) $(v_arg ENTERPRISE_URL)) -if [ -n $CODECOV_YML_PATH ] +if [ -n "$CODECOV_YML_PATH" ] then codecov_cli_args+=( "--codecov-yml-path" ) codecov_cli_args+=( "$CODECOV_YML_PATH" ) diff --git a/scripts/set_defaults.sh b/scripts/set_defaults.sh index 333dec5..a8c5bd1 100755 --- a/scripts/set_defaults.sh +++ b/scripts/set_defaults.sh @@ -7,7 +7,7 @@ say() { exit_if_error() { say "$r==> $1$x" - if [ $CODECOV_FAIL_ON_ERROR = true ]; + if [ "$CODECOV_FAIL_ON_ERROR" = true ]; then say "$r Exiting...$x" exit 1; diff --git a/scripts/set_upload_coverage_args.sh b/scripts/set_upload_coverage_args.sh old mode 100644 new mode 100755 diff --git a/scripts/version.sh b/scripts/version.sh index b33d24a..d9ff3ea 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -1,2 +1,2 @@ #!/usr/bin/env bash -CODECOV_WRAPPER_VERSION="0.0.28" +CODECOV_WRAPPER_VERSION="0.0.29" From 6ced27b17df6daad24c288d0f8e1ca1012d9913d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 5 Dec 2024 13:05:25 -0300 Subject: [PATCH 2/3] fix: update to error --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 818ca93..69147dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,4 @@ jobs: - name: Install shellcheck run: brew install shellcheck - name: Run shellcheck - # TODO: fix shellcheck - # run: shellcheck dist/codecov.sh -x - run: shellcheck dist/codecov.sh + run: shellcheck dist/codecov.sh --severity=error From bdde0db1fd415045a92a675fb1e626a92553483d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 5 Dec 2024 14:01:52 -0300 Subject: [PATCH 3/3] fix: oops --- dist/codecov.sh | 2 +- scripts/download.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/codecov.sh b/dist/codecov.sh index 839bf88..fa85ec9 100755 --- a/dist/codecov.sh +++ b/dist/codecov.sh @@ -78,7 +78,7 @@ else [[ $cc_os == "windows" ]] && cc_filename+=".exe" export cc_filename=${cc_filename} [[ $cc_os == "macos" ]] && \ - ! command -v gpg 2>&1 && \ + ! command -v gpg 2>&1 >/dev/null && \ HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg cc_url="https://cli.codecov.io" cc_url="$cc_url/${CC_VERSION}" diff --git a/scripts/download.sh b/scripts/download.sh index b8bc80d..e9586a0 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -33,7 +33,7 @@ else [[ $codecov_os == "windows" ]] && codecov_filename+=".exe" export codecov_filename=${codecov_filename} [[ $codecov_os == "macos" ]] && \ - ! command -v gpg 2>&1 && \ + ! command -v gpg 2>&1 >/dev/null && \ HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg codecov_url="https://cli.codecov.io" codecov_url="$codecov_url/${CODECOV_VERSION}"