Skip to content

Commit 66445eb

Browse files
authored
Configure GitHub action for displaying code coverage (#43)
1 parent fba23c9 commit 66445eb

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

.github/workflows/astro-testing.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111

1212
permissions:
1313
contents: read
14+
pull-requests: write
1415

1516
jobs:
1617
build:
@@ -23,19 +24,42 @@ jobs:
2324
uses: actions/setup-python@v3
2425
with:
2526
python-version: "3.12"
27+
2628
- name: Install dependencies
2729
run: |
2830
python -m pip install --upgrade pip
2931
pip install flake8 pytest
3032
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
3133
pip install -e .
34+
3235
- name: Lint with flake8
3336
run: |
34-
# Run flake8 using the .flake8 config file
3537
flake8
36-
- name: Run pytest under coverage
38+
39+
# run pytest under coverage and write results to an xml file
40+
- name: Run pytest
3741
run: |
3842
coverage run -m pytest
43+
coverage xml
44+
45+
# process coverage report into markdown format
3946
- name: Generate coverage report
40-
run: |
41-
coverage report -m
47+
uses: irongut/CodeCoverageSummary@v1.3.0
48+
with:
49+
filename: coverage.xml
50+
badge: true
51+
fail_below_min: true
52+
format: markdown
53+
hide_branch_rate: false
54+
hide_complexity: true
55+
indicators: true
56+
output: both
57+
thresholds: '70 90'
58+
59+
# post PR comment with code coverage information
60+
- name: Add Coverage PR Comment
61+
uses: marocchino/sticky-pull-request-comment@v2
62+
if: github.event_name == 'pull_request'
63+
with:
64+
recreate: true
65+
path: code-coverage-results.md

0 commit comments

Comments
 (0)