From b8ebe06bc94890e1bf7c190caaf23292c2acad4c Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 29 Oct 2024 13:23:53 +0100 Subject: [PATCH 1/4] add coverage badge --- .github/workflows/build.yml | 16 +++++++++++++++- README.md | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c553eab4..f5a3308fe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,13 +50,27 @@ jobs: with: coverageFile: coverage.xml token: ${{ secrets.GITHUB_TOKEN }} - + - if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' + run: | + pip install genbadge[coverage] + genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg + coverage html -d dist/coverage + - if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' + uses: actions/upload-artifact@v4 + with: + name: coverage + retention-days: 1 + path: dist deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: coverage + path: dist - uses: actions/setup-python@v5 with: python-version: "3.12" diff --git a/README.md b/README.md index 58cdce47b..fbc16d130 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![downloads](https://static.pepy.tech/badge/bioimageio.spec)](https://pepy.tech/project/bioimageio.spec) [![conda-forge downloads](https://img.shields.io/conda/dn/conda-forge/bioimageio.spec.svg?label=conda-forge)](https://anaconda.org/conda-forge/bioimageio.spec/) ![code style](https://img.shields.io/badge/code%20style-black-000000.svg) +[![coverage](https://bioimage-io.github.io/spec-bioimage-io/coverage/coverage-badge.svg)](https://bioimage-io.github.io/spec-bioimage-io/coverage/index.html) # Specifications for bioimage.io From 3903a68296daff522ab6e8b1dc28b5a6f6e4c71b Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 29 Oct 2024 13:24:59 +0100 Subject: [PATCH 2/4] update .gitignore --- .gitignore | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0d5d9ce5b..fde0f363f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,17 @@ __pycache__/ +.coverage .env +.ipynb_checkpoints .vscode/launch.json +*.DS_Store *.egg-info/ build/ +coverage.xml dist/ docs/ -user_docs/ +output/ tests/cache tests/generated_json_schemas tmp/ -output/ -*.DS_Store -.ipynb_checkpoints +user_docs/ + From d8fd293ddd7076d293133b10ef612d9347c2373e Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 29 Oct 2024 13:36:00 +0100 Subject: [PATCH 3/4] deploy step now needs test for coverage artifact --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5a3308fe..cc590dfcb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,6 +64,7 @@ jobs: deploy: + needs: [test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From e2952b562e547592a9b7229273cb3779b38fc49d Mon Sep 17 00:00:00 2001 From: fynnbe Date: Tue, 29 Oct 2024 14:27:57 +0100 Subject: [PATCH 4/4] also create coverage badge for PRs --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc590dfcb..aa9083bbb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,12 +50,12 @@ jobs: with: coverageFile: coverage.xml token: ${{ secrets.GITHUB_TOKEN }} - - if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' + - if: matrix.python-version == '3.12' run: | pip install genbadge[coverage] genbadge coverage --input-file coverage.xml --output-file ./dist/coverage/coverage-badge.svg coverage html -d dist/coverage - - if: matrix.python-version == '3.12' && github.ref == 'refs/heads/main' + - if: matrix.python-version == '3.12' uses: actions/upload-artifact@v4 with: name: coverage