name: Notebook Test on: [push] jobs: nb-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" # avoid bleeding-edge 3.13 surprises - name: Install deps run: | python -m pip install --upgrade pip pip install papermill nbformat ipykernel - name: Ensure kernel run: python -m ipykernel install --user --name python3 - name: Create sample notebook if missing run: | if [ ! -f notebook.ipynb ]; then python - <<'PY' import nbformat as nbf nb = nbf.v4.new_notebook() nb.cells = [ nbf.v4.new_markdown_cell("# Demo Notebook"), nbf.v4.new_code_cell("x = 2 + 2\nprint('Result:', x)") ] with open("notebook.ipynb", "w", encoding="utf-8") as f: nbf.write(nb, f) PY fi - name: Execute notebook with Papermill run: papermill notebook.ipynb output.ipynb -k python3