Notebook Testing #74
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: Notebook Testing | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'binder/**' | |
- 'figures/**' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'binder/**' | |
- 'figures/**' | |
schedule: | |
# run testing on the first of each month 5am ET / 9am UTC | |
- cron: '0 9 1 * *' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install and run black for notebooks | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install black[jupyter] | |
black --check --diff --verbose . | |
test: | |
needs: lint | |
strategy: | |
matrix: | |
# not using macos-latest because pyenchant doesn't work with the new macos-14 arm64 | |
os: [ubuntu-latest, macos-13, windows-latest] | |
inputs: ["00_ or 01_ or 02_ or 03_ or 04_ or 05_", "06_ or 07_ or 08_ or 09_ or 10_"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: cache | |
with: | |
path: | | |
data | |
key: notebook-data-${{ hashFiles('data/manifest.json') }} | |
restore-keys: | | |
notebook-data-${{ hashFiles('data/manifest.json') }} | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Install enchant on non windows systems | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update | |
sudo apt-get install enchant-2 | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew update | |
brew install enchant | |
fi | |
# on windows, the pyenchant package includes enchant | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r tests/requirements_testing.txt | |
jupyter nbextension enable --py --sys-prefix widgetsnbextension | |
- name: Download data | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: python downloaddata.py data/ data/manifest.json | |
- name: run the test | |
env: | |
SIMPLE_ITK_MEMORY_CONSTRAINED_ENVIRONMENT: 1 | |
run: | | |
pytest -v --tb=short -k "${{matrix.inputs}}" tests/test_notebooks.py::Test_notebooks::test_python_notebook |