Skip to content

TEST: Add test publishing to test.pypi.org #355

TEST: Add test publishing to test.pypi.org

TEST: Add test publishing to test.pypi.org #355

name: Build, test, package
on: [push,pull_request]
jobs:
test-python:
runs-on: ubuntu-20.04
strategy:
max-parallel: 2
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- flake8-python-git-tag: ""
- pooch-python-git-tag: ""
- pytest-python-git-tag: ""
steps:
- uses: actions/checkout@v2
- name: 'Free up disk space'
run: |
# Workaround for https://github.com/actions/virtual-environments/issues/709
df -h
sudo apt-get clean
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
sudo apt update
sudo apt install openslide-tools python3-openslide
python -m pip install --upgrade pip setuptools wheel
pip install 'flake8${{ matrix.flake8-python-git-tag }}' 'pooch${{ matrix.pooch-python-git-tag }}' 'pytest${{ matrix.pytest-python-git-tag }}'
pip install 'large-image[bioformats,ometiff,openjpeg,openslide,tiff]' 'scikit_image' --find-links https://girder.github.io/large_image_wheels
- name: Install histomics_stream
run: |
pip install .[tensorflow,torch,zarr]
# With Python 3.8, tensorflow downgrades typing-extensions, which appears to
# be unnecessary and breaks a dependency of large_image, so we overrule that
# next.
pip install --upgrade typing-extensions
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd test
pytest
shell: bash
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Set up Python "3.9"
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install pypa/build
run: >-
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: >-
python -m build --sdist --wheel --outdir dist/ .
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
skip-existing: true
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}