Skip to content

Merge pull request #21 from FOI-Bioinformatics/pandas3-migration #61

Merge pull request #21 from FOI-Bioinformatics/pandas3-migration

Merge pull request #21 from FOI-Bioinformatics/pandas3-migration #61

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install linting tools
# Pin black/isort to exact versions: their formatting output changes
# between releases, so an unpinned range makes `--check` nondeterministic
# (a newer black on the runner can demand reformatting the repo cannot
# reproduce locally). Bump deliberately, reformatting in the same commit.
run: pip install "black==26.5.1" "isort==8.0.1" "ruff>=0.5.0" "mypy>=1.0"
- name: Check formatting with black
run: black --check neoswga/
- name: Check import ordering with isort
run: isort --check neoswga/
- name: Lint with ruff (non-blocking informational baseline)
continue-on-error: true
run: ruff check neoswga tests
- name: Static type check with mypy (non-blocking informational baseline)
continue-on-error: true
run: mypy neoswga --ignore-missing-imports --no-strict-optional
- name: Dependency vulnerability audit (non-blocking advisory)
continue-on-error: true
run: |
pip install pip-audit
pip-audit --progress-spinner off || true
test:
needs: lint
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Jellyfish (k-mer counter)
run: |
if [ "${{ runner.os }}" = "Linux" ]; then
sudo apt-get update && sudo apt-get install -y jellyfish
else
brew install jellyfish
fi
- name: Install package with dev dependencies
run: pip install -e ".[dev]"
- name: Run tests with coverage
run: pytest tests/ -q --tb=short --cov=neoswga --cov-report=term-missing --cov-fail-under=50
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: pip install build twine
- name: Build package
run: python -m build
- name: Check distribution
run: twine check dist/*
- name: Install the built wheel and import-smoke it
# Guards the packaging-omission class: a wheel can build + pass `twine
# check` yet omit a subpackage (e.g. neoswga.cli) or data file (the
# model / checksums), breaking real installs. Install into a clean venv
# and import the entry point + every cli submodule + the bundled model.
run: |
python -m venv /tmp/wheel-venv
/tmp/wheel-venv/bin/pip install dist/*.whl
/tmp/wheel-venv/bin/python - <<'PY'
import importlib, pkgutil
import neoswga.cli_unified # entry point
import neoswga.cli as cli_pkg
subs = [m.name for m in pkgutil.iter_modules(cli_pkg.__path__)]
assert subs, "neoswga.cli shipped with no submodules"
for name in subs:
importlib.import_module(f"neoswga.cli.{name}")
# bundled model + checksums must be present in the installed package
from importlib.resources import files
models = files("neoswga.core") / "models"
assert (models / "random_forest_filter.skops").is_file(), "model not packaged"
assert (models / "checksums.json").is_file(), "checksums not packaged"
print(f"wheel import-smoke OK: cli submodules={len(subs)}, model+checksums present")
PY