Test code in notebooks #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test code in notebooks | |
on: | |
push: | |
branches: [ 'master\+ipynb' ] | |
types: [created, edited, deleted, renamed, forced] # for force pushes from our actions | |
workflow_dispatch: | |
inputs: | |
tags: | |
description: 'Run test of notebooks manually' | |
jobs: | |
test-lnx-py37: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' # Version range or exact version of a Python version to use, using SemVer's version range syntax | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade jupyter | |
python3 -m pip install --upgrade -r requirements.txt | |
- name: Testing notebooks | |
run: | | |
for f in docs/source/*.ipynb | |
do | |
jupyter nbconvert --to notebook --inplace --execute $f || (echo "$f" >> failed_nbs.txt) | |
done | |
if [ -f "failed_nbs.txt" ]; then | |
echo "Some notebooks failed to run. Please check logs." | |
cat failed_nbs.txt | |
exit 1 | |
fi |