Scheduled or Manually Triggered Testing #12
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: Scheduled or Manually Triggered Testing | |
on: | |
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@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- 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: #using macos-13 because pyenchant doesn't work on macos-latest (macos 14, arm64 architecture) | |
os: [macos-13, windows-latest] | |
python-version: ['3.8', '3.11'] | |
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_", "65_ or 66_ or 67_ or 68_ or 69_ or 70_ or 71_"] | |
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 ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 | |
pytest -v --tb=short tests/test_scripts.py |