Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/notebook-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Notebook refactor checks

on:
pull_request:
paths:
- "Cable_Segmentation_Refactored.ipynb"
- "cable_seg/**"
- "tests/**"
- ".github/workflows/notebook-checks.yml"
push:
branches:
- "refactor/curated-segmentation-notebook"

jobs:
static-and-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install lightweight test dependencies
run: python -m pip install numpy pytest nbformat
- name: Unit tests
run: python -m pytest -q tests/test_core.py
- name: Validate notebook and code syntax
run: |
python - <<'PY'
import ast
import nbformat
nb = nbformat.read('Cable_Segmentation_Refactored.ipynb', as_version=4)
nbformat.validate(nb)
code_cells = [cell for cell in nb.cells if cell.cell_type == 'code']
for cell in code_cells:
ast.parse(cell.source)
assert not cell.outputs
assert cell.execution_count is None
assert len(nb.cells) == 22
print(f'Validated {len(code_cells)} code cells')
PY
Loading
Loading