Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test coverage badge #30

Merged
merged 27 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2630800
Upload generated coverage badge
the-mysh Apr 19, 2024
ce309b8
Dynamic test coverage badge (tbc)
the-mysh Apr 19, 2024
ae1378d
Add test coverage badge (tbc) to readme
the-mysh Apr 19, 2024
fc20bcb
Use json mode for the dynamic badge
the-mysh Apr 19, 2024
0563a4e
Use json badge in readme
the-mysh Apr 19, 2024
bc9b278
Put total coverage percentage in the badge
the-mysh Apr 19, 2024
c6a8cfe
Check with fixed coverage value
the-mysh Apr 19, 2024
053e8e9
Defining environment variable in TestCoverage.yml
the-mysh Apr 22, 2024
290506b
Formatting badge message in TestCoverage.yml
the-mysh Apr 22, 2024
2089395
TestCoverage.yml: use GITHUB_OUTPUT to pass variable
the-mysh Apr 22, 2024
2e92641
TestCoverage.yml using local variable
the-mysh Apr 22, 2024
d7ad793
Use the output directly in TestCoverage.yml
the-mysh Apr 22, 2024
15bc311
Test using local variable
the-mysh Apr 22, 2024
db87a65
Expression evaluation
the-mysh Apr 22, 2024
b46fe92
env. prefix for variable
the-mysh Apr 22, 2024
115f447
Edit coverage message
the-mysh Apr 22, 2024
4067898
Use the output from check-coverage step
the-mysh Apr 22, 2024
93c0fe7
Setting output variable
the-mysh Apr 22, 2024
85563df
Try lowercase variable name
the-mysh Apr 22, 2024
68efb77
TestCoverage.yml - add environment name
the-mysh Apr 22, 2024
e960cd0
TestCoverage.yml - environment variable
the-mysh Apr 22, 2024
e04eaba
Using env variable
the-mysh Apr 22, 2024
7e48fe7
Use windows style setting of env variable
the-mysh Apr 22, 2024
be2ee2a
Remove env name
the-mysh Apr 22, 2024
5ceb60b
Use another windows-style option to save env variable
the-mysh Apr 22, 2024
0556881
Use env.pcov directly
the-mysh Apr 22, 2024
f7033ea
Display the actual coverage value
the-mysh Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading