1
- name : PR-CI- Coverage
1
+ name : Coverage
2
2
3
3
on :
4
4
workflow_call :
@@ -171,7 +171,7 @@ jobs:
171
171
rm -rf ./python/build/lib.linux-x86_64-3.9/
172
172
cd "${work_dir}/build/third_party" && find $(ls | grep -v "dlpack" | grep -v "install" | grep -v "eigen3" | grep -v "gflags") -type f ! -name "*.so" -a ! -name "libdnnl.so*" -delete
173
173
cd /
174
- tar --use-compress-program="pzstd -1" -cpf Paddle.tar.gz paddle
174
+ tar --use-compress-program="pzstd -1" -cf Paddle.tar.gz paddle
175
175
'
176
176
177
177
- name : Upload coverage product
@@ -218,21 +218,8 @@ jobs:
218
218
needs : build
219
219
if : needs.build.outputs.can-skip != 'true'
220
220
runs-on :
221
- group : BD_BJ_v100
221
+ group : BD_BJ-V100
222
222
steps :
223
- - name : Download paddle.tar.gz and update test branch
224
- run : |
225
- set -e
226
- echo "Downloading Paddle.tar.gz"
227
- wget -q --no-proxy https://paddle-github-action.bj.bcebos.com/PR/coverage/${PR_ID}/${COMMIT_ID}/Paddle.tar.gz --no-check-certificate
228
- echo "Extracting Paddle.tar.gz"
229
- tar --use-compress-program='pzstd -1' -xpf Paddle.tar.gz --strip-components=1
230
- rm Paddle.tar.gz
231
- source ${{ github.workspace }}/../../../proxy
232
- git checkout test
233
- echo "Pull upstream develop"
234
- git pull upstream $BRANCH --no-edit
235
-
236
223
- name : Check docker image and run container
237
224
env :
238
225
CACHE_DIR : " /root/.cache/coverage"
@@ -303,6 +290,22 @@ jobs:
303
290
-e GITHUB_API_TOKEN \
304
291
-w /paddle --network host ${docker_image}
305
292
293
+ - name : Download paddle.tar.gz and update test branch
294
+ run : |
295
+ docker exec -t ${{ env.container_name }} /bin/bash -c '
296
+ rm -rf * .[^.]*
297
+ set -e
298
+ echo "Downloading Paddle.tar.gz"
299
+ wget -q --no-proxy https://paddle-github-action.bj.bcebos.com/PR/coverage/${PR_ID}/${COMMIT_ID}/Paddle.tar.gz --no-check-certificate
300
+ echo "Extracting Paddle.tar.gz"
301
+ tar --use-compress-program="pzstd -1" -xf Paddle.tar.gz --strip-components=1
302
+ rm Paddle.tar.gz
303
+ source ${{ github.workspace }}/../../../proxy
304
+ git checkout test
305
+ echo "Pull upstream develop"
306
+ git pull upstream $BRANCH --no-edit
307
+ '
308
+
306
309
- name : Test
307
310
run : |
308
311
docker exec -t ${{ env.container_name }} /bin/bash -c '
@@ -315,33 +318,43 @@ jobs:
315
318
fi
316
319
'
317
320
318
- - name : Check coverage data
321
+ - name : Generate coverage information
319
322
run : |
320
323
docker exec -t ${{ env.container_name }} /bin/bash -c '
321
324
source ~/.bashrc
322
325
unset GREP_OPTIONS
323
326
source ${{ github.workspace }}/../../../proxy
324
327
source ${ci_scripts}/utils.sh; check_coverage
325
- COVERAGE_EXIT_CODE=$?
326
- echo "COVERAGE_EXIT_CODE=${COVERAGE_EXIT_CODE}" >> ${{ github.env }}
327
328
'
328
329
329
330
- name : Upload coverage report
330
331
uses : codecov/codecov-action@v4
331
332
with :
332
333
directory : build/coverage_files
333
334
334
- - name : Judge coverage passed or not
335
+ - name : Determine whether the coverage rate reaches 90%
335
336
run : |
336
- if [ "${{ env.COVERAGE_EXIT_CODE }}" -ne 0 ]; then
337
- echo "Coverage failed"
338
- exit ${{ env.COVERAGE_EXIT_CODE }}
337
+ docker exec -t ${{ env.container_name }} /bin/bash -c '
338
+ source ~/.bashrc
339
+ unset GREP_OPTIONS
340
+ source ${{ github.workspace }}/../../../proxy
341
+ source ${ci_scripts}/utils.sh
342
+ bash $ci_scripts/coverage_judge.sh
343
+ COVERAGE_EXIT_CODE=$?
344
+ echo $COVERAGE_EXIT_CODE
345
+ if [ "$COVERAGE_EXIT_CODE" -ne 0 ]; then
346
+ echo "Coverage check failed, unit tests have all passed, please do not rerun, check whether the newly added code lines are fully covered by unit tests. If you have any questions, please contact XieYunshen."
347
+ exit $COVERAGE_EXIT_CODE
348
+ else
349
+ echo "Coverage passed"
339
350
fi
351
+ '
340
352
341
353
- name : Terminate and delete the container
342
354
if : always()
343
355
run : |
344
356
set +e
357
+ rm Paddle.tar.gz
345
358
docker exec -t ${{ env.container_name }} /bin/bash -c 'rm -rf * .[^.]*'
346
359
docker stop ${{ env.container_name }}
347
360
docker rm ${{ env.container_name }}
0 commit comments