diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index ad6f08b..ac72052 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -4,7 +4,6 @@ on: [pull_request] jobs: coverage: - runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -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 diff --git a/README.md b/README.md index 6a96e01..9e002b0 100644 --- a/README.md +++ b/README.md @@ -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`