Skip to content

Merge pull request #305 from imagej/point-permutations #1374

Merge pull request #305 from imagej/point-permutations

Merge pull request #305 from imagej/point-permutations #1374

Workflow file for this run

# 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.12']
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: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Run Ruff
uses: astral-sh/ruff-action@v1
- name: Validate pyproject.toml
run: |
python -m pip install "validate-pyproject[all]"
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-version: latest
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