Skip to content

Commit

Permalink
Merge pull request #30 from well-id/test-coverage-workflow
Browse files Browse the repository at this point in the history
Test coverage badge
  • Loading branch information
the-mysh authored Apr 22, 2024
2 parents 9cd4ab3 + f7033ea commit 22394ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/TestCoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on: [pull_request]

jobs:
coverage:

runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -20,14 +19,23 @@ jobs:
C:\Miniconda\condabin\conda.bat env update --file environment.yaml --name base
C:\Miniconda\condabin\conda.bat activate base
C:\Miniconda\condabin\conda.bat install coverage
pip install genbadge[coverage]
C:\Miniconda\condabin\conda.bat list
C:\Miniconda\condabin\conda.bat init powershell
- name: Check coverage
- id: check-coverage
name: Check coverage
run: |
# Activate the testenv environment
C:\Miniconda\condabin\conda.bat activate base
C:\Miniconda\condabin\conda.bat list
coverage run -m pytest
coverage xml -o coverage.xml
genbadge coverage -i coverage.xml
echo "pcov=$(coverage report --format total)" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Create badge
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.TEST_COVERAGE_GIST }}
gistID: 8ec74eae558f3a7793622f6469064b73
filename: test_coverage_badge.json
label: Test coverage
message: "${{ env.pcov }}%"
valColorRange: ${{ env.pcov }}
maxColorRange: 100
minColorRange: 0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Linting and testing](https://github.com/well-id/dliswriter/actions/workflows/LintAndTest.yml/badge.svg)](https://github.com/well-id/dliswriter/actions/workflows/LintAndTest.yml)
![Test coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/the-mysh/8ec74eae558f3a7793622f6469064b73/raw/test_coverage_badge.json)

# `dliswriter`

Expand Down

0 comments on commit 22394ad

Please sign in to comment.