tiffslide: cut post release #242
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tiffslide ci | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
pull_request: {} | |
jobs: | |
# RUN PYTEST ON TIFFSLIDE SOURCE | |
tests: | |
name: pytest ${{ matrix.os }}::py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.11"] | |
include: | |
# we'll test the python support on ubuntu | |
- os: ubuntu-latest | |
python-version: "3.10" | |
- os: ubuntu-latest | |
python-version: "3.9" | |
- os: ubuntu-latest | |
python-version: "3.8" | |
steps: | |
- name: Checkout TiffSlide | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install TiffSlide | |
run: python -m pip install -e .[dev] | |
- name: Cache tiffslide/tests/data | |
uses: actions/cache@v3 | |
with: | |
path: tiffslide/tests/data | |
key: downloaded-slides | |
- name: Run Tests | |
run: pytest --cov=./tiffslide tiffslide | |
# RUN MYPY STATIC TYPE ANALYSIS ON TIFFSLIDE SOURCE | |
typing: | |
name: mypy type analysis | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[dev] | |
- name: Run mypy | |
run: | | |
mypy --install-types --non-interactive --python-version=3.8 tiffslide | |
# DEPLOY TIFFSLIDE TO TEST.PYPI ON SUCCESS | |
testdeploy: | |
needs: [tests, typing] | |
name: deploy to test.pypi | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel "setuptools_scm>=6.2" build | |
# we'll have to remove local_scheme for pushes to test.pypi pep440 | |
- name: Get version without local_scheme | |
id: non_local_version | |
run: | | |
python -m setuptools_scm | awk -F+ '{print "::set-output name=version::"$1}' | |
- name: Build a binary wheel and a source tarball | |
env: | |
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ steps.non_local_version.outputs.version }} | |
run: | | |
python -m build . | |
# push all versions on master to test.pypi.org | |
- name: Publish package to TestPyPI | |
continue-on-error: true | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.test_pypi_password }} | |
repository_url: https://test.pypi.org/legacy/ | |
# DEPLOY TIFFSLIDE TO PYPI ON SUCCESS | |
deploy: | |
needs: [tests, typing] | |
name: deploy to pypi | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python -m build . | |
# push all tagged versions to pypi.org | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |