From bc3dcee1979e322035b3e0ee0c556a644fff5400 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:34:52 +0100 Subject: [PATCH 01/13] Refactoring min-dep tests Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/pythonapp-min.yml | 283 ++++++++++++++++++---------- 1 file changed, 179 insertions(+), 104 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 0d147ca264..87b991c532 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -18,23 +18,45 @@ concurrency: cancel-in-progress: true jobs: - # caching of these jobs: - # - docker-py3-pip- (shared) - # - ubuntu py37 pip- - # - os-latest-pip- (shared) - min-dep-os: # min dependencies installed tests for different OS + min-dep: # min dependencies installed tests for different OS runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-latest, macOS-latest, ubuntu-latest] + python-version: ['3.9'] + pytorch-version: ['2.5.1'] + include: + # Test Python versions under Ubuntu with lowest PyTorch version supported + - os: ubuntu-latest + pytorch-version: '2.5.1' + python-version: '3.10' + - os: ubuntu-latest + pytorch-version: '2.5.1' + python-version: '3.11' + - os: ubuntu-latest + pytorch-version: '2.5.1' + python-version: '3.12' + + # test PyTorch versions under Ubuntu and lowest Python version supported + - os: ubuntu-latest + python-version: '3.9' + pytorch-version: '2.6.0' + - os: ubuntu-latest + python-version: '3.9' + pytorch-version: '2.7.1' + - os: ubuntu-latest + python-version: '3.9' + pytorch-version: '2.8.0' + + timeout-minutes: 40 steps: - uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: ${{ matrix.python-version }} - name: Prepare pip wheel run: | which python @@ -51,10 +73,10 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install the dependencies + - name: Install the dependencies with PyTorch ${{ matrix.pytorch-version }} run: | # min. requirements - python -m pip install torch --index-url https://download.pytorch.org/whl/cpu + python -m pip install torch==${{ matrix.pytorch-version }} python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions @@ -63,7 +85,7 @@ jobs: run: | python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' python -c "import monai; monai.config.print_config()" - ./runtests.sh --min + # ./runtests.sh --min shell: bash env: QUICKTEST: True @@ -71,98 +93,151 @@ jobs: NGC_ORG: ${{ secrets.NGC_ORG }} NGC_TEAM: ${{ secrets.NGC_TEAM }} - min-dep-py3: # min dependencies installed tests for different python - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] - timeout-minutes: 40 - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Prepare pip wheel - run: | - which python - python -m pip install --user --upgrade pip setuptools wheel - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - shell: bash - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install the dependencies - run: | - # min. requirements - python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu - python -m pip install -r requirements-min.txt - python -m pip list - BUILD_MONAI=0 python setup.py develop # no compile of extensions - shell: bash - - name: Run quick tests (CPU ${{ runner.os }}) - run: | - python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - python -c "import monai; monai.config.print_config()" - ./runtests.sh --min - env: - QUICKTEST: True - NGC_API_KEY: ${{ secrets.NGC_API_KEY }} - NGC_ORG: ${{ secrets.NGC_ORG }} - NGC_TEAM: ${{ secrets.NGC_TEAM }} + # # caching of these jobs: + # # - docker-py3-pip- (shared) + # # - ubuntu py37 pip- + # # - os-latest-pip- (shared) + # min-dep-os: # min dependencies installed tests for different OS + # runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: false + # matrix: + # os: [windows-latest, macOS-latest, ubuntu-latest] + # timeout-minutes: 40 + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3.9 + # uses: actions/setup-python@v5 + # with: + # python-version: '3.9' + # - name: Prepare pip wheel + # run: | + # which python + # python -m pip install --upgrade pip wheel + # - name: cache weekly timestamp + # id: pip-cache + # run: | + # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + # shell: bash + # - name: cache for pip + # uses: actions/cache@v4 + # id: cache + # with: + # path: ${{ steps.pip-cache.outputs.dir }} + # key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} + # - name: Install the dependencies + # run: | + # # min. requirements + # python -m pip install torch --index-url https://download.pytorch.org/whl/cpu + # python -m pip install -r requirements-min.txt + # python -m pip list + # BUILD_MONAI=0 python setup.py develop # no compile of extensions + # shell: bash + # - name: Run quick tests (CPU ${{ runner.os }}) + # run: | + # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' + # python -c "import monai; monai.config.print_config()" + # ./runtests.sh --min + # shell: bash + # env: + # QUICKTEST: True + # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} + # NGC_ORG: ${{ secrets.NGC_ORG }} + # NGC_TEAM: ${{ secrets.NGC_TEAM }} - min-dep-pytorch: # min dependencies installed tests for different pytorch - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - pytorch-version: ['2.5.1', '2.6.0', '2.7.1', '2.8.0'] - timeout-minutes: 40 - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Prepare pip wheel - run: | - which python - python -m pip install --user --upgrade pip setuptools wheel - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - shell: bash - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install the dependencies - run: | - # min. requirements - python -m pip install torch==${{ matrix.pytorch-version }} - python -m pip install -r requirements-min.txt - python -m pip list - BUILD_MONAI=0 python setup.py develop # no compile of extensions - shell: bash - - name: Run quick tests (pytorch ${{ matrix.pytorch-version }}) - run: | - python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - python -c "import monai; monai.config.print_config()" - ./runtests.sh --min - env: - QUICKTEST: True - NGC_API_KEY: ${{ secrets.NGC_API_KEY }} - NGC_ORG: ${{ secrets.NGC_ORG }} - NGC_TEAM: ${{ secrets.NGC_TEAM }} + # min-dep-py3: # min dependencies installed tests for different python + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # python-version: ['3.9', '3.10', '3.11', '3.12'] + # timeout-minutes: 40 + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + # - name: Prepare pip wheel + # run: | + # which python + # python -m pip install --user --upgrade pip setuptools wheel + # - name: cache weekly timestamp + # id: pip-cache + # run: | + # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + # shell: bash + # - name: cache for pip + # uses: actions/cache@v4 + # id: cache + # with: + # path: ${{ steps.pip-cache.outputs.dir }} + # key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} + # - name: Install the dependencies + # run: | + # # min. requirements + # python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu + # python -m pip install -r requirements-min.txt + # python -m pip list + # BUILD_MONAI=0 python setup.py develop # no compile of extensions + # shell: bash + # - name: Run quick tests (CPU ${{ runner.os }}) + # run: | + # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' + # python -c "import monai; monai.config.print_config()" + # ./runtests.sh --min + # env: + # QUICKTEST: True + # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} + # NGC_ORG: ${{ secrets.NGC_ORG }} + # NGC_TEAM: ${{ secrets.NGC_TEAM }} + + # min-dep-pytorch: # min dependencies installed tests for different pytorch + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # pytorch-version: ['2.5.1', '2.6.0', '2.7.1', '2.8.0'] + # timeout-minutes: 40 + # steps: + # - uses: actions/checkout@v4 + # - name: Set up Python 3.9 + # uses: actions/setup-python@v5 + # with: + # python-version: '3.9' + # - name: Prepare pip wheel + # run: | + # which python + # python -m pip install --user --upgrade pip setuptools wheel + # - name: cache weekly timestamp + # id: pip-cache + # run: | + # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + # shell: bash + # - name: cache for pip + # uses: actions/cache@v4 + # id: cache + # with: + # path: ${{ steps.pip-cache.outputs.dir }} + # key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} + # - name: Install the dependencies + # run: | + # # min. requirements + # python -m pip install torch==${{ matrix.pytorch-version }} + # python -m pip install -r requirements-min.txt + # python -m pip list + # BUILD_MONAI=0 python setup.py develop # no compile of extensions + # shell: bash + # - name: Run quick tests (pytorch ${{ matrix.pytorch-version }}) + # run: | + # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' + # python -c "import monai; monai.config.print_config()" + # ./runtests.sh --min + # env: + # QUICKTEST: True + # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} + # NGC_ORG: ${{ secrets.NGC_ORG }} + # NGC_TEAM: ${{ secrets.NGC_TEAM }} From 2b9a9924d0ea66f272158cd451e477f58edbbb14 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:39:52 +0100 Subject: [PATCH 02/13] Update test Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/pythonapp-min.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 87b991c532..3b70fb100b 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -1,4 +1,3 @@ -# Jenkinsfile.monai-premerge name: premerge-min on: @@ -29,27 +28,20 @@ jobs: include: # Test Python versions under Ubuntu with lowest PyTorch version supported - os: ubuntu-latest - pytorch-version: '2.5.1' python-version: '3.10' - os: ubuntu-latest - pytorch-version: '2.5.1' python-version: '3.11' - os: ubuntu-latest - pytorch-version: '2.5.1' python-version: '3.12' - # test PyTorch versions under Ubuntu and lowest Python version supported + # Test PyTorch versions under Ubuntu with lowest Python version supported - os: ubuntu-latest - python-version: '3.9' pytorch-version: '2.6.0' - os: ubuntu-latest - python-version: '3.9' pytorch-version: '2.7.1' - os: ubuntu-latest - python-version: '3.9' pytorch-version: '2.8.0' - timeout-minutes: 40 steps: - uses: actions/checkout@v4 From 44bc1aedc282140cdc09abe32a1f2879ff7c7814 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:43:34 +0100 Subject: [PATCH 03/13] Update test Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/pythonapp-min.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 3b70fb100b..8f019e1f54 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -23,8 +23,8 @@ jobs: fail-fast: false matrix: os: [windows-latest, macOS-latest, ubuntu-latest] - python-version: ['3.9'] - pytorch-version: ['2.5.1'] + python-version: '3.9' + pytorch-version: '2.5.1' include: # Test Python versions under Ubuntu with lowest PyTorch version supported - os: ubuntu-latest From 0c8c868577549356c8298d5fcc91223142c620e9 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:45:13 +0100 Subject: [PATCH 04/13] Restoring include that worked Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/pythonapp-min.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 8f019e1f54..48f422af26 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -23,23 +23,29 @@ jobs: fail-fast: false matrix: os: [windows-latest, macOS-latest, ubuntu-latest] - python-version: '3.9' - pytorch-version: '2.5.1' + python-version: ['3.9'] + pytorch-version: ['2.5.1'] include: # Test Python versions under Ubuntu with lowest PyTorch version supported - os: ubuntu-latest + pytorch-version: '2.5.1' python-version: '3.10' - os: ubuntu-latest + pytorch-version: '2.5.1' python-version: '3.11' - os: ubuntu-latest + pytorch-version: '2.5.1' python-version: '3.12' # Test PyTorch versions under Ubuntu with lowest Python version supported - os: ubuntu-latest + python-version: '3.9' pytorch-version: '2.6.0' - os: ubuntu-latest + python-version: '3.9' pytorch-version: '2.7.1' - os: ubuntu-latest + python-version: '3.9' pytorch-version: '2.8.0' timeout-minutes: 40 From e3616e4e262437f24ddfd260f89c0309b228c8d0 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:57:07 +0100 Subject: [PATCH 05/13] Renaming file Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/{pythonapp-min.yml => cicd_tests.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{pythonapp-min.yml => cicd_tests.yml} (100%) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/cicd_tests.yml similarity index 100% rename from .github/workflows/pythonapp-min.yml rename to .github/workflows/cicd_tests.yml From 53cb0a4f31ec054c57b0a0d59cb1f0dce5ac8a56 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:05:26 +0100 Subject: [PATCH 06/13] Combining tests Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 367 ++++++++++++++++++------------- 1 file changed, 220 insertions(+), 147 deletions(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 48f422af26..a8ccc110ec 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -1,4 +1,4 @@ -name: premerge-min +name: tests on: # quick tests for pull requests and the releasing branches @@ -17,6 +17,39 @@ concurrency: cancel-in-progress: true jobs: + static-checks: + runs-on: ubuntu-latest + strategy: + matrix: + opt: ["codeformat", "pytype", "mypy"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: cache weekly timestamp + id: pip-cache + run: | + echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + - name: cache for pip + uses: actions/cache@v4 + id: cache + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + - name: Install dependencies + run: | + find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; + python -m pip install --upgrade pip wheel + python -m pip install -r requirements-dev.txt + - name: Lint and type check + run: | + # clean up temporary files + $(pwd)/runtests.sh --build --clean + # Github actions have 2 cores, so parallelize pytype + $(pwd)/runtests.sh --build --${{ matrix.opt }} -j 2 + min-dep: # min dependencies installed tests for different OS runs-on: ${{ matrix.os }} strategy: @@ -91,151 +124,191 @@ jobs: NGC_ORG: ${{ secrets.NGC_ORG }} NGC_TEAM: ${{ secrets.NGC_TEAM }} - # # caching of these jobs: - # # - docker-py3-pip- (shared) - # # - ubuntu py37 pip- - # # - os-latest-pip- (shared) - # min-dep-os: # min dependencies installed tests for different OS - # runs-on: ${{ matrix.os }} - # strategy: - # fail-fast: false - # matrix: - # os: [windows-latest, macOS-latest, ubuntu-latest] - # timeout-minutes: 40 - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3.9 - # uses: actions/setup-python@v5 - # with: - # python-version: '3.9' - # - name: Prepare pip wheel - # run: | - # which python - # python -m pip install --upgrade pip wheel - # - name: cache weekly timestamp - # id: pip-cache - # run: | - # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - # shell: bash - # - name: cache for pip - # uses: actions/cache@v4 - # id: cache - # with: - # path: ${{ steps.pip-cache.outputs.dir }} - # key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - # - name: Install the dependencies - # run: | - # # min. requirements - # python -m pip install torch --index-url https://download.pytorch.org/whl/cpu - # python -m pip install -r requirements-min.txt - # python -m pip list - # BUILD_MONAI=0 python setup.py develop # no compile of extensions - # shell: bash - # - name: Run quick tests (CPU ${{ runner.os }}) - # run: | - # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - # python -c "import monai; monai.config.print_config()" - # ./runtests.sh --min - # shell: bash - # env: - # QUICKTEST: True - # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} - # NGC_ORG: ${{ secrets.NGC_ORG }} - # NGC_TEAM: ${{ secrets.NGC_TEAM }} + full-dep: # full dependencies installed tests for different OS + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [windows-latest, macOS-latest, ubuntu-latest] + timeout-minutes: 120 + steps: + - if: runner.os == 'windows' + name: Config pagefile (Windows only) + uses: al-cheb/configure-pagefile-action@v1.4 + with: + minimum-size: 8GB + maximum-size: 16GB + disk-root: "D:" + - uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Prepare pip wheel + run: | + which python + python -m pip install --upgrade pip wheel + - name: cache weekly timestamp + id: pip-cache + run: | + echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + shell: bash + - name: cache for pip + uses: actions/cache@v4 + id: cache + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} + - if: runner.os == 'windows' + name: Install torch cpu from pytorch.org (Windows only) + run: | + python -m pip install torch==2.5.1 torchvision==0.20.1+cpu --index-url https://download.pytorch.org/whl/cpu + - if: runner.os == 'Linux' + name: Install itk pre-release (Linux only) + run: | + python -m pip install --pre -U itk + find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; + - name: Install the dependencies + run: | + python -m pip install --user --upgrade pip wheel + python -m pip install torch==2.5.1 torchvision==0.20.1 + cat "requirements-dev.txt" + python -m pip install -r requirements-dev.txt + python -m pip list + python setup.py develop # test no compile installation + shell: bash + - name: Run compiled (${{ runner.os }}) + run: | + python setup.py develop --uninstall + BUILD_MONAI=1 python setup.py develop # compile the cpp extensions + shell: bash + - name: Run quick tests (CPU ${{ runner.os }}) + run: | + python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' + python -c "import monai; monai.config.print_config()" + # python -m unittest -v + env: + QUICKTEST: True + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 + + packaging: + runs-on: ubuntu-latest + env: + QUICKTEST: True + shell: bash + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: cache weekly timestamp + id: pip-cache + run: | + echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + - name: cache for pip + uses: actions/cache@v4 + id: cache + with: + path: | + ~/.cache/pip + ~/.cache/torch + key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + - name: Install dependencies + run: | + find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; + python -m pip install --user --upgrade pip setuptools wheel twine packaging + # install the latest pytorch for testing + # however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated + # fresh torch installation according to pyproject.toml + python -m pip install torch>=2.5.1 torchvision + - name: Check packages + run: | + pip uninstall monai + pip list | grep -iv monai + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + set -e - # min-dep-py3: # min dependencies installed tests for different python - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # python-version: ['3.9', '3.10', '3.11', '3.12'] - # timeout-minutes: 40 - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Prepare pip wheel - # run: | - # which python - # python -m pip install --user --upgrade pip setuptools wheel - # - name: cache weekly timestamp - # id: pip-cache - # run: | - # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - # shell: bash - # - name: cache for pip - # uses: actions/cache@v4 - # id: cache - # with: - # path: ${{ steps.pip-cache.outputs.dir }} - # key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} - # - name: Install the dependencies - # run: | - # # min. requirements - # python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu - # python -m pip install -r requirements-min.txt - # python -m pip list - # BUILD_MONAI=0 python setup.py develop # no compile of extensions - # shell: bash - # - name: Run quick tests (CPU ${{ runner.os }}) - # run: | - # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - # python -c "import monai; monai.config.print_config()" - # ./runtests.sh --min - # env: - # QUICKTEST: True - # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} - # NGC_ORG: ${{ secrets.NGC_ORG }} - # NGC_TEAM: ${{ secrets.NGC_TEAM }} + # build tar.gz and wheel + python setup.py check -m -s + python setup.py sdist bdist_wheel + python -m twine check dist/* + - run: echo "pwd=$PWD" >> $GITHUB_OUTPUT + id: root + - run: echo "tmp_dir=$(mktemp -d)" >> $GITHUB_OUTPUT + id: mktemp + - name: Move packages + run: | + printf ${{ steps.root.outputs.pwd }} + printf ${{ steps.mktemp.outputs.tmp_dir }} + # move packages to a temp dir + cp dist/monai* "${{ steps.mktemp.outputs.tmp_dir }}" + rm -r build dist monai.egg-info + cd "${{ steps.mktemp.outputs.tmp_dir }}" + ls -al + - name: Install wheel file + working-directory: ${{ steps.mktemp.outputs.tmp_dir }} + run: | + # install from wheel + python -m pip install monai*.whl + python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" + python -c 'import monai; print(monai.__file__)' + python -m pip uninstall -y monai + rm monai*.whl + - name: Install source archive + working-directory: ${{ steps.mktemp.outputs.tmp_dir }} + run: | + # install from tar.gz + name=$(ls *.tar.gz | head -n1) + echo $name + python -m pip install $name[all] + python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" + python -c 'import monai; print(monai.__file__)' + - name: Quick test + working-directory: ${{ steps.mktemp.outputs.tmp_dir }} + run: | + # run min tests + cp ${{ steps.root.outputs.pwd }}/requirements*.txt . + cp -r ${{ steps.root.outputs.pwd }}/tests . + ls -al + python -m pip install -r requirements-dev.txt + python -m unittest -v + env: + PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 - # min-dep-pytorch: # min dependencies installed tests for different pytorch - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # matrix: - # pytorch-version: ['2.5.1', '2.6.0', '2.7.1', '2.8.0'] - # timeout-minutes: 40 - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python 3.9 - # uses: actions/setup-python@v5 - # with: - # python-version: '3.9' - # - name: Prepare pip wheel - # run: | - # which python - # python -m pip install --user --upgrade pip setuptools wheel - # - name: cache weekly timestamp - # id: pip-cache - # run: | - # echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - # echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - # shell: bash - # - name: cache for pip - # uses: actions/cache@v4 - # id: cache - # with: - # path: ${{ steps.pip-cache.outputs.dir }} - # key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} - # - name: Install the dependencies - # run: | - # # min. requirements - # python -m pip install torch==${{ matrix.pytorch-version }} - # python -m pip install -r requirements-min.txt - # python -m pip list - # BUILD_MONAI=0 python setup.py develop # no compile of extensions - # shell: bash - # - name: Run quick tests (pytorch ${{ matrix.pytorch-version }}) - # run: | - # python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - # python -c "import monai; monai.config.print_config()" - # ./runtests.sh --min - # env: - # QUICKTEST: True - # NGC_API_KEY: ${{ secrets.NGC_API_KEY }} - # NGC_ORG: ${{ secrets.NGC_ORG }} - # NGC_TEAM: ${{ secrets.NGC_TEAM }} + build-docs: + 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: cache weekly timestamp + id: pip-cache + run: | + echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT + - name: cache for pip + uses: actions/cache@v4 + id: cache + with: + path: | + ~/.cache/pip + ~/.cache/torch + key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip wheel + python -m pip install -r docs/requirements.txt + - name: Make html + run: | + cd docs/ + make clean + make html 2>&1 | tee tmp_log + if [[ $(grep -c "ERROR:" tmp_log) != 0 ]]; then echo "found errors"; grep "ERROR:" tmp_log; exit 1; fi + sed '/WARNING.*pip/d' tmp_log > tmp_log1; mv tmp_log1 tmp_log # monai#7133 + if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "found warnings"; grep "WARNING:" tmp_log; exit 1; fi + shell: bash From 28f06ff8e75b4c617ccd163f183c78f8cff5e618 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:06:16 +0100 Subject: [PATCH 07/13] Removing combined file Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/pythonapp.yml | 245 -------------------------------- 1 file changed, 245 deletions(-) delete mode 100644 .github/workflows/pythonapp.yml diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml deleted file mode 100644 index c68c879231..0000000000 --- a/.github/workflows/pythonapp.yml +++ /dev/null @@ -1,245 +0,0 @@ -# Jenkinsfile.monai-premerge -name: premerge - -on: - # quick tests for pull requests and the releasing branches - push: - branches: - - dev - - main - - releasing/* - pull_request: - head_ref-ignore: - - dev - -concurrency: - # automatically cancel the previously triggered workflows when there's a newer version - group: build-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - # caching of these jobs: - # - docker-py3-pip- (shared) - # - ubuntu py37 pip- - # - os-latest-pip- (shared) - flake8-py3: - runs-on: ubuntu-latest - strategy: - matrix: - opt: ["codeformat", "pytype", "mypy"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install dependencies - run: | - find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; - python -m pip install --upgrade pip wheel - python -m pip install -r requirements-dev.txt - - name: Lint and type check - run: | - # clean up temporary files - $(pwd)/runtests.sh --build --clean - # Github actions have 2 cores, so parallelize pytype - $(pwd)/runtests.sh --build --${{ matrix.opt }} -j 2 - - quick-py3: # full dependencies installed tests for different OS - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [windows-latest, macOS-latest, ubuntu-latest] - timeout-minutes: 120 - steps: - - if: runner.os == 'windows' - name: Config pagefile (Windows only) - uses: al-cheb/configure-pagefile-action@v1.4 - with: - minimum-size: 8GB - maximum-size: 16GB - disk-root: "D:" - - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Prepare pip wheel - run: | - which python - python -m pip install --upgrade pip wheel - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT - shell: bash - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - - if: runner.os == 'windows' - name: Install torch cpu from pytorch.org (Windows only) - run: | - python -m pip install torch==2.5.1 torchvision==0.20.1+cpu --index-url https://download.pytorch.org/whl/cpu - - if: runner.os == 'Linux' - name: Install itk pre-release (Linux only) - run: | - python -m pip install --pre -U itk - find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; - - name: Install the dependencies - run: | - python -m pip install --user --upgrade pip wheel - python -m pip install torch==2.5.1 torchvision==0.20.1 - cat "requirements-dev.txt" - python -m pip install -r requirements-dev.txt - python -m pip list - python setup.py develop # test no compile installation - shell: bash - - name: Run compiled (${{ runner.os }}) - run: | - python setup.py develop --uninstall - BUILD_MONAI=1 python setup.py develop # compile the cpp extensions - shell: bash - - name: Run quick tests (CPU ${{ runner.os }}) - run: | - python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' - python -c "import monai; monai.config.print_config()" - python -m unittest -v - env: - QUICKTEST: True - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 - - packaging: - runs-on: ubuntu-latest - env: - QUICKTEST: True - shell: bash - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: | - ~/.cache/pip - ~/.cache/torch - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install dependencies - run: | - find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; - python -m pip install --user --upgrade pip setuptools wheel twine packaging - # install the latest pytorch for testing - # however, "pip install monai*.tar.gz" will build cpp/cuda with an isolated - # fresh torch installation according to pyproject.toml - python -m pip install torch>=2.5.1 torchvision - - name: Check packages - run: | - pip uninstall monai - pip list | grep -iv monai - git fetch --depth=1 origin +refs/tags/*:refs/tags/* - set -e - - # build tar.gz and wheel - python setup.py check -m -s - python setup.py sdist bdist_wheel - python -m twine check dist/* - - run: echo "pwd=$PWD" >> $GITHUB_OUTPUT - id: root - - run: echo "tmp_dir=$(mktemp -d)" >> $GITHUB_OUTPUT - id: mktemp - - name: Move packages - run: | - printf ${{ steps.root.outputs.pwd }} - printf ${{ steps.mktemp.outputs.tmp_dir }} - # move packages to a temp dir - cp dist/monai* "${{ steps.mktemp.outputs.tmp_dir }}" - rm -r build dist monai.egg-info - cd "${{ steps.mktemp.outputs.tmp_dir }}" - ls -al - - name: Install wheel file - working-directory: ${{ steps.mktemp.outputs.tmp_dir }} - run: | - # install from wheel - python -m pip install monai*.whl - python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" - python -c 'import monai; print(monai.__file__)' - python -m pip uninstall -y monai - rm monai*.whl - - name: Install source archive - working-directory: ${{ steps.mktemp.outputs.tmp_dir }} - run: | - # install from tar.gz - name=$(ls *.tar.gz | head -n1) - echo $name - python -m pip install $name[all] - python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown" - python -c 'import monai; print(monai.__file__)' - - name: Quick test - working-directory: ${{ steps.mktemp.outputs.tmp_dir }} - run: | - # run min tests - cp ${{ steps.root.outputs.pwd }}/requirements*.txt . - cp -r ${{ steps.root.outputs.pwd }}/tests . - ls -al - python -m pip install -r requirements-dev.txt - python -m unittest -v - env: - PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 - - build-docs: - 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: cache weekly timestamp - id: pip-cache - run: | - echo "datew=$(date '+%Y-%V')" >> $GITHUB_OUTPUT - - name: cache for pip - uses: actions/cache@v4 - id: cache - with: - path: | - ~/.cache/pip - ~/.cache/torch - key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip wheel - python -m pip install -r docs/requirements.txt - - name: Make html - run: | - cd docs/ - make clean - make html 2>&1 | tee tmp_log - if [[ $(grep -c "ERROR:" tmp_log) != 0 ]]; then echo "found errors"; grep "ERROR:" tmp_log; exit 1; fi - sed '/WARNING.*pip/d' tmp_log > tmp_log1; mv tmp_log1 tmp_log # monai#7133 - if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "found warnings"; grep "WARNING:" tmp_log; exit 1; fi - shell: bash From 4d8807555e420f0aa4f1adfa52c599fb2913fb0f Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:38:11 +0100 Subject: [PATCH 08/13] Script update Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index a8ccc110ec..25870c4e9a 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -13,11 +13,15 @@ on: concurrency: # automatically cancel the previously triggered workflows when there's a newer version - group: build-min-${{ github.event.pull_request.number || github.ref }} + group: cicd-tests-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +# These jobs run the CICD tests, type checking, and testing packaging and documentation generation. These use the +# minimum supported versions of Python and PyTorch in many places hard-coded as literals, so when support is dropped +# for a version it is important to go through all jobs and check the versions they use are correct. + jobs: - static-checks: + static-checks: # Perform static type and other checks using runtests.sh runs-on: ubuntu-latest strategy: matrix: @@ -43,14 +47,14 @@ jobs: find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; python -m pip install --upgrade pip wheel python -m pip install -r requirements-dev.txt - - name: Lint and type check + - name: Lint and type check with "./runtests.sh --build --${{ matrix.opt }}" run: | # clean up temporary files $(pwd)/runtests.sh --build --clean - # Github actions have 2 cores, so parallelize pytype - $(pwd)/runtests.sh --build --${{ matrix.opt }} -j 2 + # Github actions have multiple cores, so parallelize pytype + $(pwd)/runtests.sh --build --${{ matrix.opt }} -j $(nproc --all) - min-dep: # min dependencies installed tests for different OS + min-dep: # Test with minumum dependencies installed for different OS, Python, and PyTorch combinations runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -124,7 +128,7 @@ jobs: NGC_ORG: ${{ secrets.NGC_ORG }} NGC_TEAM: ${{ secrets.NGC_TEAM }} - full-dep: # full dependencies installed tests for different OS + full-dep: # Test with full dependencies installed for different OS runners runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -192,7 +196,7 @@ jobs: QUICKTEST: True PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 - packaging: + packaging: # Test package generation runs-on: ubuntu-latest env: QUICKTEST: True @@ -279,7 +283,7 @@ jobs: env: PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION: python # https://github.com/Project-MONAI/MONAI/issues/4354 - build-docs: + build-docs: # Test building documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -308,7 +312,7 @@ jobs: cd docs/ make clean make html 2>&1 | tee tmp_log - if [[ $(grep -c "ERROR:" tmp_log) != 0 ]]; then echo "found errors"; grep "ERROR:" tmp_log; exit 1; fi + if [[ $(grep -c "ERROR:" tmp_log) != 0 ]]; then echo "Found errors:"; grep "ERROR:" tmp_log; exit 1; fi sed '/WARNING.*pip/d' tmp_log > tmp_log1; mv tmp_log1 tmp_log # monai#7133 - if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "found warnings"; grep "WARNING:" tmp_log; exit 1; fi - shell: bash + if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "Found warnings:"; grep "WARNING:" tmp_log; exit 1; fi + shell: bash \ No newline at end of file From d7e1451086822cf4f39a0d6357621451d4926ca4 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Mon, 8 Sep 2025 13:55:12 +0100 Subject: [PATCH 09/13] Fix Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 25870c4e9a..2c47923beb 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -16,7 +16,7 @@ concurrency: group: cicd-tests-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true -# These jobs run the CICD tests, type checking, and testing packaging and documentation generation. These use the +# These jobs run the CICD tests, type checking, and testing packaging and documentation generation. These use the # minimum supported versions of Python and PyTorch in many places hard-coded as literals, so when support is dropped # for a version it is important to go through all jobs and check the versions they use are correct. @@ -53,7 +53,7 @@ jobs: $(pwd)/runtests.sh --build --clean # Github actions have multiple cores, so parallelize pytype $(pwd)/runtests.sh --build --${{ matrix.opt }} -j $(nproc --all) - + min-dep: # Test with minumum dependencies installed for different OS, Python, and PyTorch combinations runs-on: ${{ matrix.os }} strategy: @@ -315,4 +315,4 @@ jobs: if [[ $(grep -c "ERROR:" tmp_log) != 0 ]]; then echo "Found errors:"; grep "ERROR:" tmp_log; exit 1; fi sed '/WARNING.*pip/d' tmp_log > tmp_log1; mv tmp_log1 tmp_log # monai#7133 if [[ $(grep -c "WARNING:" tmp_log) != 0 ]]; then echo "Found warnings:"; grep "WARNING:" tmp_log; exit 1; fi - shell: bash \ No newline at end of file + shell: bash From 7fc61070bef6540afbd8de7a3034b87de3a1057d Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Tue, 9 Sep 2025 00:21:57 +0100 Subject: [PATCH 10/13] Update with GPU runner Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 2c47923beb..1af6a783bd 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -59,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, macOS-latest, ubuntu-latest] + os: [windows-latest, macOS-latest, ubuntu-latest, linux-gpu-runner] python-version: ['3.9'] pytorch-version: ['2.5.1'] include: @@ -110,6 +110,7 @@ jobs: key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - name: Install the dependencies with PyTorch ${{ matrix.pytorch-version }} run: | + /usr/bin/env nvidia-smi &> /dev/null || echo "No nvidia-smi found" # min. requirements python -m pip install torch==${{ matrix.pytorch-version }} python -m pip install -r requirements-min.txt From 3a2381c646bc526cddab79c52219fb69d525dc1a Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Tue, 9 Sep 2025 00:32:46 +0100 Subject: [PATCH 11/13] Whoops Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 1af6a783bd..1fbc2e6376 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -110,7 +110,7 @@ jobs: key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - name: Install the dependencies with PyTorch ${{ matrix.pytorch-version }} run: | - /usr/bin/env nvidia-smi &> /dev/null || echo "No nvidia-smi found" + /usr/bin/env nvidia-smi 2> /dev/null || echo "No nvidia-smi found" # min. requirements python -m pip install torch==${{ matrix.pytorch-version }} python -m pip install -r requirements-min.txt From 95b731071258c9e57d99fa3aaa279eb8dbcc6dbd Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Tue, 9 Sep 2025 00:42:02 +0100 Subject: [PATCH 12/13] Adding GPU check Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 1fbc2e6376..139a755261 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -66,13 +66,7 @@ jobs: # Test Python versions under Ubuntu with lowest PyTorch version supported - os: ubuntu-latest pytorch-version: '2.5.1' - python-version: '3.10' - - os: ubuntu-latest - pytorch-version: '2.5.1' - python-version: '3.11' - - os: ubuntu-latest - pytorch-version: '2.5.1' - python-version: '3.12' + python-version: ['3.10', '3.11', '3.12'] # Test PyTorch versions under Ubuntu with lowest Python version supported - os: ubuntu-latest @@ -108,16 +102,21 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }} - - name: Install the dependencies with PyTorch ${{ matrix.pytorch-version }} + - name: Install the minimum dependencies run: | - /usr/bin/env nvidia-smi 2> /dev/null || echo "No nvidia-smi found" # min. requirements python -m pip install torch==${{ matrix.pytorch-version }} python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions shell: bash - - name: Run quick tests (CPU ${{ runner.os }}) + - if: matrix.os == 'linux-gpu-runner' + name: Print GPU Info + run: | + nvidia-smi + python -c 'import torch; print(torch.rand(2,2).to("cuda:0"))' + shell: bash + - name: Run quick tests run: | python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' python -c "import monai; monai.config.print_config()" @@ -174,7 +173,7 @@ jobs: run: | python -m pip install --pre -U itk find /opt/hostedtoolcache/* -maxdepth 0 ! -name 'Python' -exec rm -rf {} \; - - name: Install the dependencies + - name: Install the complete dependencies run: | python -m pip install --user --upgrade pip wheel python -m pip install torch==2.5.1 torchvision==0.20.1 @@ -188,7 +187,7 @@ jobs: python setup.py develop --uninstall BUILD_MONAI=1 python setup.py develop # compile the cpp extensions shell: bash - - name: Run quick tests (CPU ${{ runner.os }}) + - name: Run quick tests run: | python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))' python -c "import monai; monai.config.print_config()" From d8128f4b4208615bd981441acf8a06bfde8a8f58 Mon Sep 17 00:00:00 2001 From: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Date: Tue, 9 Sep 2025 00:43:20 +0100 Subject: [PATCH 13/13] Fix Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> --- .github/workflows/cicd_tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd_tests.yml b/.github/workflows/cicd_tests.yml index 139a755261..b48b8468f4 100644 --- a/.github/workflows/cicd_tests.yml +++ b/.github/workflows/cicd_tests.yml @@ -66,7 +66,13 @@ jobs: # Test Python versions under Ubuntu with lowest PyTorch version supported - os: ubuntu-latest pytorch-version: '2.5.1' - python-version: ['3.10', '3.11', '3.12'] + python-version: '3.10' + - os: ubuntu-latest + pytorch-version: '2.5.1' + python-version: '3.11' + - os: ubuntu-latest + pytorch-version: '2.5.1' + python-version: '3.12' # Test PyTorch versions under Ubuntu with lowest Python version supported - os: ubuntu-latest