Skip to content

Merge pull request #420 from zivy/jupyterNotebook7 #103

Merge pull request #420 from zivy/jupyterNotebook7

Merge pull request #420 from zivy/jupyterNotebook7 #103

Workflow file for this run

name: GitHub Actions
on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'
workflow_dispatch:
# manually trigger workflow with a boolean value indicating whether to use the
# SimpleITK package from test PyPi (pre-release testing)
inputs:
testPyPi:
description: 'Use test PyPi?'
required: true
type: boolean
schedule:
# run testing on the first of each month 5am ET / 9am UTC
- cron: '0 9 1 * *'
concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
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 Python
test:
needs: lint
strategy:
matrix:
os: [macos-latest, windows-latest]
python-version: ['3.8', '3.10']
inputs: ["00_ or 01_ or 02_ or 03_ or 04_ or 05_ or 10_ or 20_ or 21_ or 22_ or 300_ or 30_ or 31_ or 32_ or 33_ or 34_ or 35_ or 36_", "51_ or 55_ or 56_ or 60_ or 61_ or 62_ or 63_ or 64_ or 65_ or 66_ or 67_ or 68_ or 69_ or 70_ or 71_"
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: cache
with:
path: |
Data
key: notebook-data-${{ hashFiles('Data/manifest.json') }}
restore-keys: |
notebook-data-${{ hashFiles('Data/manifest.json') }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# on windows, the pyenchant package includes enchant
- 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-reset
brew install enchant
fi
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements_dev.txt
- name: Install SimpleITK from test PyPi from manually launched workflow
if: ${{ inputs.testPyPi }}
run: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple SimpleITK
- name: Download data
if: steps.cache.outputs.cache-hit != 'true'
run: python Utilities/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