|
46 | 46 | if: needs.check_cov_skip.outputs.can-skip != 'true' |
47 | 47 | outputs: |
48 | 48 | diff_cov_file_url: ${{ steps.cov_upload.outputs.diff_cov_file_url }} |
| 49 | + all_cov_file_url: ${{ steps.cov_upload.outputs.all_cov_file_url }} |
49 | 50 | unittest_failed_url: ${{ steps.cov_upload.outputs.unittest_failed_url }} |
50 | 51 | diff_cov_result_json_url: ${{ steps.cov_upload.outputs.diff_cov_result_json_url }} |
51 | 52 | steps: |
@@ -266,6 +267,14 @@ jobs: |
266 | 267 | echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_OUTPUT |
267 | 268 | echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV |
268 | 269 | fi |
| 270 | +
|
| 271 | + all_coverage_file="python_coverage_all.xml" |
| 272 | + if [ -f ${all_coverage_file} ]; then |
| 273 | + python ${push_file} ${all_coverage_file} ${target_path}/CoverageData |
| 274 | + ALL_COV_FILE_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${all_coverage_file} |
| 275 | + echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_OUTPUT |
| 276 | + echo "all_cov_file_url=${ALL_COV_FILE_URL}" >> $GITHUB_ENV |
| 277 | + fi |
269 | 278 | fi |
270 | 279 |
|
271 | 280 | HAS_FAILED_TESTS=false |
@@ -352,28 +361,54 @@ jobs: |
352 | 361 | runs-on: ubuntu-latest |
353 | 362 | timeout-minutes: 15 |
354 | 363 | env: |
355 | | - fd_archive_url: ${{ inputs.FASTDEPLOY_ARCHIVE_URL }} |
| 364 | + diff_cov_file_url: ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url }} |
| 365 | + all_cov_file_url: ${{ needs.run_tests_with_coverage.outputs.all_cov_file_url }} |
356 | 366 | steps: |
357 | | - - name: coverage diff file download |
| 367 | + - name: Clone FastDeploy |
| 368 | + uses: actions/checkout@v4 |
| 369 | + with: |
| 370 | + fetch-depth: 0 |
| 371 | + - uses: actions/setup-python@v5 |
| 372 | + with: |
| 373 | + python-version: '3.10' |
| 374 | + - name: Fetch base branch |
| 375 | + run: | |
| 376 | + echo "Fetching base branch: ${{ github.event.pull_request.base.ref }}" |
| 377 | + git fetch origin ${{ github.event.pull_request.base.ref }}:refs/remotes/origin/${{ github.event.pull_request.base.ref }} |
| 378 | +
|
| 379 | + - name: Download diff coverage file |
358 | 380 | shell: bash |
359 | | - env: |
360 | | - diff_cov_file_url: ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url }} |
361 | 381 | run: | |
362 | | - wget -q --no-proxy ${fd_archive_url} |
363 | | - tar -xf FastDeploy.tar.gz |
364 | | - cd FastDeploy |
365 | 382 | if [ -z "${diff_cov_file_url}" ]; then |
366 | 383 | echo "No diff coverage file URL provided." |
367 | 384 | exit 0 |
368 | 385 | fi |
369 | | - wget "${diff_cov_file_url}" -O ./diff_coverage.xml || echo "Download cov file failed, but continuing..." |
| 386 | +
|
| 387 | + echo "Downloading diff coverage file..." |
| 388 | + if ! wget --no-proxy "${diff_cov_file_url}" -O diff_coverage.xml; then |
| 389 | + echo "Download failed, skipping upload." |
| 390 | + exit 0 |
| 391 | + fi |
| 392 | +
|
| 393 | + echo "Downloading all coverage file..." |
| 394 | + if ! wget --no-proxy "${all_cov_file_url}" -O python_coverage_all.xml; then |
| 395 | + echo "Download failed, skipping upload." |
| 396 | + exit 0 |
| 397 | + fi |
| 398 | +
|
| 399 | + if [ ! -s diff_coverage.xml ]; then |
| 400 | + echo "Downloaded diff coverage file is empty!" |
| 401 | + exit 0 |
| 402 | + fi |
| 403 | + sed -i 's|<source>/workspace/FastDeploy/fastdeploy</source>|<source>fastdeploy</source>|' diff_coverage.xml |
| 404 | + sed -i 's|<source>/workspace/FastDeploy/fastdeploy</source>|<source>fastdeploy</source>|' python_coverage_all.xml |
| 405 | +
|
370 | 406 | - name: Upload diff coverage report |
371 | | - if: ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url != null && needs.run_tests_with_coverage.outputs.diff_cov_file_url != '' }} |
372 | | - uses: codecov/codecov-action@v5 |
| 407 | + if: always() && hashFiles('diff_coverage.xml') != '' |
| 408 | + uses: codecov/codecov-action@v4 |
373 | 409 | with: |
374 | | - files: ./FastDeploy/diff_coverage.xml |
| 410 | + files: ./diff_coverage.xml, ./python_coverage_all.xml |
| 411 | + flags: diff |
375 | 412 | name: python diff coverage |
| 413 | + fail_ci_if_error: false |
376 | 414 | verbose: true |
377 | | - disable_search: true |
378 | | - commit_parent: false |
379 | | - flags: diff |
|
0 commit comments