1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
name: Test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main]
tags: [v*]
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0" # run weekly
jobs:
test:
name: ${{ matrix.os }} (${{ matrix.python-version }}) ${{ matrix.add-extra || '' }} ${{ matrix.resolution || ''}}
runs-on: ${{ matrix.os }}
env:
UV_PRERELEASE: ${{ github.event_name == 'schedule' && 'allow' || 'if-necessary-or-explicit' }}
UV_NO_SYNC: 1
UV_MANAGED_PYTHON: 1
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
add-extra: [pyqt6, pyside6]
exclude:
- os: windows-latest
python-version: "3.9"
add-extra: pyside6
include:
- os: windows-latest
python-version: "3.11"
resolution: "lowest-direct"
add-extra: pyside6
- os: macos-latest
python-version: "3.12"
resolution: "lowest-direct"
add-extra: pyqt6
- python-version: "3.9"
os: ubuntu-latest
add-extra: pyqt5
- python-version: "3.9"
os: ubuntu-latest
add-extra: pyside2
- python-version: "3.11"
os: windows-latest
add-extra: pyqt5
- python-version: "3.10"
os: ubuntu-latest
add-extra: pyside2
- python-version: "3.12"
os: ubuntu-latest
add-extra: pyqt6
- python-version: "3.12"
os: ubuntu-latest
add-extra: pyside6
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 --extra ${{ matrix.add-extra }} --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@v6
with:
name: covreport-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.add-extra }}-${{ matrix.resolution }}
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_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 --import-mode=importlib -k "not async and not qt_dims_2 and not qt_viewer_console_focus and not keybinding_editor and not preferences_dialog_not_dismissed"'
python-version: "3.10"
post-install-cmd: "pip install lxml_html_clean"
strategy:
fail-fast: false
matrix:
qt: ["pyqt5", "pyqt6", "pyside6"]
check-manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: pipx run check-manifest
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/superqt'
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@v7
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/*"
|