Skip to content

Commit

Permalink
Use central BG actions (#58)
Browse files Browse the repository at this point in the history
* use central BG actions

* remove manifest check

* update Gh actions

* update tox file

* add coveralls

* update classifiers

* remove coverage
  • Loading branch information
adamltyson authored Jul 26, 2022
1 parent 7d44008 commit 58b6d71
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 56 deletions.
71 changes: 27 additions & 44 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,51 @@
# 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: [push, pull_request]

jobs:
lint:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Lint
run: |
black ./ --check
flake8
- uses: brainglobe/actions/lint@v1

test:
needs: lint
needs: linting
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
exclude:
- {os: "macos-latest", python-version: "3.7"}
- {os: "macos-latest", python-version: "3.9"}
- {os: "windows-latest", python-version: "3.7"}
- {os: "windows-latest", python-version: "3.9"}
# Run all supported Python versions on linux
python-version: ["3.8", "3.9"]
os: [ubuntu-latest]
# Include one windows and macos run
include:
- os: macos-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.9"

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
# Setup pyqt libraries
- uses: tlambert03/setup-qt-libs@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
pip install pytest PyQt5 --upgrade
pip install pytest-xvfb
- name: Test
run: pytest
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install coveralls
coveralls --service=github
# Run tests
- uses: brainglobe/actions/test@v1
with:
python-version: ${{ matrix.python-version }}

deploy:
needs: test
# 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]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
"Operating System :: Microsoft :: Windows :: Windows 10",
"Framework :: napari",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
],
Expand Down
27 changes: 16 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{36,37,38}-{linux,macos,windows}
envlist = py{38,39}

[gh-actions]
python =
3.7: py37
3.8: py38

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
3.9: py39

[testenv]
commands = pytest -v --cov=./ --cov-report=xml
passenv =
CI
GITHUB_ACTIONS
DISPLAY XAUTHORITY
NUMPY_EXPERIMENTAL_ARRAY_FUNCTION
PYVISTA_OFF_SCREEN
deps =
pytest-qt
pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
# Even though napari is a requirement for cellfinder-napari, we have to
# ensure it is installed with the default Qt backend here.
napari[pyqt]
pytest # https://docs.pytest.org/en/latest/contents.html
pytest-cov # https://pytest-cov.readthedocs.io/en/latest/
pytest-qt
pytest-xvfb ; sys_platform == 'linux'
commands =
pytest -v --color=yes --cov=brainreg_segment --cov-report=xml

0 comments on commit 58b6d71

Please sign in to comment.