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

Add badges #28

Closed
wants to merge 16 commits into from
50 changes: 47 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will run unit tests on pull requests or when manually activated

name: test
name: pytest

on:
push:
Expand All @@ -24,9 +24,53 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install
run: pip install .[test]

- name: Run tests
run: pytest
run: |
coverage run -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html


## everything from here deals with generating and uploading reports and badges to a separate "badges" repo.
- name: Create reports and badges
if: github.ref_name == 'main' && matrix.os == 'ubuntu-latest'
run: |
coverage xml -o reports/coverage/coverage.xml
coverage html -d reports/coverage/
genbadge coverage -i reports/coverage/coverage.xml
genbadge tests -i reports/junit/junit.xml


- name: Make badge dir
if: github.ref_name == 'main' && matrix.os == 'ubuntu-latest'
run: |
mkdir -p badges
mv *badge.svg badges

- name: Setup assets dir
if: github.ref_name == 'main' && matrix.os == 'ubuntu-latest'
run: |
mkdir assets
mv badges assets/
mv reports assets/

- name: Clone badges repo
if: github.ref_name == 'main' && matrix.os == 'ubuntu-latest'
run: |
git clone --branch=gh-pages https://${{ secrets.TARGET_REPO_ACCESS_TOKEN }}@github.com/qupath/badges.git badges
## cba handling merging or dealing with stale resources
rm -rf badges/${{ github.event.repository.name }}
mkdir -p badges/${{ github.event.repository.name }}
mv assets/* badges/${{github.event.repository.name}}/

- name: Deploy badges to gh-pages
if: github.ref_name == 'main' && matrix.os == 'ubuntu-latest'
run: |
cd badges
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update badges and reports"
git push
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,5 @@ dmypy.json
# Generated test images
*.tif
*.zarr
reports
*.svg
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[![Coverage](https://qupath.github.io/badges/badges/coverage-badge.svg?dummy=1234)](https://qupath.github.io/badges/reports/coverage/index.html?dummy=1234)
[![Tests](https://qupath.github.io/badges/badges/tests-badge.svg?dummy=1234)](https://qupath.github.io/badges/reports/junit/report.html?dummy=1234)
![Actions](https://github.com/qupath/qubalab/actions/workflows/tests.yml/badge.svg?dummy=1234)
# QuBaLab


This is a Python package for exploring quantitative bioimage analysis... *especially* (but not exclusively) in combination with QuPath (https://qupath.github.io/).

The name comes from **Quantitative Bioimage Analysis Laboratory**. This is chosen to be reminiscent of QuPath (*Quantitative Pathology*), but recognizes that neither is really restricted to pathology.
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ dev =
jupyter ~= 1.0.0
test =
pytest ~= 8.2.2
openslide =
pytest-html ~= 4.1.1
coverage ~= 7.6.5
genbadge[all] ~= 1.1.1
doc =
sphinx ~= 7.4.5
sphinx-rtd-theme ~= 2.0.0