From df9454e640c8079360e44c14a296a1608c313bd4 Mon Sep 17 00:00:00 2001 From: thecoderatekid Date: Thu, 7 Aug 2025 19:18:02 +0000 Subject: [PATCH] Update .gitea/workflows/notebook-test.yml --- .gitea/workflows/notebook-test.yml | 33 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/notebook-test.yml b/.gitea/workflows/notebook-test.yml index 2bfc613..b143706 100644 --- a/.gitea/workflows/notebook-test.yml +++ b/.gitea/workflows/notebook-test.yml @@ -8,13 +8,32 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: "3.11" # avoid bleeding-edge 3.13 surprises - - name: Install papermill - run: pip install papermill - - - name: Execute notebooks + - name: Install deps run: | - papermill notebook.ipynb output.ipynb + 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 \ No newline at end of file