Skip to content
Merged
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
82 changes: 82 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Notebook smoke

on:
push:
branches: [main]
paths:
- "notebooks/**"
- "src/freshdata/**"
- "pyproject.toml"
- ".github/workflows/notebooks.yml"
pull_request:
paths:
- "notebooks/**"
- "src/freshdata/**"
- "pyproject.toml"
- ".github/workflows/notebooks.yml"
workflow_dispatch:

concurrency:
group: notebooks-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
smoke:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
persist-credentials: false

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install notebook smoke dependencies
run: |
python -m pip install --upgrade pip
pip install -e . nbclient nbformat ipykernel
Comment thread
coderabbitai[bot] marked this conversation as resolved.
python -m ipykernel install --user --name freshdata-smoke

- name: Validate notebook JSON
run: |
python - <<'PY'
from pathlib import Path

import nbformat

notebooks = sorted(Path("notebooks").rglob("*.ipynb"))
if not notebooks:
raise SystemExit("no notebooks found")

for path in notebooks:
notebook = nbformat.read(path, as_version=4)
nbformat.validate(notebook)
print(f"validated {path}")
PY

# Keep optional ML/model notebooks out of required CI. The quickstart is
# deliberately dependency-light and exercises the installed package.
- name: Execute quickstart notebook
run: |
python - <<'PY'
from pathlib import Path

import nbformat
from nbclient import NotebookClient

path = Path("notebooks/01_quickstart.ipynb")
notebook = nbformat.read(path, as_version=4)
NotebookClient(
notebook,
timeout=120,
kernel_name="freshdata-smoke",
resources={"metadata": {"path": str(path.parent)}},
).execute()
print(f"executed {path}")
PY
Loading