| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # full history: DEBUG.md's commit citations are tested | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # CPU-only torch, and none of the kernel extras. This job IS the Phase 0 | |
| # acceptance criterion: the library must install and pass on a machine | |
| # with no CUDA and no optional dependencies. | |
| - name: Install | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install -e ".[dev]" | |
| - name: Lint | |
| run: ruff check . && ruff format --check . | |
| # Advisory, not gating (see PLAN.md Phase 0) — but it has to actually run, | |
| # or errors accumulate silently until someone thinks to check. | |
| - name: Typecheck | |
| run: mypy | |
| continue-on-error: true | |
| - name: Test | |
| run: pytest -v --cov --cov-report=term-missing | |
| viewer: | |
| # The viewer is JS and builds once; the python job must not wait on node. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Build the bundle | |
| run: | | |
| npm --prefix viewer ci | |
| npm --prefix viewer run build | |
| python viewer/install_bundle.py | |
| # The viz tests skip themselves without a bundle, which is right for a | |
| # checkout and wrong for this job: here a skip would mean the whole | |
| # feature went untested and said "ok". | |
| - name: Serve it | |
| run: | | |
| pip install torch --index-url https://download.pytorch.org/whl/cpu | |
| pip install -e ".[dev]" | |
| pytest tests/test_viz.py -v | |
| python - <<'EOF' | |
| from torch_dimensions import viz | |
| assert viz.bundle_exists(), "bundle missing after build — the viz tests all skipped" | |
| EOF | |