tests #5
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 16 * * 1" # monday at noon est | |
jobs: | |
test: | |
name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{ matrix.qt }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [windows-latest, macos-13] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
qt: ["PySide6"] | |
include: | |
- platform: windows-latest | |
python-version: "3.9" | |
qt: "PySide2" | |
- platform: macos-13 | |
python-version: "3.11" | |
qt: "PyQt6" | |
- platform: windows-latest | |
python-version: "3.12" | |
qt: "PyQt6" | |
- platform: ubuntu-latest | |
python-version: "3.12" | |
# - platform: windows-latest | |
# python-version: "3.13" | |
# qt: "PyQt6" | |
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 | |
python -m pip install -e .[test] | |
- name: Install Qt | |
if: matrix.qt | |
run: pip install -e .[${{ matrix.qt }}] | |
- name: Set cache path | |
shell: bash | |
run: | | |
set -e | |
CACHE_PATH=$(python -c 'from pymmcore_plus import install; print(install.USER_DATA_MM_PATH)') | |
echo "CACHE_PATH=$CACHE_PATH" >> $GITHUB_ENV | |
- name: Cache Drivers | |
id: cache-mm-build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHE_PATH }} | |
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' && steps.cache-mm-build.outputs.cache-hit != 'true' | |
run: mmcore install | |
- name: Remove Qt | |
if: runner.os == 'Linux' | |
run: pip uninstall -y pytest-qt qtpy | |
- name: Test | |
run: pytest -v --color=yes --cov=pymmcore_plus --cov-report=xml | |
- name: Coverage | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
test-nano: | |
name: test with pymmcore-nano | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [windows-latest, macos-13] | |
python-version: ["3.12"] | |
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 | |
python -m pip install -e .[test,PyQt6] | |
python -m pip uninstall -y pymmcore | |
python -m pip install pymmcore-nano | |
- name: Set cache path | |
shell: bash | |
run: | | |
set -e | |
CACHE_PATH=$(python -c 'from pymmcore_plus import install; print(install.USER_DATA_MM_PATH)') | |
echo "CACHE_PATH=$CACHE_PATH" >> $GITHUB_ENV | |
- name: Cache Drivers | |
id: cache-mm-build | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.CACHE_PATH }} | |
key: ${{ runner.os }}-mmbuild-${{ hashFiles('src/pymmcore_plus/_build.py') }} | |
- name: Install Micro-Manager | |
if: steps.cache-mm-build.outputs.cache-hit != 'true' | |
run: mmcore install | |
- name: Test | |
run: pytest -v --color=yes | |
test-dependents: | |
uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@main | |
with: | |
os: windows-latest | |
python-version: "3.10" | |
dependency-repo: ${{ matrix.repo }} | |
dependency-extras: "test" | |
post-install-cmd: "mmcore install" | |
qt: ${{ matrix.qt }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- repo: pymmcore-plus/pymmcore-widgets | |
qt: "pyqt6" | |
- repo: pymmcore-plus/napari-micromanager | |
qt: "pyqt6" | |
benchmarks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: install | |
run: | | |
python -m pip install -e .[test] | |
python -m pip install pytest-codspeed | |
python -m pip uninstall -y pytest-qt qtpy | |
- name: Cache Linux Build | |
id: cache-mm-build | |
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: steps.cache-mm-build.outputs.cache-hit != 'true' | |
run: mmcore build-dev | |
- name: Run benchmarks | |
uses: CodSpeedHQ/action@v3 | |
with: | |
run: pytest -W ignore --codspeed -v --color=yes | |
deploy: | |
needs: test | |
if: ${{ github.repository == 'pymmcore-plus/pymmcore-plus' && contains(github.ref, 'tags') }} | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 👷 Build | |
run: pipx run build | |
- name: 🚢 Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
files: "./dist/*" |