[CI] fix coverage_report in daily test (#5175)

* [CI] fix coverage_report in daily test
This commit is contained in:
YuBaoku
2025-11-23 21:48:11 +08:00
committed by GitHub
parent c06cfe2447
commit 5daa8d0686
+12 -42
View File
@@ -45,7 +45,6 @@ jobs:
needs: check_cov_skip
if: needs.check_cov_skip.outputs.can-skip != 'true'
outputs:
diff_txt_url: ${{ steps.cov_upload.outputs.diff_txt_url }}
all_cov_file_url: ${{ steps.cov_upload.outputs.all_cov_file_url }}
unittest_failed_url: ${{ steps.cov_upload.outputs.unittest_failed_url }}
diff_cov_result_json_url: ${{ steps.cov_upload.outputs.diff_cov_result_json_url }}
@@ -251,15 +250,15 @@ jobs:
target_path_stripped="${target_path#paddle-github-action/}"
if [[ "$IS_PR" == "true" ]]; then
diff_txt="diff.txt"
if [ -f ${diff_txt} ]; then
python ${push_file} ${diff_txt} ${target_path}/CoverageData
DIFF_TXT_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${diff_txt}
echo "diff_txt_url=${DIFF_TXT_URL}" >> $GITHUB_OUTPUT
echo "diff_txt_url=${DIFF_TXT_URL}" >> $GITHUB_ENV
fi
all_coverage_file="python_coverage_all.xml"
if [ -f ${all_coverage_file} ]; then
python ${push_file} ${all_coverage_file} ${target_path}/CoverageData
ALL_COV_FILE_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${all_coverage_file}
echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_OUTPUT
echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_ENV
fi
if [[ "$IS_PR" == "true" ]]; then
diff_cov_result_json="diff_coverage.json"
if [ -f ${diff_cov_result_json} ]; then
python ${push_file} ${diff_cov_result_json} ${target_path}/CoverageData
@@ -267,14 +266,6 @@ jobs:
echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_OUTPUT
echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV
fi
all_coverage_file="python_coverage_all.xml"
if [ -f ${all_coverage_file} ]; then
python ${push_file} ${all_coverage_file} ${target_path}/CoverageData
ALL_COV_FILE_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${all_coverage_file}
echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_OUTPUT
echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_ENV
fi
fi
HAS_FAILED_TESTS=false
@@ -361,7 +352,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
diff_txt_url: ${{ needs.run_tests_with_coverage.outputs.diff_txt_url }}
all_cov_file_url: ${{ needs.run_tests_with_coverage.outputs.all_cov_file_url }}
steps:
- name: Clone FastDeploy
@@ -371,44 +361,24 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Fetch base branch
run: |
echo "Fetching base branch: ${{ github.event.pull_request.base.ref }}"
git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }}
- name: Download diff coverage file
shell: bash
run: |
if [ -z "${diff_txt_url}" ]; then
echo "No diff.txt URL provided."
exit 0
fi
echo "Downloading diff.txt ..."
if ! wget --no-proxy "${diff_txt_url}" -O diff.txt; then
echo "Download failed, skipping upload."
exit 0
fi
echo "Downloading all coverage file..."
if ! wget --no-proxy "${all_cov_file_url}" -O python_coverage_all.xml; then
echo "Download failed, skipping upload."
exit 0
fi
if [ ! -s diff.txt ]; then
echo "Downloaded diff.txt is empty!"
exit 0
fi
sed -i 's|<source>/workspace/FastDeploy/fastdeploy</source>|<source>fastdeploy</source>|' python_coverage_all.xml
- name: Upload diff coverage report
if: always() && hashFiles('diff.txt') != ''
if: always() && hashFiles('python_coverage_all.xml') != ''
uses: codecov/codecov-action@v4
with:
files: ./diff.txt, ./python_coverage_all.xml
flags: diff
files: ./python_coverage_all.xml
flags: GPU
name: python diff coverage
fail_ci_if_error: false
verbose: true
disable_search: true