From 2630800b8299127aaac10ddff0705c964951874a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 17:22:28 +0200 Subject: [PATCH 01/27] Upload generated coverage badge --- .github/workflows/TestCoverage.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index ad6f08b..9c49dff 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -30,4 +30,9 @@ jobs: C:\Miniconda\condabin\conda.bat list coverage run -m pytest coverage xml -o coverage.xml - genbadge coverage -i coverage.xml + genbadge coverage -i coverage.xml -o coverage-badge.svg + - name: Save coverage badge + uses: actions/upload-artifact@v4 + with: + name: coverage-badge + path: coverage-badge.svg From ce309b85ad653f3abe147ea0d47aeeed67dbbdae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 17:50:29 +0200 Subject: [PATCH 02/27] Dynamic test coverage badge (tbc) --- .github/workflows/TestCoverage.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 9c49dff..a8867b4 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -20,7 +20,6 @@ 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 @@ -30,9 +29,12 @@ jobs: C:\Miniconda\condabin\conda.bat list coverage run -m pytest coverage xml -o coverage.xml - genbadge coverage -i coverage.xml -o coverage-badge.svg - - name: Save coverage badge - uses: actions/upload-artifact@v4 + - name: Create Awesome Badge + uses: schneegans/dynamic-badges-action@v1.7.0 with: - name: coverage-badge - path: coverage-badge.svg + auth: ${{ secrets.TEST_COVERAGE_GIST }} + gistID: 8ec74eae558f3a7793622f6469064b73 + filename: test_coverage_badge.svg + label: Test coverage + message: TBD + color: orange From ae1378d852b000e02ffe4bcf2ffe1c9368f144cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 17:57:08 +0200 Subject: [PATCH 03/27] Add test coverage badge (tbc) to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6a96e01..77a0694 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.svg) # `dliswriter` From fc20bcb389b3d61f17b2cea32102310ae668f1ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 18:02:21 +0200 Subject: [PATCH 04/27] Use json mode for the dynamic badge --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index a8867b4..1eaaf2e 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -34,7 +34,7 @@ jobs: with: auth: ${{ secrets.TEST_COVERAGE_GIST }} gistID: 8ec74eae558f3a7793622f6469064b73 - filename: test_coverage_badge.svg + filename: test_coverage_badge.json label: Test coverage message: TBD color: orange From 0563a4ecbdd03699ae3f464c497ed8c6e8bd7bec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 18:02:51 +0200 Subject: [PATCH 05/27] Use json badge in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77a0694..9e002b0 100644 --- a/README.md +++ b/README.md @@ -1,5 +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.svg) +![Test coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/the-mysh/8ec74eae558f3a7793622f6469064b73/raw/test_coverage_badge.json) # `dliswriter` From bc9b2782d129c19d222f36b32007dcce242ce407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 18:29:43 +0200 Subject: [PATCH 06/27] Put total coverage percentage in the badge --- .github/workflows/TestCoverage.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 1eaaf2e..c0592c5 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -28,7 +28,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - coverage xml -o coverage.xml + echo "PCOV=$(coverage report --format total)" >> $GITHUB_ENV - name: Create Awesome Badge uses: schneegans/dynamic-badges-action@v1.7.0 with: @@ -36,5 +36,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: TBD - color: orange + message: ${{ env.PCOV }} + valColorRange: ${{ env.PCOV }} + maxColorRange: 100 + minColorRange: 0 From c6a8cfe9f0694793e271ae67cae56bf32e995056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Fri, 19 Apr 2024 18:39:19 +0200 Subject: [PATCH 07/27] Check with fixed coverage value --- .github/workflows/TestCoverage.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index c0592c5..e0dd5e7 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -20,7 +20,6 @@ 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 - C:\Miniconda\condabin\conda.bat list C:\Miniconda\condabin\conda.bat init powershell - name: Check coverage run: | @@ -28,15 +27,15 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "PCOV=$(coverage report --format total)" >> $GITHUB_ENV - - name: Create Awesome Badge + echo "PCOV=90" >> $GITHUB_ENV + - 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 }} + message: ${{ env.PCOV }}% valColorRange: ${{ env.PCOV }} maxColorRange: 100 minColorRange: 0 From 053e8e9f8f80bde72265204c384c1ed64b2354f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 09:56:00 +0200 Subject: [PATCH 08/27] Defining environment variable in TestCoverage.yml --- .github/workflows/TestCoverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index e0dd5e7..4e34c38 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -27,7 +27,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "PCOV=90" >> $GITHUB_ENV + echo "PCOV=90" >> "$GITHUB_ENV" - name: Create badge uses: schneegans/dynamic-badges-action@v1.7.0 with: @@ -35,7 +35,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: ${{ env.PCOV }}% - valColorRange: ${{ env.PCOV }} + message: "$PCOV %" + valColorRange: $PCOV maxColorRange: 100 minColorRange: 0 From 290506bfc03b99a60541c0ec13c3eb7c4115a522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 10:06:10 +0200 Subject: [PATCH 09/27] Formatting badge message in TestCoverage.yml --- .github/workflows/TestCoverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 4e34c38..a97e28e 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -27,7 +27,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "PCOV=90" >> "$GITHUB_ENV" + echo "PCOV=35" >> "$GITHUB_ENV" - name: Create badge uses: schneegans/dynamic-badges-action@v1.7.0 with: @@ -35,7 +35,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: "$PCOV %" + message: "${{ PCOV }}%" valColorRange: $PCOV maxColorRange: 100 minColorRange: 0 From 2089395348ab4b5fc68620dc128ade67bac531f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 10:39:39 +0200 Subject: [PATCH 10/27] TestCoverage.yml: use GITHUB_OUTPUT to pass variable --- .github/workflows/TestCoverage.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index a97e28e..d9e3a3c 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -21,21 +21,24 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat install coverage 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 - echo "PCOV=35" >> "$GITHUB_ENV" + echo "P_COV=35" >> "$GITHUB_OUTPUT" - name: Create badge + env: + P_COV: ${{ steps.check-coverage.outputs.P_COV }} 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: "${{ PCOV }}%" - valColorRange: $PCOV + message: "is $P_COV" + valColorRange: ${{ P_COV }} maxColorRange: 100 minColorRange: 0 From 2e92641037ea78858b9e27c47aea084e1d2fafcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 10:52:36 +0200 Subject: [PATCH 11/27] TestCoverage.yml using local variable --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index d9e3a3c..92e4643 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -39,6 +39,6 @@ jobs: filename: test_coverage_badge.json label: Test coverage message: "is $P_COV" - valColorRange: ${{ P_COV }} + valColorRange: $P_COV maxColorRange: 100 minColorRange: 0 From d7ad79349a991c0f1f1894945715d40c0997fcec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 11:06:36 +0200 Subject: [PATCH 12/27] Use the output directly in TestCoverage.yml --- .github/workflows/TestCoverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 92e4643..6695105 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -38,7 +38,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: "is $P_COV" - valColorRange: $P_COV + message: ${{ steps.check-coverage.outputs.P_COV }} + valColorRange: ${{ steps.check-coverage.outputs.P_COV }} maxColorRange: 100 minColorRange: 0 From 15bc3111abc5af52c96faecd27c8496a48af6bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 11:18:46 +0200 Subject: [PATCH 13/27] Test using local variable --- .github/workflows/TestCoverage.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 6695105..8c1755b 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -31,14 +31,14 @@ jobs: echo "P_COV=35" >> "$GITHUB_OUTPUT" - name: Create badge env: - P_COV: ${{ steps.check-coverage.outputs.P_COV }} + 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: ${{ steps.check-coverage.outputs.P_COV }} - valColorRange: ${{ steps.check-coverage.outputs.P_COV }} + message: "coverage is $P_COV per cent" + valColorRange: $P_COV maxColorRange: 100 minColorRange: 0 From db87a65389602468be85871ae5c2d4c1c22c763f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 11:27:12 +0200 Subject: [PATCH 14/27] Expression evaluation --- .github/workflows/TestCoverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 8c1755b..afa32fe 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -38,7 +38,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: "coverage is $P_COV per cent" - valColorRange: $P_COV + message: "coverage is ${{ P_COV }} per cent" + valColorRange: ${{ P_COV }} maxColorRange: 100 minColorRange: 0 From b46fe92dbf0dc1a7907678fd8c8e5501ac2c1187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 11:28:01 +0200 Subject: [PATCH 15/27] env. prefix for variable --- .github/workflows/TestCoverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index afa32fe..b998504 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -38,7 +38,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: "coverage is ${{ P_COV }} per cent" - valColorRange: ${{ P_COV }} + message: "coverage is ${{ env.P_COV }} per cent" + valColorRange: ${{ env.P_COV }} maxColorRange: 100 minColorRange: 0 From 115f447b9fef19c40b904b66c3d852218a6e496c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 11:36:33 +0200 Subject: [PATCH 16/27] Edit coverage message --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index b998504..6843f38 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -38,7 +38,7 @@ jobs: gistID: 8ec74eae558f3a7793622f6469064b73 filename: test_coverage_badge.json label: Test coverage - message: "coverage is ${{ env.P_COV }} per cent" + message: "${{ env.P_COV }}%" valColorRange: ${{ env.P_COV }} maxColorRange: 100 minColorRange: 0 From 406789833dc5fce6cbd1668672b2bdcae80a09ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 12:02:09 +0200 Subject: [PATCH 17/27] Use the output from check-coverage step --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 6843f38..66eef9d 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -31,7 +31,7 @@ jobs: echo "P_COV=35" >> "$GITHUB_OUTPUT" - name: Create badge env: - P_COV: 48 + P_COV: ${{ steps.check-coverage.outputs.P_COV }} uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From 93c0fe72e0166a6b274b1846743aa7d776a556ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 12:37:38 +0200 Subject: [PATCH 18/27] Setting output variable --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 66eef9d..af4d4b8 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -28,7 +28,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "P_COV=35" >> "$GITHUB_OUTPUT" + echo "P_COV=35" >> $GITHUB_OUTPUT - name: Create badge env: P_COV: ${{ steps.check-coverage.outputs.P_COV }} From 85563dfc817f100c4fb1f9a584f62e1f6d4ace78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 12:46:43 +0200 Subject: [PATCH 19/27] Try lowercase variable name --- .github/workflows/TestCoverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index af4d4b8..b47aff0 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -28,10 +28,10 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "P_COV=35" >> $GITHUB_OUTPUT + echo "pcov=35" >> $GITHUB_OUTPUT - name: Create badge env: - P_COV: ${{ steps.check-coverage.outputs.P_COV }} + P_COV: ${{ steps.check-coverage.outputs.pcov }} uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From 68efb776337b96fc36e7fdc382fa5ae9b8400709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 12:56:36 +0200 Subject: [PATCH 20/27] TestCoverage.yml - add environment name --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index b47aff0..6e83807 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -4,8 +4,8 @@ on: [pull_request] jobs: coverage: - runs-on: windows-latest + environment: tcenv steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 From e960cd0ce699ab752b3cb4e223945623ea4eee9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:06:24 +0200 Subject: [PATCH 21/27] TestCoverage.yml - environment variable --- .github/workflows/TestCoverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 6e83807..17bd946 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -29,9 +29,10 @@ jobs: C:\Miniconda\condabin\conda.bat list coverage run -m pytest echo "pcov=35" >> $GITHUB_OUTPUT + echo "pcov=45" >> "$GITHUB_ENV" - name: Create badge env: - P_COV: ${{ steps.check-coverage.outputs.pcov }} + P_COV: ${{ pcov }} uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From e04eabaae0839d079cb3ea71a381396374061f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:09:08 +0200 Subject: [PATCH 22/27] Using env variable --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 17bd946..8a6f8e4 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -32,7 +32,7 @@ jobs: echo "pcov=45" >> "$GITHUB_ENV" - name: Create badge env: - P_COV: ${{ pcov }} + P_COV: "pcov is: '${{ env.pcov }}'" uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From 7e48fe7cdc2fbc88848f870008b46869506a4bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:19:30 +0200 Subject: [PATCH 23/27] Use windows style setting of env variable --- .github/workflows/TestCoverage.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 8a6f8e4..c27686f 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -28,11 +28,10 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "pcov=35" >> $GITHUB_OUTPUT - echo "pcov=45" >> "$GITHUB_ENV" + Add-Content -Path ${env:GITHUB_ENV} -Value "p_cov=55" - name: Create badge env: - P_COV: "pcov is: '${{ env.pcov }}'" + P_COV: "pcov is: ${{ env.pcov }}" uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From be2ee2a2b7db29dff9b6ef984c7a8ea1ed793508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:31:00 +0200 Subject: [PATCH 24/27] Remove env name --- .github/workflows/TestCoverage.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index c27686f..ec617ed 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -5,7 +5,6 @@ on: [pull_request] jobs: coverage: runs-on: windows-latest - environment: tcenv steps: - uses: actions/checkout@v3 - name: Set up Python 3.11 @@ -31,7 +30,7 @@ jobs: Add-Content -Path ${env:GITHUB_ENV} -Value "p_cov=55" - name: Create badge env: - P_COV: "pcov is: ${{ env.pcov }}" + P_COV: "pcov: ${{ env.pcov }}" uses: schneegans/dynamic-badges-action@v1.7.0 with: auth: ${{ secrets.TEST_COVERAGE_GIST }} From 5ceb60bb586e2b34201eeab58e4aac9594654fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:33:37 +0200 Subject: [PATCH 25/27] Use another windows-style option to save env variable --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index ec617ed..7afe0e5 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -27,7 +27,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - Add-Content -Path ${env:GITHUB_ENV} -Value "p_cov=55" + echo "pcov=55" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Create badge env: P_COV: "pcov: ${{ env.pcov }}" From 0556881852bfce6c70b9e8aceb0f2c2f392436b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:42:05 +0200 Subject: [PATCH 26/27] Use env.pcov directly --- .github/workflows/TestCoverage.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 7afe0e5..383f988 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -29,15 +29,13 @@ jobs: coverage run -m pytest echo "pcov=55" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Create badge - env: - P_COV: "pcov: ${{ env.pcov }}" 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.P_COV }}%" - valColorRange: ${{ env.P_COV }} + message: "${{ env.pcov }}%" + valColorRange: ${{ env.pcov }} maxColorRange: 100 minColorRange: 0 From f7033eae1b932ab26113e64b765bfea63a8280a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominika=20D=C5=82ugosz?= Date: Mon, 22 Apr 2024 13:49:49 +0200 Subject: [PATCH 27/27] Display the actual coverage value --- .github/workflows/TestCoverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestCoverage.yml b/.github/workflows/TestCoverage.yml index 383f988..ac72052 100644 --- a/.github/workflows/TestCoverage.yml +++ b/.github/workflows/TestCoverage.yml @@ -27,7 +27,7 @@ jobs: C:\Miniconda\condabin\conda.bat activate base C:\Miniconda\condabin\conda.bat list coverage run -m pytest - echo "pcov=55" | Out-File -FilePath $env:GITHUB_ENV -Append + 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: