Skip to content

🆕 Add Reading Slide-level info & Simple Plugins for Visualization Tool #3993

🆕 Add Reading Slide-level info & Simple Plugins for Visualization Tool

🆕 Add Reading Slide-level info & Simple Plugins for Visualization Tool #3993

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ develop, pre-release, master, main ]
tags: v*
pull_request:
branches: [ develop, pre-release, master, main ]
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt update
sudo apt-get install -y libopenslide-dev openslide-tools libopenjp2-7 libopenjp2-tools
python -m pip install --upgrade pip
python -m pip install ruff==0.7.4 pytest pytest-cov pytest-runner
pip install -r requirements/requirements.txt
- name: Cache tiatoolbox static assets
uses: actions/cache@v3
with:
key: tiatoolbox-home-static
path: ~/.tiatoolbox
- name: Print Version Information
run: |
echo "---SQlite---"
sqlite3 --version
sqlite3 ":memory:" -list ".output stdout" "pragma compile_options" ".exit"
echo "---Openslide---"
openslide-quickhash1sum --version
echo "---OpenJPEG---"
opj_dump -h | head -n 5
echo "---Python---"
python -c "import sys; print('Python %s' % sys.version)"
python -c "import sqlite3; print('SQLite %s' % sqlite3.sqlite_version)"
python -c "import numpy; print('Numpy %s' % numpy.__version__)"
python -c "import openslide; print('OpenSlide %s' % openslide.__version__)"
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
ruff check .
- name: Test with pytest
run: |
pytest --basetemp={envtmpdir} \
--cov=tiatoolbox --cov-report=term --cov-report=xml --cov-config=pyproject.toml \
--capture=sys \
--durations=10 --durations-min=1.0 \
--maxfail=1
- name: Report test coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: coverage.xml
fail_ci_if_error: false
verbose: true
- name: Report test coverage to DeepSource
uses: deepsourcelabs/test-coverage-action@master
with:
key: python
coverage-file: coverage.xml
dsn: ${{ secrets.DEEPSOURCE_DSN }}
fail-ci-on-error: false
release:
runs-on: ubuntu-24.04
timeout-minutes: 15
needs: build
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pre-release' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
sudo apt-get install -y libopenslide-dev libopenjp2-7
python -m pip install --upgrade pip
pip install -r requirements/requirements.txt
pip install build
- name: Build package
run: python -m build
- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true # Ignore errors if the current version exists already
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags/v') # Only run on tags starting with v
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}