Skip to content

tests

tests #114

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
schedule:
- cron: "0 16 * * 1" # monday at noon est
workflow_dispatch:
jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{ matrix.pydantic }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
pydantic: [""]
include:
- platform: windows-latest
python-version: "3.8"
pydantic: "'pydantic<2'"
- platform: windows-latest
python-version: "3.11"
pydantic: "'pydantic<2'"
- platform: ubuntu-latest
python-version: "3.11"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Downgrade pydantic
if: ${{ matrix.pydantic }}
run: pip install ${{ matrix.pydantic }}
- name: Cache Linux Build
id: cache-mm-build
if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: ~/.local/share/pymmcore-plus/
key: ${{ runner.os }}-mmbuild-${{ hashFiles('src/pymmcore_plus/_build.py') }}
- name: Build Micro-Manager
if: runner.os == 'Linux' && steps.cache-mm-build.outputs.cache-hit != 'true'
run: mmcore build-dev
- name: Install Micro-Manager
if: runner.os != 'Linux'
run: mmcore install
- name: Remove Qt
if: runner.os == 'Linux'
run: pip uninstall -y pytest-qt qtpy PySide2 PyQt5 PyQt6 PySide6
- name: Test
run: pytest -v --color=yes --cov=pymmcore_plus --cov-report=xml
- name: Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
test_widgets:
name: mmcore-widgets
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: pymmcore-plus/pymmcore-widgets
path: pymmcore-widgets
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install pymmcore-widgets
run: |
python -m pip install --upgrade pip
python -m pip install .[test,image,pyside6]
working-directory: pymmcore-widgets
- name: Install core
run: python -m pip install -e .[test] -U
- name: Install Micro-Manager
run: mmcore install
- name: Run pymmcore-widgets tests
run: python -m pytest -v --color=yes -W default
working-directory: pymmcore-widgets
test-napari-micro:
name: test napari-micromanager
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
path: pymmcore-plus
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: pymmcore-plus/napari-micromanager
path: napari-micromanager
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Windows OpenGL
if: runner.os == 'Windows'
run: |
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git
powershell gl-ci-helpers/appveyor/install_opengl.ps1
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -e ./napari-micromanager[testing]
python -m pip install -e ./pymmcore-plus[cli]
python -m pip install PySide2
- name: Install Micro-Manager
run: mmcore install
- name: Run napari-micromanager tests
run: python -m pytest -v --color=yes -W default
working-directory: napari-micromanager
deploy:
needs: test
runs-on: ubuntu-latest
if: ${{ github.repository == 'pymmcore-plus/pymmcore-plus' && contains(github.ref, 'tags') }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python -m build
twine check dist/*
twine upload dist/*
- uses: softprops/action-gh-release@v1
with:
generate_release_notes: true