Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up GitHub actions config #107

Merged
merged 8 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ name: tests
on:
push:
branches:
- master
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- master
- main
workflow_dispatch:

Expand All @@ -23,26 +21,21 @@ jobs:
name: ${{ matrix.platform }} py${{ matrix.python-version }}
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
jburel marked this conversation as resolved.
Show resolved Hide resolved
with:
python-version: ${{ matrix.python-version }}

# these libraries, along with pytest-xvfb (added in the `deps` in
# tox.ini), enable testing on Qt on linux
- name: Install Linux libraries
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
# these libraries enable testing on Qt on linux
- uses: tlambert03/setup-qt-libs@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. TIL. (Kudos to @tlambert03)


# strategy borrowed from vispy for installing opengl libs on windows
- name: Install Windows OpenGL
Expand All @@ -58,16 +51,18 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
python -m pip install tox tox-gh-actions

# this runs the platform-specific tests declared in tox.ini
- name: Test with tox
run: tox
uses: aganders3/headless-gui@v1
with:
run: tox
env:
PLATFORM: ${{ matrix.platform }}

- name: Coverage
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false

Expand Down
21 changes: 15 additions & 6 deletions napari_ome_zarr/_tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from pathlib import Path

import numpy as np
import pytest
Expand All @@ -9,10 +10,18 @@

class TestNapari:
@pytest.fixture(autouse=True)
def initdir(self, tmpdir):
self.path_3d = tmpdir.mkdir("data_3d")
create_zarr(str(self.path_3d), astronaut, "astronaut")
self.path_2d = tmpdir.mkdir("data_2d")
def initdir(self, tmp_path: Path):
"""
Write some temporary test data.

create_zarr() creates an image pyramid and labels zarr directories.
"""
self.path_3d = tmp_path / "data_3d"
self.path_3d.mkdir()
create_zarr(str(self.path_3d), method=astronaut, label_name="astronaut")

self.path_2d = tmp_path / "data_2d"
self.path_2d.mkdir()
create_zarr(str(self.path_2d))

def test_get_reader_hit(self):
Expand Down Expand Up @@ -81,12 +90,12 @@ def test_image(self, path):
self.assert_layers(layers, True, False, path)

def test_labels(self):
filename = str(self.path_3d.join("labels"))
filename = str(self.path_3d / "labels")
layers = napari_get_reader(filename)()
self.assert_layers(layers, False, True)

def test_label(self):
filename = str(self.path_3d.join("labels", "astronaut"))
filename = str(self.path_3d / "labels" / "astronaut")
layers = napari_get_reader(filename)()
self.assert_layers(layers, False, True)

Expand Down
Loading