Skip to content

Packaging for non-developer users (pip/uvx installable, GUI bundled) #228

Packaging for non-developer users (pip/uvx installable, GUI bundled)

Packaging for non-developer users (pip/uvx installable, GUI bundled) #228

Workflow file for this run

name: CI
on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# Detect which areas changed so each suite runs only when relevant.
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
python: ${{ steps.filter.outputs.python }}
web: ${{ steps.filter.outputs.web }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
python:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'uv.lock'
- '.python-version'
- '.github/workflows/ci.yml'
web:
- 'gui/web/**'
- '.github/workflows/ci.yml'
python:
name: Python (${{ matrix.python }})
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.12 is the supported floor (pyproject requires-python); 3.14 is the dev pin.
python: ["3.12", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install project + deps
run: uv sync --python ${{ matrix.python }}
# ruff lint/format are Python-version-agnostic; run once, on the floor.
- name: Lint (ruff)
if: ${{ matrix.python == '3.12' }}
run: uvx ruff check .
- name: Format check (ruff format)
if: ${{ matrix.python == '3.12' }}
run: uvx ruff format --check .
- name: Tests (pytest; tolerate "no tests collected" while skeletal)
run: |
set +e
uv run --python ${{ matrix.python }} --with pytest pytest -q
code=$?
set -e
# exit 5 = no tests collected yet (skeleton); treat as success
if [ "$code" -ne 0 ] && [ "$code" -ne 5 ]; then exit "$code"; fi
typecheck:
name: Typecheck (ty)
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv (Python 3.14 from .python-version)
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install project + deps
run: uv sync
- name: Typecheck (ty)
run: uv run ty check src/magnetics
web:
name: Web (gui)
needs: changes
if: ${{ needs.changes.outputs.web == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: gui/web
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: gui/web/package-lock.json
- name: Install (clean)
run: npm ci
- name: Lint (eslint)
run: npm run lint
- name: Typecheck (tsc --strict)
run: npm run typecheck
- name: Tests (vitest)
run: npm test
- name: Build (tsc + vite)
run: npm run build