Merge pull request #141 from lukasz-migas/pre-commit-ci-update-config #119
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
# The full test suite, which will be run anytime anything is merged into master. | |
# See test_pull_request.yml for the tests that will be run | |
name: Full Test | |
on: | |
push: | |
branches: | |
- main | |
- "v*x" | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: comprehensive-test | |
jobs: | |
code: | |
name: Code | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
task: [black, isort, ruff, import-lint] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
- name: Run task | |
run: tox -e ${{ matrix.task }} | |
manifest: | |
# make sure all necessary files will be bundled in the release | |
name: Check Manifest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install check-manifest | |
- name: Check Manifest | |
run: check-manifest | |
test: | |
needs: code | |
name: ${{ matrix.platform }} py${{ matrix.python }} ${{ matrix.toxenv }} ${{ matrix.MIN_REQ && 'min_req' }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ubuntu-latest, windows-latest] | |
python: ["3.8", "3.9", "3.10"] | |
backend: [pyqt5, pyside2] | |
include: | |
- python: 3.9 | |
platform: macos-latest | |
backend: pyqt5 | |
# test with minimum specified requirements | |
- python: 3.8 | |
platform: ubuntu-18.04 | |
backend: pyqt5 | |
MIN_REQ: 1 | |
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 }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: "pip" | |
cache-dependency-path: setup.cfg | |
- uses: tlambert03/setup-qt-libs@v1 | |
# strategy borrowed from vispy for installing opengl libs on windows | |
- name: Install Windows OpenGL | |
if: runner.os == 'Windows' | |
run: | | |
git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git | |
powershell gl-ci-helpers/appveyor/install_opengl.ps1 | |
if (Test-Path -Path "C:\Windows\system32\opengl32.dll" -PathType Leaf) {Exit 0} else {Exit 1} | |
# tox and tox-gh-actions will take care of the "actual" installation | |
# of python dependendencies into a virtualenv. see tox.ini for more | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install setuptools tox tox-gh-actions | |
python tools/minreq.py | |
env: | |
# tools/minreq.py sets all deps to their minumim stated versions | |
# it is a no-op if MIN_REQ is not set | |
MIN_REQ: ${{ matrix.MIN_REQ }} | |
# here we pass off control of environment creation and running of tests to tox | |
# tox-gh-actions, installed above, helps to convert environment variables into | |
# tox "factors" ... limiting the scope of what gets tested on each platform | |
# for instance, on ubuntu-latest with python 3.8, it would be equivalent to this command: | |
# `tox -e py38-linux-pyqt,py38-linux-pyside` | |
# see tox.ini for more | |
- name: Test with tox | |
uses: aganders3/headless-gui@v1 | |
with: | |
run: python -m tox | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
BACKEND: ${{ matrix.backend }} | |
TOXENV: ${{ matrix.toxenv }} | |
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION: ${{ matrix.MIN_REQ || 1 }} | |
PYVISTA_OFF_SCREEN: True | |
MIN_REQ: ${{ matrix.MIN_REQ }} | |
- name: Coverage | |
uses: codecov/codecov-action@v3 | |
- name: Report Failures | |
if: ${{ failure() }} | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PLATFORM: ${{ matrix.platform }} | |
PYTHON: ${{ matrix.python }} | |
BACKEND: ${{ matrix.toxenv }} | |
RUN_ID: ${{ github.run_id }} | |
TITLE: "[test-bot] Comprehensive tests failing" | |
with: | |
filename: .github/TEST_FAIL_TEMPLATE.md | |
update_existing: true | |
test_pip_install: | |
name: ubuntu-latest 3.8 pip install | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: napari-plot-from-github | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: "pip" | |
cache-dependency-path: napari-plot-from-github/setup.cfg | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Install this commit | |
run: | | |
# pip install this git sha directly from github | |
pip install --upgrade pip | |
pip install ./napari-plot-from-github[all,testing] | |
- name: Test | |
uses: aganders3/headless-gui@v1 | |
with: | |
run: pytest --pyargs napari_plot --color=yes | |
test_examples: | |
name: test examples | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- uses: tlambert03/setup-qt-libs@v1 | |
- name: Install this commit | |
run: | | |
pip install --upgrade pip | |
pip install setuptools tox tox-gh-actions | |
- name: Test | |
uses: aganders3/headless-gui@v1 | |
with: | |
run: tox -e py39-linux-pyside2-examples | |
# deploy: | |
# name: Deploy to Test PyPI and PyPI | |
# # 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, test_pip_install, test_examples] | |
# runs-on: ubuntu-latest | |
# if: contains(github.ref, 'tags') | |
# 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 | |
# python -m pip install -e .[build] # need full install so we can build type stubs | |
# | |
# - name: Build package | |
# run: | | |
# make dist | |
# | |
# - name: Publish to Test PyPI | |
# uses: pypa/gh-action-pypi-publish@master | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ | |
# | |
# - name: Publish to PyPI | |
# uses: pypa/gh-action-pypi-publish@master | |
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
# with: | |
# user: __token__ | |
# password: ${{ secrets.PYPI_API_TOKEN }} |