Skip to content

Commit

Permalink
nexttry
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrozas committed Dec 31, 2023
1 parent df2ed09 commit 7112d9f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,18 @@ jobs:
- name: Calculate coverage percentage
id: coverage_percentage
run: |
python -c "import xml.etree.ElementTree as ET; tree = ET.parse('coverage.xml'); total_lines = sum(int(elem.get('total')) for elem in tree.findall('.//line')); covered_lines = sum(int(elem.get('hits')) for elem in tree.findall('.//line')); coverage_percentage = round(covered_lines / total_lines * 100); print(coverage_percentage)"
python -c "
import xml.etree.ElementTree as ET
tree = ET.parse('coverage.xml')
lines = tree.findall('.//line')
total_lines = sum(int(elem.get('total', 0)) for elem in lines)
covered_lines = sum(int(elem.get('hits', 0)) for elem in lines)
if total_lines == 0:
coverage_percentage = 100 # Assuming 100% coverage if total_lines is 0 to avoid division by zero
else:
coverage_percentage = round(covered_lines / total_lines * 100)
print(coverage_percentage)
"
shell: bash

- name: Create coverage badge
Expand Down

0 comments on commit 7112d9f

Please sign in to comment.