Fix failing tests #1330
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
# 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: | |
branches: | |
- main | |
tags: | |
- "*-[0-9]+.*" | |
pull_request: | |
branches: | |
- main | |
env: | |
NAPARI_IMAGEJ_TEST_TIMEOUT: 60000 | |
jobs: | |
test-pip: | |
name: ${{ matrix.platform }} py${{ matrix.python-version }} | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ['3.8', '3.11.0'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Java 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'zulu' | |
- name: Setup Qt libraries | |
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 | |
# We run headless on CI. This yields issues on Mac, where running Java | |
# headless will alter the screen size on Python, leading to errors. Adding | |
# this environment variable prevents Java from modifying the screen size. | |
- name: Set MacOS environment variables | |
if: runner.os == 'MacOS' | |
run: | | |
echo "AWT_FORCE_HEADFUL=true" >> $GITHUB_ENV | |
- name: Install napari-imagej | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e '.[dev]' | |
- name: Test napari-imagej | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: | |
bash bin/test.sh | |
ensure-clean-code: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
# This step ensures that everything is installed | |
- name: Install code cleaning components | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e '.[dev]' | |
- name: Lint code | |
uses: psf/black@stable | |
- name: Flake code | |
run: | | |
python -m flake8 src tests | |
- name: Check import ordering | |
uses: isort/isort-action@master | |
with: | |
configuration: --check-only | |
- name: Validate pyproject.toml | |
run: | | |
python -m validate_pyproject pyproject.toml | |
conda-dev-test: | |
name: Conda Setup & Code Coverage | |
runs-on: ubuntu-latest | |
defaults: | |
# Steps that rely on the activated environment must be run with this shell setup. | |
# See https://github.com/marketplace/actions/setup-miniconda#important | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache conda | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache if dev-environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('dev-environment.yml') }} | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
# Create env with dev packages | |
auto-update-conda: true | |
python-version: "3.10" | |
miniforge-variant: Mambaforge | |
environment-file: dev-environment.yml | |
# Activate napari-imagej-dev environment | |
activate-environment: napari-imagej-dev | |
auto-activate-base: false | |
# Use mamba for faster setup | |
use-mamba: true | |
- name: Setup Qt libraries | |
uses: tlambert03/setup-qt-libs@v1 | |
- name: Test napari-imagej | |
uses: GabrielBB/xvfb-action@v1 | |
with: | |
run: | | |
conda run -n napari-imagej-dev --no-capture-output python -m pytest -s -p no:faulthandler --color=yes --cov-report=xml --cov=. | |
# We could do this in its own action, but we'd have to setup the environment again. | |
- name: Upload Coverage to Codecov | |
uses: codecov/codecov-action@v2 |