Skip to content

Commit

Permalink
added test & lint workflows (#27)
Browse files Browse the repository at this point in the history
* added test & lint workflows
* reformatted docs/conf
  • Loading branch information
glichtner authored Oct 6, 2022
1 parent 09620c0 commit c5ade02
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 39 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Lint

on:
push:
pull_request:
types:
- opened
- reopened

permissions:
checks: write
contents: write

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install Python dependencies
run: pip install black flake8

- name: Run linters
uses: wearerequired/lint-action@v2
with:
auto_fix: true
black: true
black_auto_fix: true
flake8: true
32 changes: 32 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Run tests
on:
push:
branches:
- master
- main
pull_request:


jobs:
test:
name: test ${{ matrix.python-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install tox and dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test with tox
run: |
tox -e py
18 changes: 7 additions & 11 deletions .github/workflows/wheels-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Build and upload to PyPI
name: Build wheels

# Build on every branch push, tag push, and pull request change:
on: [push, pull_request]
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
# on:
# push:
# pull_request:
# release:
# types:
# - published
on:
push:
branches:
- master
- main

jobs:
build_wheels:
Expand All @@ -23,7 +19,7 @@ jobs:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/cibuildwheel@v2.7.0
uses: pypa/cibuildwheel@v2.10.2

- uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ MANIFEST
.coverage
.coverage/
.mypy_cache/
notebooks/
52 changes: 26 additions & 26 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,51 @@
exec(open("../pystackreg/version.py").read())

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx_autodoc_typehints',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.extlinks",
"sphinx.ext.ifconfig",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]


if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling',
if os.getenv("SPELLCHECK"):
extensions += ("sphinxcontrib.spelling",)
spelling_show_suggestions = True
spelling_lang = 'en_US'
spelling_lang = "en_US"

source_suffix = '.rst'
master_doc = 'index'
project = 'pystackreg'
source_suffix = ".rst"
master_doc = "index"
project = "pystackreg"
author = "Gregor Lichtner, Philippe Thevenaz"
year = f'2018-{time.strftime("%Y")}'
copyright = '{0}, {1}'.format(year, author)
copyright = "{0}, {1}".format(year, author)
version = release = __version__

pygments_style = 'trac'
templates_path = ['.']
pygments_style = "trac"
templates_path = ["."]
extlinks = {
'issue': ('https://github.com/glichtner/pystackreg/%s', '#'),
'pr': ('https://github.com/glichtner/pystackreg/pull/%s', 'PR #'),
"issue": ("https://github.com/glichtner/pystackreg/%s", "#"),
"pr": ("https://github.com/glichtner/pystackreg/pull/%s", "PR #"),
}
# on_rtd is whether we are on readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
on_rtd = os.environ.get("READTHEDOCS", None) == "True"

if not on_rtd: # only set the theme if we're building docs locally
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"
html_split_index = False
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
"**": ["searchbox.html", "globaltoc.html", "sourcelink.html"],
}
html_short_title = '%s-%s' % (project, version)
html_short_title = "%s-%s" % (project, version)

napoleon_use_ivar = True
napoleon_use_rtype = True
Expand Down
5 changes: 3 additions & 2 deletions setup_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ def read(fname):
name="pystackreg",
description="Python implementation of the ImageJ/FIJI Plugin TurboReg/StackReg",
long_description=read("README.rst"),
version=__version__,
author="Gregor Lichtner (python/C++ port); TurboReg Author: Philippe Thévenaz, Biomedical Imaging Group, Swiss Federal Institute of Technology Lausanne",
version=__version__, # type: ignore # noqa: F821
author="Gregor Lichtner (python/C++ port); TurboReg Author: Philippe Thévenaz, "
"Biomedical Imaging Group, Swiss Federal Institute of Technology Lausanne",
url="https://bitbucket.org/glichtner/pystackreg",
packages=["pystackreg"],
ext_modules=[
Expand Down

0 comments on commit c5ade02

Please sign in to comment.