Ensure QImage is ARGB32 before converting to numpy (#618) #1731
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: tests | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
test: | |
name: ${{ matrix.platform }} (${{ matrix.python-version }}) ${{ matrix.backend }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
platform: [ubuntu-latest, macos-latest, windows-latest] | |
backend: [pyqt5, pyside2] | |
include: | |
- python-version: "3.10" | |
platform: ubuntu-latest | |
backend: pyqt6 | |
- python-version: "3.10" | |
platform: ubuntu-latest | |
backend: pyside6 | |
- python-version: "3.12" | |
platform: ubuntu-latest | |
backend: pyqt6 | |
exclude: | |
- python-version: "3.11" | |
backend: pyside2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: tlambert03/[email protected] | |
- name: Install dependencies | |
run: python -m pip install --upgrade hatch | |
- name: Test | |
uses: aganders3/headless-gui@v1 | |
with: | |
run: hatch -v run +backend=${{ matrix.backend }} test:run | |
- name: Coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
test-pydantic1: | |
name: Test pydantic1 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- uses: tlambert03/[email protected] | |
- name: Install dependencies | |
run: | | |
python -m pip install -e . | |
python -m pip install pytest 'pydantic<2' attrs pytest-cov pyqt6 | |
- name: Test | |
uses: aganders3/headless-gui@v1 | |
with: | |
run: pytest tests/test_ui_field.py -v --color=yes --cov=magicgui --cov-report=xml | |
- uses: codecov/codecov-action@v3 | |
test_napari: | |
name: napari tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: napari/napari | |
path: napari-from-github | |
- uses: tlambert03/[email protected] | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip pytest-pretty | |
python -m pip install -e .[testing] | |
python -m pip install -e ./napari-from-github[pyqt5] | |
- name: Test napari magicgui | |
uses: aganders3/headless-gui@v1 | |
with: | |
working-directory: napari-from-github | |
run: pytest -W ignore napari/_tests/test_magicgui.py -v --color=yes | |
test_magicclass: | |
name: magic-class tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: hanjinliu/magic-class | |
path: magic-class | |
- uses: tlambert03/[email protected] | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[testing,pyqt5] | |
python -m pip install ./magic-class[testing] | |
- name: Test magicclass | |
uses: aganders3/headless-gui@v1 | |
# magicclass is still in development, don't fail the whole build | |
# this makes this much less useful... but it's better than nothing? | |
continue-on-error: true | |
with: | |
working-directory: magic-class | |
run: pytest -v --color=yes | |
test_stardist: | |
name: stardist tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: stardist/stardist-napari | |
path: stardist-napari | |
- uses: tlambert03/[email protected] | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[testing] | |
python -m pip install ./stardist-napari[test] | |
- name: Run stardist tests | |
uses: aganders3/headless-gui@v1 | |
with: | |
working-directory: stardist-napari | |
run: python -m pytest -v --color=yes -W ignore stardist_napari | |
env: | |
STARDIST_NAPARI_NOTHREADS: true | |
STARDIST_NAPARI_NOPERSIST: true | |
test_partseg: | |
name: partseg tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: 4DNucleome/PartSeg | |
path: PartSeg | |
- uses: tlambert03/[email protected] | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install | |
run: | | |
python -m pip install -e .[testing] | |
python -m pip install ./PartSeg[test,pyqt5] | |
- name: Run PartSeg tests | |
uses: aganders3/headless-gui@v1 | |
with: | |
working-directory: PartSeg | |
run: python -m pytest -v --color=yes -W ignore package/tests/test_PartSeg/test_napari_widgets.py | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'pyapp-kit/magicgui' && contains(github.ref, 'tags') }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools setuptools_scm wheel twine build | |
- name: Build | |
run: | | |
git tag | |
python -m build | |
twine check dist/* | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
body_path: ${{ github.workspace }}/CHANGELOG.md | |
- name: Publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | |
run: twine upload dist/* |