run: |
pip install git+https://github.com/gcovr/gcovr.git
+ - name: Clone report repo
+ run: |
+ git clone https://github.com/fennecdjay/gwion-coverage-report
+ rm -f gwion-coverage-report/*.html
+
- name: Generate Report
run: |
- COV_TXT=$(gcovr -s --html-details cov.html --filter '.*\.c$' src | grep lines | cut -d" " -f2)
+ COV_TXT=$(gcovr -s --html-details gwion-coverage-report/index.html --filter '.*\.c$' src | grep lines | cut -d" " -f2)
COV_NUM=${COV_TXT: : -1}
- COV_INT=${COV_NUM: : -2}
- if [ $COV_INT -ge 90 ]
+ echo $COV_NUM > gwion-coverage-report/coverage_num.txt
+ if [ $(python -c "print( $COV_NUM >= 90 )") = True ]
then COLOR=green
- elif [ $COV_INT -ge 75 ]
+ elif [ $(python -c "print( $COV_NUM >= 75 )") = True ]
then COLOR=yellow
else COLOR=red
fi
while true
- do wget https://badgen.net/badge/coverage/$COV_NUM/$COLOR -O badge.svg && break
+ do wget https://badgen.net/badge/coverage/$COV_NUM/$COLOR -O gwion-coverage-report/badge.svg && break
done
- name: Push Report
run: |
- git clone https://github.com/fennecdjay/gwion-coverage-report
cd gwion-coverage-report
- rm -f *.html *.svg
- cp ../*.html .
- convert -size 1024x1024 ../badge.svg badge.png
- cp ../badge.svg badge.svg
- mv cov.html index.html
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .