Skip to content

Commit 148975c

Browse files
authored
Automatically check for dirty notebooks in CI (#18)
Add extra steps in CI to automatically check for dirty notebooks. Also replace outdated SymPDE and Psydac docs with external links to official documentation.
1 parent babf0d4 commit 148975c

File tree

4 files changed

+37
-35
lines changed

4 files changed

+37
-35
lines changed

.github/workflows/build-deploy-book.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,38 @@ jobs:
7171
pip install --upgrade pip
7272
pip install -r requirements.txt
7373
74+
- name: Get list of changed Python notebooks
75+
id: changed-ipynb-files
76+
uses: tj-actions/changed-files@v45
77+
with:
78+
files: |
79+
**.ipynb
80+
81+
- name: Check for dirty Python notebooks
82+
if: steps.changed-ipynb-files.outputs.any_changed == 'true'
83+
env:
84+
ALL_CHANGED_FILES: ${{ steps.changed-ipynb-files.outputs.all_changed_files }}
85+
run: |
86+
# Check if there are dirty notebooks
87+
dirty_ipynb=()
88+
for file in ${ALL_CHANGED_FILES[*]}; do
89+
echo "Checking $file..."
90+
if ! nb-clean check $file >/dev/null 2>&1; then
91+
dirty_ipynb+=($file)
92+
fi
93+
done
94+
95+
# Trigger failure if dirty notebooks were found
96+
if [[ ! -z "${dirty_ipynb[@]}" ]]; then
97+
echo "ERROR: Found dirty Python notebooks. Please clean the notebooks by running"
98+
echo ""
99+
echo "nb-clean clean --remove-empty-cells --remove-all-notebook-metadata ${dirty_ipynb[*]}"
100+
echo ""
101+
exit 1
102+
else
103+
echo "SUCCESS: All changed notebooks are clean."
104+
fi
105+
74106
- name: Build Jupyter Book
75107
run: make docs
76108

_toc.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,8 @@ parts:
175175
- file: chapter5/multiphysics
176176
- caption: Documentation
177177
chapters:
178-
- file: documentation/sympde
179-
- file: documentation/psydac
178+
- url: https://pyccel.github.io/psydac/index.html
179+
title: Psydac
180+
- url: https://sympde.readthedocs.io/en/latest/
181+
title: SymPDE
182+

documentation/psydac.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

documentation/sympde.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)