Skip to content

Test coverage badge #23

Test coverage badge

Test coverage badge #23

Workflow file for this run

name: Test Coverage
on: [pull_request]
jobs:
coverage:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: |
C:\Miniconda\condabin\conda.bat update -n base -c defaults conda
C:\Miniconda\condabin\conda.bat config --add channels conda-forge
C:\Miniconda\condabin\conda.bat config --set channel_priority strict
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
C:\Miniconda\condabin\conda.bat init powershell
- 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
echo "P_COV=35" >> "$GITHUB_OUTPUT"
- name: Create badge
env:
P_COV: 48
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: "coverage is $P_COV per cent"
valColorRange: $P_COV
maxColorRange: 100
minColorRange: 0