Skip to content

Commit 6acae04

Browse files
committed
[CI] fix upload reporting
1 parent 87de120 commit 6acae04

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

.github/workflows/_unit_test_coverage.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ jobs:
213213
env:
214214
IS_PR: ${{ github.event_name == 'pull_request' }}
215215
GITHUB_SHA: ${{ github.sha }}
216+
BRANCH: ${{ github.ref_name }}
216217
PR_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
217218
PR_NUMBER: ${{ github.event.pull_request.number }}
218219
run: |
@@ -227,10 +228,17 @@ jobs:
227228
commit_id=${PR_COMMIT_SHA}
228229
pr_num=${PR_NUMBER}
229230
target_path=paddle-github-action/PR/FastDeploy/${pr_num}/${commit_id}/SM${compile_arch//,/_}
231+
elif [[ "${{ github.ref_type }}" == "tag" ]]; then
232+
commit_id=${{ github.sha }}
233+
tag_name=${{ github.ref_name }}
234+
target_path=paddle-github-action/TAG/FastDeploy/${tag_name}/${commit_id}/SM${compile_arch//,/_}
235+
target_path_latest=paddle-github-action/TAG/FastDeploy/${tag_name}/latest/SM${compile_arch//,/_}
236+
target_path_stripped_latest="${target_path_latest#paddle-github-action/}"
230237
else
231-
commit_id=${GITHUB_SHA}
232-
target_path=paddle-github-action/Branch/FastDeploy/${commit_id}/SM${compile_arch//,/_}
233-
target_path_latest=paddle-github-action/Branch/FastDeploy/latest/SM${compile_arch//,/_}
238+
commit_id=${{ github.sha }}
239+
branch_name=${{ github.ref_name }}
240+
target_path=paddle-github-action/BRANCH/FastDeploy/${branch_name}/${commit_id}/SM${compile_arch//,/_}
241+
target_path_latest=paddle-github-action/BRANCH/FastDeploy/${branch_name}/latest/SM${compile_arch//,/_}
234242
target_path_stripped_latest="${target_path_latest#paddle-github-action/}"
235243
fi
236244
@@ -253,6 +261,16 @@ jobs:
253261
echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV
254262
fi
255263
fi
264+
265+
HAS_FAILED_TESTS=false
266+
unittest_result="failed_tests.log"
267+
if [ -s ${unittest_result} ]; then
268+
HAS_FAILED_TESTS=true
269+
python ${push_file} ${unittest_result} ${target_path}/UnitTestResult
270+
UNIT_TEST_RESULT_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/UnitTestResult/${unittest_result}
271+
echo "unittest_failed_url=${UNIT_TEST_RESULT_URL}" >> $GITHUB_OUTPUT
272+
echo "unittest_failed_url=${UNIT_TEST_RESULT_URL}" >> $GITHUB_ENV
273+
fi
256274
257275
if [[ "$IS_PR" != "true" ]]; then
258276
full_cov_file="full_coverage_report.txt"
@@ -266,22 +284,14 @@ jobs:
266284
echo "full_coverage_report_url=${FULL_COV_FILE_URL}" >> $GITHUB_ENV
267285
fi
268286
269-
if [ -f ${full_cov_csv} ]; then
287+
if [ "$HAS_FAILED_TESTS" = false ] && [ -f ${full_cov_csv} ]; then
270288
python ${push_file} ${full_cov_csv} ${target_path}/CoverageData
271289
python ${push_file} ${full_cov_csv} ${target_path_latest}/CoverageData
272290
FULL_COV_CSV_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${full_cov_csv}
273291
echo "full_coverage_csv_url=${FULL_COV_CSV_URL}" >> $GITHUB_OUTPUT
274292
echo "full_coverage_csv_url=${FULL_COV_CSV_URL}" >> $GITHUB_ENV
275293
fi
276294
fi
277-
278-
unittest_result="failed_tests.log"
279-
if [ -s ${unittest_result} ]; then
280-
python ${push_file} ${unittest_result} ${target_path}/UnitTestResult
281-
UNIT_TEST_RESULT_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/UnitTestResult/${unittest_result}
282-
echo "unittest_failed_url=${UNIT_TEST_RESULT_URL}" >> $GITHUB_OUTPUT
283-
echo "unittest_failed_url=${UNIT_TEST_RESULT_URL}" >> $GITHUB_ENV
284-
fi
285295
- name: Check Unit Test Success
286296
shell: bash
287297
run: |

0 commit comments

Comments
 (0)