Skip to content

imswitch-test

imswitch-test #532

Workflow file for this run

name: imswitch-test
on:
push:
pull_request:
schedule:
- cron: '30 7 * * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0
fi
python3 -m pip install --upgrade pip
python3 -m pip install .
python3 -m pip install flake8 pytest pytest-qt
shell: bash
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings
flake8 . --count --exit-zero --statistics \
--extend-exclude=imswitch/imcontrol/model/interfaces/pyicic/*
shell: bash
- name: Test with pytest
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
xvfb-run --server-args "-screen 0 1920x1080x24" python3 -m pytest --pyargs imswitch -v
elif [ "$RUNNER_OS" == "Windows" ]; then
# LiveView test fails on GitHub actions on Windows with napari 0.4.7. This is likely a
# problem specific to this GitHub action, as it does not appear when testing manually on
# Windows. Therefore, we ignore the LiveView tests on Windows for now.
# The situation is similar with test_example_setups.py, possibly for the same reason.
# TODO: Remove this special case when napari is unpinned
python3 -m pytest --pyargs imswitch -v \
--ignore=imswitch/imcontrol/_test/ui/test_example_setups.py \
--ignore=imswitch/imcontrol/_test/ui/test_liveview.py
else
# test_example_setups.py causes "Fatal Python error: Bus error" on MacOS after all tests
# are complete, but seemingly only in GitHub Actions and not on a "real" installation.
# Therefore, we ignore the file on MacOS for now.
# TODO: Figure out why this happens. Perhaps related to the Windows issue?
python3 -m pytest --pyargs imswitch -v \
--ignore=imswitch/imcontrol/_test/ui/test_example_setups.py
fi
shell: bash