Files
superqt/.github/workflows/test_and_deploy.yml
2022-11-11 08:39:22 -05:00

226 lines
6.2 KiB
YAML

name: Test
on:
push:
branches:
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }} ${{ matrix.backend }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10"]
backend: [pyqt5, pyside2]
include:
# pyqt6 and pyside6 on latest platforms
- python-version: "3.10"
platform: ubuntu-latest
backend: pyqt6
- python-version: "3.10"
platform: windows-latest
backend: pyqt6
- python-version: "3.10"
platform: macos-latest
backend: pyqt6
# also take screenshots
- python-version: "3.10"
platform: ubuntu-latest
backend: pyside6
screenshot: 1
- python-version: "3.10"
platform: windows-latest
backend: pyside6
screenshot: 1
- python-version: "3.10"
platform: macos-latest
backend: pyside6
screenshot: 1
- python-version: "3.11"
platform: ubuntu-latest
backend: pyqt6
- python-version: "3.11"
platform: windows-latest
backend: pyqt5
- python-version: "3.11"
platform: macos-latest
backend: pyside6
# python 3.7
- python-version: 3.7
platform: macos-latest
backend: pyqt5
- python-version: 3.7
platform: windows-latest
backend: pyside2
# legacy Qt
- python-version: 3.7
platform: ubuntu-latest
backend: pyqt512
- python-version: 3.7
platform: ubuntu-latest
backend: pyqt513
- python-version: 3.7
platform: ubuntu-latest
backend: pyqt514
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: tlambert03/setup-qt-libs@v1.4
- name: Linux opengl
if: runner.os == 'Linux' && ( matrix.backend == 'pyside6' || matrix.backend == 'pyqt6' )
run: sudo apt-get install -y libopengl0 libegl1-mesa libxcb-xinput0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools tox tox-gh-actions
- name: Test with tox
uses: GabrielBB/xvfb-action@v1
timeout-minutes: 3
with:
run: python -m tox
env:
PLATFORM: ${{ matrix.platform }}
BACKEND: ${{ matrix.backend }}
- name: Coverage
uses: codecov/codecov-action@v3
- name: Install for screenshots
if: matrix.screenshot
run: pip install -e .[${{ matrix.backend }}]
- name: Screenshots (Linux)
if: runner.os == 'Linux' && matrix.screenshot
uses: GabrielBB/xvfb-action@v1
with:
run: python examples/demo_widget.py -snap
- name: Screenshots (macOS/Win)
if: runner.os != 'Linux' && matrix.screenshot
run: python examples/demo_widget.py -snap
- uses: actions/upload-artifact@v3
if: matrix.screenshot
with:
name: screenshots ${{ runner.os }}
path: screenshots
test_old_qtpy:
name: qtpy minreq
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: tlambert03/setup-qt-libs@v1.4
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: install
run: |
python -m pip install -U pip
python -m pip install -e .[test,pyqt5]
python -m pip install qtpy==1.1.0 typing-extensions==3.10.0.0
- name: Test
uses: GabrielBB/xvfb-action@v1
with:
run: python -m pytest --color=yes
test_napari:
name: napari tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
path: superqt
- uses: actions/checkout@v3
with:
repository: napari/napari
path: napari-repo
fetch-depth: 2
- uses: tlambert03/setup-qt-libs@v1
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install
run: |
python -m pip install -U pip
python -m pip install ./superqt
python -m pip install ./napari-repo[testing,pyqt5]
- name: Test napari
uses: GabrielBB/xvfb-action@v1
with:
working-directory: napari-repo
run: python -m pytest --color=yes napari/_qt
check-manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install check-manifest && check-manifest
deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test, check-manifest]
if: ${{ github.repository == 'pyapp-kit/superqt' && contains(github.ref, 'tags') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
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