From 42a7aeb5c46cfd38b17d8be9e65af313e14f5254 Mon Sep 17 00:00:00 2001 From: Phoeniix Zhao Date: Tue, 9 Apr 2024 10:52:53 +0800 Subject: [PATCH] ci: use codecov action to upload coverage Signed-off-by: Phoeniix Zhao --- .github/workflows/pull_request.yml | 6 ++++- ci/scripts/upload-codecov.sh | 35 ------------------------------ 2 files changed, 5 insertions(+), 36 deletions(-) delete mode 100755 ci/scripts/upload-codecov.sh diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b4ac3bb1b..d7a73e41c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -84,7 +84,11 @@ jobs: - name: Upload coverage to Codecov if: matrix.config.name == 'Normal' - run: ci/scripts/upload-codecov.sh codecov.info + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: codecov.info + verbose: true commit: name: Commit Message Validation diff --git a/ci/scripts/upload-codecov.sh b/ci/scripts/upload-codecov.sh deleted file mode 100755 index 6551ae1fe..000000000 --- a/ci/scripts/upload-codecov.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -if [ -n "$CODECOV_TOKEN" ]; then - token="-t ${CODECOV_TOKEN}" -else - token="" -fi - -set -euo pipefail -curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov - -max_retry=5 -delay=30 -counter=0 -file=$1 -NONE='\033[0m' -RED='\033[0;31m' - -set +e - -while true; do - ./codecov -f $file -Z $token - if [ $? -eq 0 ]; then - break - fi - - ((counter++)) - - if [ $counter -eq $max_retry ]; then - echo "${RED}Max retries reached. Exiting.${NONE}" - exit 1 - fi - echo -e "${RED}Fail to upload, retring ${counter}/${max_retry}${NONE}" - sleep $delay -done