name: CI on: push: branches: [main] tags: [v*] pull_request: workflow_dispatch: schedule: # run every week (for --pre release tests) - cron: "0 0 * * 0" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: check-manifest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - run: pipx run check-manifest pyright: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: astral-sh/setup-uv@v7 - run: uv run --with pyqt6 pyright test: name: ${{ matrix.platform }} py${{ matrix.python-version }} runs-on: ${{ matrix.platform }} env: UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }} UV_NO_SYNC: 1 strategy: fail-fast: false matrix: python-version: ["3.9", "3.11", "3.13"] platform: [ubuntu-latest, macos-latest, windows-latest] include: - python-version: "3.10" platform: "macos-latest" - python-version: "3.12" platform: "macos-latest" - python-version: "3.9" platform: "ubuntu-latest" resolution: "lowest-direct" steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - name: ๐Ÿ Set up Python ${{ matrix.python-version }} uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} enable-cache: true cache-dependency-glob: "**/pyproject.toml" - name: Install Dependencies run: uv sync --no-dev --group test --resolution ${{ matrix.resolution || 'highest'}} - name: ๐Ÿงช Run Tests run: uv run coverage run -p -m pytest -v env: PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }} - name: Upload coverage uses: actions/upload-artifact@v5 with: name: covreport-${{ matrix.platform }}-py${{ matrix.python-version }} path: ./.coverage* include-hidden-files: true test-qt: name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{matrix.extra }} ${{ matrix.resolution }} runs-on: ${{ matrix.platform }} env: UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }} UV_NO_SYNC: 1 strategy: fail-fast: false matrix: python-version: ["3.10", "3.12"] platform: [macos-latest, windows-latest] extra: [pyqt5, pyside2, pyside6, pyqt6] resolution: [highest, lowest-direct] exclude: - platform: "macos-latest" extra: "pyside2" - python-version: "3.12" extra: "pyside2" steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - name: ๐Ÿ Set up Python ${{ matrix.python-version }} uses: astral-sh/setup-uv@v7 with: python-version: ${{ matrix.python-version }} enable-cache: true cache-dependency-glob: "**/pyproject.toml" - uses: pyvista/setup-headless-display-action@v4 with: qt: true - name: Install Dependencies run: uv sync --no-dev --group test-qt --extra ${{ matrix.extra }} --resolution ${{ matrix.resolution }} - name: ๐Ÿงช Run Tests run: uv run coverage run -p -m pytest -v env: PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }} # If something goes wrong with --pre tests, we can open an issue in the repo - name: ๐Ÿ“ Report --pre Failures if: failure() && github.event_name == 'schedule' uses: JasonEtco/create-an-issue@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PLATFORM: ${{ matrix.platform }} PYTHON: ${{ matrix.python-version }} RUN_ID: ${{ github.run_id }} TITLE: "[test-bot] pip install --pre is failing" with: filename: .github/TEST_FAIL_TEMPLATE.md update_existing: true - name: Upload coverage uses: actions/upload-artifact@v5 with: name: covreport-${{ matrix.platform }}-py${{ matrix.python-version }}-${{ matrix.extra }}-${{ matrix.resolution }} path: ./.coverage* include-hidden-files: true upload_coverage: if: always() needs: [test, test-qt] uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2 secrets: inherit test_napari: uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@v2 with: dependency-repo: napari/napari dependency-extras: "testing" qt: ${{ matrix.qt }} pytest-args: 'src/napari/_qt/_qapp_model src/napari/_app_model src/napari/utils/_tests/test_key_bindings.py --import-mode=importlib -k "not async and not qt_dims_2"' python-version: "3.11" strategy: fail-fast: false matrix: qt: ["pyqt5", "pyside6"] build-and-inspect-package: name: Build & inspect package. needs: [check-manifest, test] runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - uses: hynek/build-and-inspect-python-package@v2 upload-to-pypi: name: Upload package to PyPI needs: build-and-inspect-package if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' runs-on: ubuntu-latest permissions: id-token: write contents: write steps: - name: Download built artifact to dist/ uses: actions/download-artifact@v6 with: name: Packages path: dist - 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/*"