ci: use reusable test workflow #1727
Workflow file for this run
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*] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" # run once a day | |
jobs: | |
test: | |
name: Test | |
uses: pyapp-kit/workflows/.github/workflows/test-pyrepo.yml@v1 | |
with: | |
os: ${{ matrix.os }} | |
python-version: ${{ matrix.python-version }} | |
qt: ${{ matrix.qt }} | |
pip-install-pre-release: ${{ github.event_name == 'schedule' }} | |
report-failures: ${{ github.event_name == 'schedule' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
qt: [pyqt5, pyside2] | |
include: | |
- python-version: "3.10" | |
os: ubuntu-latest | |
qt: pyqt6 | |
- python-version: "3.10" | |
os: ubuntu-latest | |
qt: pyside6 | |
- python-version: "3.12" | |
os: ubuntu-latest | |
qt: pyqt6 | |
exclude: | |
- python-version: "3.11" | |
qt: pyside2 | |
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-dependents: | |
uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@v1 | |
with: | |
dependency-repo: ${{ matrix.package }} | |
dependency-ref: ${{ matrix.package-version }} | |
dependency-extras: ${{ matrix.package-extras || 'testing' }} | |
host-extras: 'testing' | |
qt: pyqt5 | |
python-version: "3.10" | |
post-install-cmd: 'python -m pip install pytest-pretty' | |
pytest-args: ${{ matrix.pytest-args }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: napari/napari | |
pytest-args: napari/_tests/test_magicgui.py | |
- package: napari/napari | |
package-version: "v0.4.18" | |
pytest-args: napari/_tests/test_magicgui.py | |
- package: hanjinliu/magic-class | |
- package: stardist/stardist-napari | |
package-extras: test | |
pytest-args: stardist_napari | |
- package: 4DNucleome/PartSeg | |
package-extras: test | |
pytest-args: 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/* |