Skip to content

Commit

Permalink
Use GH Actions & Conda for tests
Browse files Browse the repository at this point in the history
New tests and code require a substantial number
of requirements like opencv and Qt. Rather than
try to encapsulate that configuration directly
in .travis, we copy the napari-omero strategy
of using conda in GH actions.
  • Loading branch information
joshmoore committed Aug 31, 2020
1 parent 7a4f865 commit 461979f
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 21 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/posix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build for Linux

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test:
name: ${{ matrix.platform }} ${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup miniconda
- uses: goanpeca/[email protected]
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt install libxkbcommon-x11-0
/sbin/start-stop-daemon --start --quiet \
--pidfile /tmp/custom_xvfb_99.pid --make-pidfile \
--background --exec /usr/bin/Xvfb \
-- :99 -screen 0 1920x1200x24 -ac +extension GLX
- name: Install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip wheel pytest tox .[napari]
- name: Run pytest
shell: bash -l {0}
run: pytest
3 changes: 1 addition & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ jobs:
shell: bash
run: >
export PATH="/c/Python37:/c/Python37/Scripts:$PATH" &&
python -m pip install --upgrade pip wheel pytest tox scikit-image
.[napari] &&
python -m pip install --upgrade pip wheel pytest tox .[napari] &&
pytest
19 changes: 1 addition & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ dist: bionic
language: python
jobs:
include:
- name: Python36
python: "3.6"
- name: Python37
python: "3.7"
- name: Python38
python: "3.8"
- stage: deploy
python: "3.6"
if: tag IS present
install: skip
script: skip
skip_cleanup: true
deploy:
Expand All @@ -22,15 +17,3 @@ jobs:
distributions: sdist bdist_wheel
on:
tags: true

# command to install dependencies
install:
- pip install .[napari]
- pip install scikit-image # only needed for tests

# command to run tests
script: pytest

cache:
directories:
- $HOME/.cache/pip
26 changes: 26 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#name: z
channels:
- defaults
- ome
- conda-forge
dependencies:
- pyqt >=5.12.3
- napari
- flake8
- ipython
- mypy
- omero-py
- opencv
- pip
- py-opencv
- pytest
- python.app
- requests
- s3fs
- scikit-image
- scipy
- xarray
- zarr >= 2.4.0
- pip:
- pre-commit
- pytest-qt
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ def read(fname):
"pytest11": ["napari-conftest = napari.conftest"],
},
extras_require={"napari": ["napari"]},
tests_require=["pytest", "pytest-capturelog"],
tests_require=["pytest"],
)

0 comments on commit 461979f

Please sign in to comment.