Skip to content

DEV: Add nbval to CI. #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test notebooks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
matrix:
os: [Ubuntu-20.04, macOS-latest]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reasons to not add windows, too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only because I expected it would require special windows-specific handling to make it work... I just tried it and it seems that's the case, see: https://github.com/numpy/numpy-tutorials/runs/7309090446?check_suite_focus=true

My vote is for incremental adoption: get linux/macos in sooner since they're working now, and open a follow-up issue for anyone who wants to figure out what magic combo of workarounds is necessary to get it to work on windows :)

python-version: [3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install -r site/requirements.txt -r requirements.txt
python -m pip list

- name: Test with nbval
run: |
python -m pip install pytest nbval
find content/ -name "*.md" -exec jupytext --to notebook {} \;
# TODO: find better way to exclude notebooks from test
rm content/tutorial-deep-reinforcement-learning-with-pong-from-pixels.ipynb
rm content/pairing.ipynb
rm content/tutorial-style-guide.ipynb
rm content/tutorial-nlp-from-scratch.ipynb
# Test notebook execution
pytest --nbval-lax --durations=10 content/