From a506cd4b016aed750871d1eabf01a703c0e66e8b Mon Sep 17 00:00:00 2001 From: Thomas Marwitz Date: Fri, 13 Dec 2024 10:25:59 +0100 Subject: [PATCH] Check outputs of example notebooks in CI. Check via execution count in a bash script. --- .github/workflows/ci.yml | 5 +++-- nb-output-exists.sh => nb-output-check.sh | 1 - pixi.toml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) rename nb-output-exists.sh => nb-output-check.sh (92%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32a3ee2..4bdb3e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,8 @@ jobs: - name: pre-commit run: pixi run pre-commit-run --color=always --show-diff-on-failure - mypy-example-nbs: - name: Check notebooks mypy + check-example-nbs: + name: Check notebooks mypy and output exists timeout-minutes: 5 runs-on: ubuntu-latest steps: @@ -48,6 +48,7 @@ jobs: run: | pixi run nb-convert pixi run nb-mypy + pixi run nb-assert-output unit-tests: name: Unit Tests diff --git a/nb-output-exists.sh b/nb-output-check.sh similarity index 92% rename from nb-output-exists.sh rename to nb-output-check.sh index 02f70d1..d206d75 100644 --- a/nb-output-exists.sh +++ b/nb-output-check.sh @@ -6,6 +6,5 @@ for notebook in docs/examples/*.ipynb; do fi done -# If all notebooks are valid echo "All notebooks have valid execution counts." exit 0 diff --git a/pixi.toml b/pixi.toml index a8e7365..a9353d0 100644 --- a/pixi.toml +++ b/pixi.toml @@ -9,6 +9,7 @@ coverage = "pytest tests --cov=metalearners --cov-report=xml --cov-report term-m # Note that this task will fail on systems without bash. nb-convert = "nb-convert.sh" nb-mypy = "mypy docs/examples/*.py" +nb-assert-output = "nb-output-check.sh" [dependencies] pre-commit = "*"