Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 72 additions & 42 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: test and deploy

on:
push:
branches:
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v*"
pull_request:
branches:
- main
Expand All @@ -18,76 +15,109 @@ jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
matrix:
# platform: [ubuntu-latest, windows-latest] # , macos-latest
platform: [ubuntu-latest]
python-version: ['3.8', '3.9'] #issues with monai and 3.10; pausing for now. users should use python 3.9
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip

# these libraries enable testing on Qt on linux
- uses: tlambert03/setup-qt-libs@v1
- name: Install Qt libraries on Linux
if: runner.os == 'Linux'
uses: tlambert03/setup-qt-libs@v1

# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
if: runner.os == 'Windows'
shell: pwsh
run: |
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {Exit 0} else {Exit 1}

# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Install dependencies
./gl-ci-helpers/appveyor/install_opengl.ps1
if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {
exit 0
} else {
exit 1
}

- name: Install tox
run: |
python -m pip install --upgrade pip
python -m pip install setuptools tox tox-gh-actions
python -m pip install tifffile
python -m pip install monai[nibabel,einops,tifffile]
# pip install git+https://github.com/lucasb-eyer/pydensecrf.git@master#egg=pydensecrf

# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
uses: GabrielBB/xvfb-action@v1 # aganders3/headless-gui@v1
python -m pip install tox tox-gh-actions

- name: Test with tox on Linux
if: runner.os == 'Linux'
uses: GabrielBB/xvfb-action@v1
with:
run: python -m tox
env:
PLATFORM: ${{ matrix.platform }}
QT_API: pyqt6
PYTEST_QT_API: pyqt6
VISPY_USE_APP: pyqt6
QT_OPENGL: software
Comment thread
C-Achard marked this conversation as resolved.
PYVISTA_OFF_SCREEN: true

- name: Coverage
uses: codecov/codecov-action@v2
- name: Test with tox on Windows/macOS
if: runner.os != 'Linux'
run: python -m tox
env:
PLATFORM: ${{ matrix.platform }}
QT_API: pyqt6
PYTEST_QT_API: pyqt6
VISPY_USE_APP: pyqt6
QT_OPENGL: software
PYVISTA_OFF_SCREEN: true

- name: Upload coverage
if: matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v6
with:
files: ./coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install dependencies
python-version: "3.12"

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine build
- name: Build and publish
python -m pip install build twine

- name: Build package
run: |
python -m build

- name: Check package
run: |
python -m twine check dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python -m build .
twine upload dist/*
8 changes: 0 additions & 8 deletions .isort.cfg

This file was deleted.

7 changes: 6 additions & 1 deletion napari_cellseg3d/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""napari-cellseg3d - napari plugin for cell segmentation."""

__version__ = "0.2.2"
try:
from napari_cellseg3d._version import version as __version__
except ImportError:
from importlib.metadata import version

__version__ = version("napari_cellseg3d")
18 changes: 0 additions & 18 deletions napari_cellseg3d/_tests/conftest.py

This file was deleted.

2 changes: 0 additions & 2 deletions napari_cellseg3d/_tests/pytest.ini

This file was deleted.

Loading
Loading