Declare the project OS Independent #18
This file contains hidden or 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
| name: tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| # The notebook user's install: no Qt anywhere on the machine. This job | |
| # exists to keep that path honest - if anything under spwb.processing | |
| # grows a Qt dependency, it fails here rather than in someone's notebook. | |
| processing-only: | |
| name: processing only (no Qt) - py${{ matrix.python }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install without the gui extra | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[io]" pytest | |
| - name: Assert Qt really is absent | |
| run: | | |
| python - <<'PY' | |
| import importlib.util, sys | |
| for name in ("PySide6", "PyQt5", "PyQt6", "pyqtgraph"): | |
| assert importlib.util.find_spec(name) is None, f"{name} is installed" | |
| import spwb | |
| assert "PySide6" not in sys.modules | |
| print("clean: spwb imports with no Qt available") | |
| PY | |
| # The GUI test modules importorskip PySide6, so they skip themselves | |
| # here. Everything else - including the separation tests - must run, | |
| # so assert a floor on the count rather than trusting a green tick. | |
| - name: Run the test suite (GUI modules skip themselves) | |
| run: pytest -q --junit-xml=results.xml | |
| - name: Assert the processing tests actually ran | |
| run: | | |
| python - <<'PY' | |
| import xml.etree.ElementTree as ET | |
| suite = ET.parse("results.xml").getroot()[0] | |
| total = int(suite.get("tests")); skipped = int(suite.get("skipped")) | |
| ran = total - skipped | |
| print(f"{ran} ran, {skipped} skipped, {total} collected") | |
| assert ran >= 240, f"only {ran} tests ran; something is skipping too much" | |
| PY | |
| # The full application: GUI included, tests run offscreen. | |
| full: | |
| name: full (gui) - ${{ matrix.os }} py${{ matrix.python }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python: ["3.11", "3.13"] | |
| env: | |
| QT_QPA_PLATFORM: offscreen | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install Qt runtime libraries (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libegl1 libgl1 libxkbcommon-x11-0 \ | |
| libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \ | |
| libxcb-render-util0 libxcb-shape0 libxcb-xinerama0 libdbus-1-3 | |
| - name: Install everything | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run the full test suite | |
| run: pytest -q | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - run: pip install ruff | |
| - run: ruff check src tests tools |