Skip to content

Commit

Permalink
Merge pull request #8 from zacsimile/except-and-workflow
Browse files Browse the repository at this point in the history
Fix workflow
  • Loading branch information
zacsimile authored Jul 31, 2024
2 parents bdc6aee + 932194d commit a024f51
Show file tree
Hide file tree
Showing 7 changed files with 605 additions and 600 deletions.
64 changes: 22 additions & 42 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,67 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: tests

on:
on:
push:
branches:
- main
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- main
- main
workflow_dispatch:

jobs:
test:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
platform: ['ubuntu-latest', 'windows-latest'] #, 'macos-latest']
python-version: ['3.8', '3.9']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# these libraries enable testing on Qt on linux
- name: Install Linux libraries
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# 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
# note: if you need dependencies from conda, considering using
# setup-miniconda: https://github.com/conda-incubator/setup-miniconda
# and
# tox-conda: https://github.com/tox-dev/tox-conda
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
pip install -e .
pip install setuptools pytest pytest-cov pytest-xvfb
# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
uses: GabrielBB/xvfb-action@v1
with:
run: tox
env:
PLATFORM: ${{ matrix.platform }}
- name: Test with pytest
run: |
python3 -m pytest --cov=./ --cov-report=xml
- name: Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4

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
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test]
runs-on: ubuntu-latest
runs-on: ${{ matrix.platform }}
if: contains(github.ref, 'tags')
strategy:
fail-fast: false
matrix:
platform: ['ubuntu-latest', 'windows-latest'] #, 'macos-latest']
python-version: ['3.8', '3.9']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.x"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -93,4 +74,3 @@ jobs:
git tag
python setup.py sdist bdist_wheel
twine upload dist/*
52 changes: 17 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: check-docstring-first
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports==1.7.0]
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports"]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 21.11b1
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]
- repo: https://github.com/tlambert03/napari-plugin-checks
rev: v0.2.0
hooks:
- id: napari-plugin-checks
# https://mypy.readthedocs.io/en/stable/introduction.html
# you may wish to add this as well!
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.910-1
# hooks:
# - id: mypy

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
hooks:
- id: ruff

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies:
- types-toml
- types-PyYAML
exclude: npe2/implements.pyi|_docs/render.py
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
napari
npe2
numpy
pymeshlab
Expand Down
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ classifiers =
Topic :: Software Development :: Testing
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Operating System :: OS Independent
Expand All @@ -32,12 +31,13 @@ classifiers =
[options]
packages = find:
include_package_data = True
python_requires = >=3.7
python_requires = >=3.8
package_dir =
=src

# add your package requirements here
install_requires =
napari
npe2
numpy
pymeshlab
Expand All @@ -46,9 +46,9 @@ install_requires =
where = src

[options.package_data]
napari-pymeshlab =
napari-pymeshlab =
napari.yaml

[options.entry_points]
napari.manifest =
[options.entry_points]
napari.manifest =
napari-pymeshlab = napari_pymeshlab:napari.yaml
Loading

0 comments on commit a024f51

Please sign in to comment.