tests #2688
This file contains hidden or 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: ${{ matrix.os }} (${{ matrix.python-version }}) ${{ matrix.add-group || '' }} ${{ matrix.resolution || ''}} | |
| runs-on: ${{ matrix.os }} | |
| 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.11"] | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| add-group: [pyqt6, pyside6] | |
| include: | |
| - os: windows-latest | |
| python-version: "3.11" | |
| resolution: "lowest-direct" | |
| add-group: pyside6 | |
| - python-version: "3.9" | |
| os: ubuntu-latest | |
| add-group: pyqt5 | |
| - python-version: "3.9" | |
| os: ubuntu-latest | |
| add-group: pyside2 | |
| - python-version: "3.11" | |
| os: windows-latest | |
| add-group: pyqt5 | |
| - python-version: "3.10" | |
| os: ubuntu-latest | |
| add-group: pyside2 | |
| - python-version: "3.12" | |
| os: ubuntu-latest | |
| add-group: pyqt6 | |
| - python-version: "3.12" | |
| os: ubuntu-latest | |
| add-group: pyside6 | |
| - python-version: "3.13" | |
| os: ubuntu-latest | |
| add-group: pyside6 | |
| - python-version: "3.13" | |
| os: windows-latest | |
| add-group: pyqt6 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - 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 --group ${{ matrix.add-group || 'test' }} --resolution ${{ matrix.resolution || 'highest'}} | |
| - name: 🧪 Run Tests | |
| run: uv run coverage run -p -m pytest -v | |
| # 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.os }} | |
| 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.os }}-py${{ matrix.python-version }}-${{ matrix.add-group }}-${{ matrix.resolution }} | |
| path: ./.coverage* | |
| include-hidden-files: true | |
| test-min-deps: | |
| name: min-deps ${{ matrix.os }} (${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| UV_MANAGED_PYTHON: 1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.13"] | |
| os: [macos-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| 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: 🧪 Run Tests | |
| run: uv run --no-dev --group pyqt6 coverage run -p -m pytest -v | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: covreport-mindeps-${{ matrix.os }}-py${{ matrix.python-version }} | |
| path: ./.coverage* | |
| include-hidden-files: true | |
| upload_coverage: | |
| if: always() | |
| needs: [test] | |
| uses: pyapp-kit/workflows/.github/workflows/upload-coverage.yml@v2 | |
| secrets: inherit | |
| test-dependents: | |
| uses: pyapp-kit/workflows/.github/workflows/test-dependents.yml@v2 | |
| with: | |
| dependency-repo: ${{ matrix.package }} | |
| dependency-ref: ${{ matrix.package-version }} | |
| dependency-extras: ${{ matrix.package-extras || 'testing' }} | |
| qt: pyqt5 | |
| python-version: "3.10" | |
| post-install-cmd: "python -m pip install pytest-pretty lxml_html_clean" # just for napari | |
| pytest-args: ${{ matrix.pytest-args }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - package: napari/napari | |
| pytest-args: src/napari/_tests/test_magicgui.py --import-mode=importlib | |
| - package: napari/napari | |
| package-version: "v0.4.19.post1" | |
| pytest-args: napari/_tests/test_magicgui.py | |
| - package: hanjinliu/magic-class | |
| - package: 4DNucleome/PartSeg | |
| package-extras: test | |
| pytest-args: package/tests/test_PartSeg/test_napari_widgets.py | |
| build-and-inspect-package: | |
| name: Build & inspect package. | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - uses: hynek/build-and-inspect-python-package@v2 | |
| upload-to-pypi: | |
| if: success() && startsWith(github.ref, 'refs/tags/') && github.event_name != 'schedule' && github.repository == 'pyapp-kit/magicgui' | |
| name: Upload package to PyPI | |
| needs: build-and-inspect-package | |
| 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/*" |