RdTools 3.0 #556
This file contains 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: nbval | |
on: [pull_request] | |
jobs: | |
notebook-check: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # don't cancel other matrix jobs when one fails | |
matrix: | |
notebook-file: [ | |
'TrendAnalysis_example.ipynb', | |
'TrendAnalysis_example_NSRDB.ipynb', | |
'degradation_and_soiling_example.ipynb', | |
'system_availability_example.ipynb' | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install notebook environment | |
run: | | |
python -m pip install --upgrade pip wheel | |
pip install --timeout=300 -r requirements.txt -r docs/notebook_requirements.txt .[test] | |
- name: Run notebook and check output | |
run: | | |
# --sanitize-with: pre-process text to remove irrelevant differences (e.g. warning filepaths) | |
pytest --nbval --sanitize-with docs/nbval_sanitization_rules.cfg docs/${{ matrix.notebook-file }} | |
- name: Run notebooks again, save files | |
run: | | |
pip install nbconvert[webpdf] | |
mkdir docs/artifacts | |
jupyter nbconvert --to html --execute --ExecutePreprocessor.timeout=600 --allow-errors --output artifacts/${{ matrix.notebook-file }}.html docs/${{ matrix.notebook-file }} | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: executed_notebook_${{ matrix.notebook-file }} | |
path: docs/artifacts |