Skip to content

Commit

Permalink
Add CI to check if tutorials can be run. (#480)
Browse files Browse the repository at this point in the history
* add: add ci to check if tutorials run.

* fix: add jupyter installation

* fix: add tensorflow and jupyter to dev dependencies

* fix: make 07 run faster

* fix: tutorial 8 runs now

* fix: run 08

* fix: rm tensorflow dep

* fix: add fix for tutorial 07, leftover from #484

* fix: fix fix tut 07

* add: add manual trigger for workflow

* rm: remove dispatch workflow

* fix: fix dataloader

* fix: update workflow trigger
  • Loading branch information
jnsbck authored Nov 14, 2024
1 parent fd3e2b2 commit 175758d
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 202 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/run_tutorials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Run Tutorials
on:
push:
branches:
- main
release:
types: [ published ]

jobs:
build:
name: Run Tutorials
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
with:
lfs: true

- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Modify notebook parameters
run: |
# Replace parameters to reduce exec time of 07_gradient_descent
sed -i 's/batch_size = 4/batch_size = 1/' docs/tutorials/07_gradient_descent.ipynb
sed -i 's/for epoch in range(10):/for epoch in range(1):/' docs/tutorials/07_gradient_descent.ipynb
sed -i 's/inputs = jnp.asarray(np.random.rand(100, 2))/inputs = jnp.asarray(np.random.rand(3, 2))/' docs/tutorials/07_gradient_descent.ipynb
sed -i 's/t_max = 5.0/t_max = 3.0/' docs/tutorials/07_gradient_descent.ipynb
- name: Test notebooks
run: |
for notebook in docs/tutorials/*.ipynb; do
echo "Testing $notebook"
jupyter nbconvert --to notebook --execute --ExecutePreprocessor.timeout=600 "$notebook"
done
Loading

0 comments on commit 175758d

Please sign in to comment.