@@ -17,7 +17,7 @@ function onError() {
1717
1818trap onError ERR
1919
20- function init-log () {
20+ function initLog () {
2121 if [ ! -d " ${logFilePath} " ]; then
2222 mkdir -p " ${logFilePath} "
2323 fi
@@ -27,28 +27,51 @@ function init-log() {
2727 fi
2828}
2929
30- function edit-readme () {
30+ function editReadme () {
3131 trap onError ERR
3232
3333 echo " Edit README.md"
3434
35- readonly releaseBadge=" [](https:\/\/github.com\/steevanb\/php-parallel-processes\/tree\/${version} )"
35+ local releaseBadge=" [](https:\/\/github.com\/steevanb\/php-parallel-processes\/tree\/${version} )"
3636 sed -i " 1s/.*/${releaseBadge} /" " ${rootDir} " /README.md
3737
38- readonly codeLines=$( " ${rootDir} " /bin/release/code-lines)
39- readonly codeLinesBadge=" "
38+ local codeLines=
39+ codeLines=$( " ${rootDir} " /bin/release/code-lines)
40+ local codeLinesBadge=" "
4041 sed -i " 3s/.*/${codeLinesBadge} /" " ${rootDir} " /README.md
4142}
4243
43- function edit-coverage () {
44+ function editCoverage () {
4445 echo " Calculate coverage"
4546
46- readonly coveragePercent=" $( ${rootDir} /bin/release/phpunit-coverage) "
47+ local coveragePercent=
48+ coveragePercent=" $( ${rootDir} /bin/release/phpunit-coverage) "
4749 echo " Coverage: ${coveragePercent} %"
48- readonly coverageBadge=" "
49- sed -i " 6s/.*/${coverageBadge} /" " ${rootDir} " /README.md
50+
51+ local badge=" "
52+ sed -i " 6s/.*/${badge} /" " ${rootDir} " /README.md
53+ }
54+
55+ function editInfection() {
56+ echo " Calculate Infection MSI"
57+
58+ local logsPath=" ${rootDir} " /var/ci/infection/logs.json
59+ if [ -f " ${logsPath} " ]; then
60+ rm " ${logsPath} "
61+ fi
62+
63+ " ${rootDir} " /bin/ci/infection > /dev/null
64+
65+ local infectionMsiPercent=
66+ infectionMsiPercent=$( jq -r " .stats.msi" < " ${logsPath} " )
67+ infectionMsiPercent=$( printf " %.0f" " ${infectionMsiPercent} " )
68+ echo " Infection MSI: ${infectionMsiPercent} %"
69+
70+ local badge=" "
71+ sed -i " 7s/.*/${badge} /" " ${rootDir} " /README.md
5072}
5173
52- init-log
53- edit-readme
54- edit-coverage
74+ initLog
75+ editReadme
76+ editCoverage
77+ editInfection
0 commit comments