Fixed image rendering in notebooks (#918) #290
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
# This workflows executes new or modified example notebooks. | |
name: test_changed_notebooks | |
defaults: | |
run: | |
shell: bash # To override PowerShell on Windows | |
on: | |
# Trigger the workflow on push or PR to any branch | |
push: | |
paths: | |
- 'doc/source/examples/**/*.ipynb' | |
pull_request: | |
paths: | |
- 'doc/source/examples/**/*.ipynb' | |
# don't trigger for draft PRs | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
# Trigger the workflow on manual dispatch | |
workflow_dispatch: | |
jobs: | |
test_changed_notebooks: | |
if: github.event.pull_request.draft == false | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
python-version: [ '3.9', '3.10', '3.11', '3.12' ] | |
include: # Run windows tests on only one python version | |
- os: windows-latest | |
python-version: '3.10' # torch 1.x not available on Windows for Python 3.11 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for new or changed .ipynb files | |
id: changed-ipynb | |
uses: tj-actions/changed-files@v41.0.0 | |
with: | |
files: | | |
doc/source/examples/*.ipynb | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade --upgrade-strategy eager -r requirements/dev.txt -r testing/requirements.txt | |
python -m pip install --upgrade --upgrade-strategy eager .[prophet,torch,tensorflow] | |
python -m pip freeze | |
- name: Run notebooks | |
env: | |
FILES: ${{ steps.changed-ipynb.outputs.all_modified_files }} | |
# The following line builds the test case string to be passed to pytest by stripping the directory 'examples/doc/source/', | |
# adding the `or` quantifier between the names and concatenating with the test name `test_notebook_execution`. | |
run: | | |
tests="test_notebook_execution[$(echo ${FILES} | sed 's|doc/source/examples/||g' | sed 's| | or |g')]" && | |
pytest --suppress-no-test-exit-code --no-cov -rA --durations=0 -vv -p no:randomly testing/test_notebooks.py -k "$tests" |