[workflow] fixed the test coverage report (#2614)

* [workflow] fixed the test coverage report

* polish code
pull/2618/head
Frank Lee 2023-02-07 11:50:53 +08:00 committed by GitHub
parent b3973b995a
commit aa7e9e4794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 14 deletions

View File

@ -46,14 +46,17 @@ jobs:
run: |
covNum=$(cat cov_number)
title="The code coverage for the changed files is ${covNum}%."
(echo $title; cat coverage.txt) > coverage_tmp.txt
mv coverage_tmp.txt coverage.txt
sed -i '2 i <details>' coverage.txt
sed -i '3 i <summary>Click me to view the complete report</summary>' coverage.txt
sed -i '4 i \n' coverage.txt
sed -i '5 i \`\`\`text' coverage.txt
echo "\`\`\`" >> coverage.txt
echo "</details>" >> coverage.txt
touch coverage_report.txt
echo $title >> coverage_report.txt
echo " " >> coverage_report.txt
echo "<details>" >> coverage_report.txt
echo "<summary>Click me to view the complete report</summary>" >> coverage_report.txt
echo " " >> coverage_report.txt
echo "\`\`\`" >> coverage_report.txt
cat coverage.txt >> coverage_report.txt
echo "\`\`\`" >> coverage_report.txt
echo "</details>" >> coverage_report.txt
mv coverage_report.txt coverage.txt
- name: 'Comment on PR'
if: steps.unzip.outputs.hasReport == 'true'

View File

@ -1,6 +0,0 @@
avai=true
for i in $(seq 0 7);
do
gpu_used=$(nvidia-smi -i $i --query-gpu=memory.used --format=csv,noheader,nounits)
[ "$gpu_used" -le "10000" ] && avai=false
done