File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 push :
55 branches :
66 - main
7- - dev
8- - demo
9- - hotfix
7+ - demo-v4
108 - dev-v4
11- - macae-v4-unittestcases-kd
129 pull_request :
1310 types :
1411 - opened
1714 - synchronize
1815 branches :
1916 - main
20- - dev
21- - demo
22- - hotfix
17+ - demo-v4
18+ - dev-v4
2319
2420jobs :
2521 test :
@@ -54,10 +50,20 @@ jobs:
5450 if : env.skip_tests == 'false'
5551 run : |
5652 python -m pytest src/tests/backend/test_app.py --cov=backend.app --cov-report= --cov-config=.coveragerc -q > /dev/null 2>&1
57- python -m pytest src/tests/backend --cov=backend --cov-append --cov-report= --cov-config=.coveragerc --ignore=src/tests/backend/test_app.py 2>&1 | tee /tmp/pytest_output.txt
53+ python -m pytest src/tests/backend --cov=backend --cov-append --cov-report=xml --cov-report= --cov-config=.coveragerc --ignore=src/tests/backend/test_app.py 2>&1 | tee /tmp/pytest_output.txt
5854 python -m coverage report --rcfile=.coveragerc
5955 tail -1 /tmp/pytest_output.txt
6056
57+ # Check coverage threshold
58+ if [ -f coverage.xml ]; then
59+ COVERAGE=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); root = tree.getroot(); print(float(root.attrib['line-rate']) * 100)")
60+ echo "Coverage: $COVERAGE%"
61+ if (( $(echo "$COVERAGE < 80" | bc -l) )); then
62+ echo "Coverage is below 80%, failing the job."
63+ exit 1
64+ fi
65+ fi
66+
6167 - name : Skip coverage report if no tests
6268 if : env.skip_tests == 'true'
6369 run : |
You can’t perform that action at this time.
0 commit comments