27
27
required : false
28
28
type : string
29
29
default : " "
30
+ outputs :
31
+ gpu_cov_file_url :
32
+ description : " Output path of the GPU tests"
33
+ value : ${{ jobs.run_tests_with_coverage.outputs.gpu_cov_file_url }}
30
34
secrets :
31
35
github-token :
32
36
required : true
45
49
needs : check_cov_skip
46
50
if : needs.check_cov_skip.outputs.can-skip != 'true'
47
51
outputs :
48
- diff_cov_file_url : ${{ steps.cov_upload.outputs.diff_cov_file_url }}
52
+ gpu_cov_file_url : ${{ steps.cov_upload.outputs.gpu_cov_file_url }}
49
53
unittest_failed_url : ${{ steps.cov_upload.outputs.unittest_failed_url }}
50
- diff_cov_result_json_url : ${{ steps.cov_upload.outputs.diff_cov_result_json_url }}
51
54
steps :
52
55
- name : Code Prepare
53
56
shell : bash
@@ -184,22 +187,14 @@ jobs:
184
187
else
185
188
echo "Warning: tests/plugins directory not found, skipping setup.py install"
186
189
fi
187
- export COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage
190
+ export COVERAGE_FILE=/workspace/FastDeploy/coveragedata/.coverage.gpu
188
191
export COVERAGE_RCFILE=/workspace/FastDeploy/scripts/.coveragerc
189
192
TEST_EXIT_CODE=0
190
193
bash scripts/coverage_run.sh || TEST_EXIT_CODE=8
191
194
echo "TEST_EXIT_CODE=${TEST_EXIT_CODE}" >> exit_code.env
192
195
coverage combine coveragedata/ || echo "No data to combine"
196
+ tar -cvf gpu_coverage.tar -C coveragedata .
193
197
coverage report
194
- coverage xml -o python_coverage_all.xml
195
- COVERAGE_EXIT_CODE=0
196
- if [[ "$IS_PR" == "true" ]]; then
197
- diff-cover python_coverage_all.xml --diff-file=diff.txt --fail-under=80 --json-report diff_coverage.json || COVERAGE_EXIT_CODE=9
198
- python scripts/generate_diff_coverage_xml.py diff.txt python_coverage_all.xml
199
- else
200
- echo "Not a PR, skipping diff-cover"
201
- fi
202
- echo "COVERAGE_EXIT_CODE=${COVERAGE_EXIT_CODE}" >> exit_code.env
203
198
'
204
199
if [ -f FastDeploy/exit_code.env ]; then
205
200
cat FastDeploy/exit_code.env >> $GITHUB_ENV
@@ -211,26 +206,18 @@ jobs:
211
206
cd FastDeploy
212
207
commit_id=${{ github.event.pull_request.head.sha }}
213
208
pr_num=${{ github.event.pull_request.number }}
214
- target_path=paddle-github-action/PR/FastDeploy/${pr_num}/${commit_id}/SM${compile_arch//,/_}
209
+ target_path=paddle-github-action/PR/FastDeploy/${pr_num}/${commit_id}/GPU/
215
210
wget -q --no-proxy --no-check-certificate https://paddle-qa.bj.bcebos.com/CodeSync/develop/PaddlePaddle/PaddleTest/tools/bos_tools.py -O bos_tools.py
216
211
push_file=$(realpath bos_tools.py)
217
212
python -m pip install bce-python-sdk==0.9.29
218
- diff_cov_file="diff_coverage.xml "
219
- if [ -f ${diff_cov_file } ];then
220
- python ${push_file} ${diff_cov_file } ${target_path}/CoverageData
213
+ cov_file="gpu_coverage.tar "
214
+ if [ -f ${cov_file } ];then
215
+ python ${push_file} ${cov_file } ${target_path}/CoverageData
221
216
target_path_stripped="${target_path#paddle-github-action/}"
222
- DIFF_COV_FILE_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${diff_cov_file}
223
- echo "diff_cov_file_url=${DIFF_COV_FILE_URL}" >> $GITHUB_OUTPUT
224
- echo "diff_cov_file_url=${DIFF_COV_FILE_URL}" >> $GITHUB_ENV
225
- fi
226
- diff_cov_result_json="diff_coverage.json"
227
- if [ -f ${diff_cov_result_json} ];then
228
- python ${push_file} ${diff_cov_result_json} ${target_path}/CoverageData
229
- target_path_stripped="${target_path#paddle-github-action/}"
230
- DIFF_COV_JSON_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${diff_cov_result_json}
231
- echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_OUTPUT
232
- echo "diff_cov_result_json_url=${DIFF_COV_JSON_URL}" >> $GITHUB_ENV
217
+ GPU_COV_FILE_URL=https://paddle-github-action.bj.bcebos.com/${target_path_stripped}/CoverageData/${cov_file}
218
+ echo "gpu_cov_file_url=${GPU_COV_FILE_URL}" >> $GITHUB_OUTPUT
233
219
fi
220
+
234
221
unittest_result="failed_tests.log"
235
222
if [ -s ${unittest_result} ];then
236
223
python ${push_file} ${unittest_result} ${target_path}/UnitTestResult
@@ -259,61 +246,3 @@ jobs:
259
246
exit "$TEST_EXIT_CODE"
260
247
fi
261
248
echo "All tests passed"
262
-
263
- - name : Verify Code Coverage Threshold (80%)
264
- if : ${{ github.event_name == 'pull_request' }}
265
- shell : bash
266
- run : |
267
- cd FastDeploy
268
- if [ "$COVERAGE_EXIT_CODE" -eq 9 ]; then
269
- echo "Coverage generation failed (exit code 9)"
270
- filename=$(basename "$diff_cov_result_json_url")
271
- if [ -z "${diff_cov_result_json_url}" ]; then
272
- echo "No diff cov result file URL provided."
273
- else
274
- rm -rf "${filename}"
275
- wget -O ${filename} ${diff_cov_result_json_url} || echo "Download cov json file failed, but continuing..."
276
- fi
277
- if [ -f "${filename}" ];then
278
- echo "Failed test cases:"
279
- if command -v jq >/dev/null 2>&1; then
280
- jq . "${filename}"
281
- else
282
- cat "${filename}"
283
- fi
284
- fi
285
- exit "$COVERAGE_EXIT_CODE"
286
- fi
287
- echo "coverage passed"
288
- exit 0
289
-
290
- diff_coverage_report :
291
- needs : run_tests_with_coverage
292
- if : always()
293
- runs-on : ubuntu-latest
294
- env :
295
- fd_archive_url : ${{ inputs.FASTDEPLOY_ARCHIVE_URL }}
296
- steps :
297
- - name : coverage diff file download
298
- shell : bash
299
- env :
300
- diff_cov_file_url : ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url }}
301
- run : |
302
- wget ${fd_archive_url}
303
- tar -xf FastDeploy.tar.gz
304
- cd FastDeploy
305
- if [ -z "${diff_cov_file_url}" ]; then
306
- echo "No diff coverage file URL provided."
307
- exit 0
308
- fi
309
- wget "${diff_cov_file_url}" -O ./diff_coverage.xml || echo "Download cov file failed, but continuing..."
310
- - name : Upload diff coverage report
311
- if : ${{ needs.run_tests_with_coverage.outputs.diff_cov_file_url != null && needs.run_tests_with_coverage.outputs.diff_cov_file_url != '' }}
312
- uses : codecov/codecov-action@v5
313
- with :
314
- files : ./FastDeploy/diff_coverage.xml
315
- name : python diff coverage
316
- verbose : true
317
- disable_search : true
318
- commit_parent : false
319
- flags : diff
0 commit comments