Skip to content

Commit 879b47a

Browse files
ci: run full-dependency tests with Python 3.12 and PyTorch 2.15 (#9140)
Related to #9069. Follow-up to #9266. ### Description Add an Ubuntu entry to the existing full-dependency matrix for Python 3.12, PyTorch 2.15.0, and torchvision 0.29.2. It installs the full and testing extras, builds and imports the C++ extension, verifies the resolved PyTorch and torchvision versions, and runs the existing full unit-test step. The three existing full-dependency entries keep their required check names and default versions. ### Validation - Validated the workflow with actionlint and evaluated the GitHub Actions expressions for all four matrix entries. - On Python 3.12, imported the pinned PyTorch and torchvision CPU builds and verified that the version check rejects either version mismatch. - Ran the MONAI formatting checks and all eight dependency-parser tests locally. The full-dependency suite runs in GitHub Actions. ### Types of changes - [x] Non-breaking CI change. - [x] New test matrix entry. Assisted by OpenAI Codex. --------- Signed-off-by: Demetrios Agourakis <demetrios@agourakis.med.br> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 657f098 commit 879b47a

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

‎.github/workflows/ci_tests.yml‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,28 @@ jobs:
209209
NGC_TEAM: ${{ secrets.NGC_TEAM }}
210210

211211
full-dep: # Test with full dependencies installed for different OS runners
212+
# Keep the existing check names for branch protection.
213+
name: >-
214+
full-dep (${{ matrix.os }}${{ matrix.python-version &&
215+
format(', {0}, {1}', matrix.python-version, matrix.pytorch-version) || '' }})
212216
runs-on: ${{ matrix.os }}
213217
strategy:
214218
fail-fast: false
215219
matrix:
216-
os: [windows-latest, ubuntu-latest, macOS-latest] # macOS-latest is very slow (#8864), testing install only
220+
include:
221+
- os: windows-latest
222+
- os: ubuntu-latest
223+
- os: macOS-latest # macOS-latest is very slow (#8864), testing install only
224+
- os: ubuntu-latest
225+
python-version: '3.12'
226+
pytorch-version: '2.15.0'
227+
torchvision-version: '0.29.2'
217228
timeout-minutes: 120
218229
needs: test_skip
219230
env:
220231
QUICKTEST: True
232+
PYTORCH_VERSION: ${{ matrix.pytorch-version }}
233+
TORCHVISION_VERSION: ${{ matrix.torchvision-version }}
221234
steps:
222235
- name: Clean unused tools
223236
if: runner.os == 'Linux' && needs.test_skip.outputs.skip == 0
@@ -236,11 +249,11 @@ jobs:
236249
disk-root: "D:"
237250
- uses: actions/checkout@v7
238251
if: needs.test_skip.outputs.skip == 0
239-
- name: Set up Python ${{ env.PYTHON_VER1 }}
252+
- name: Set up Python ${{ matrix.python-version || env.PYTHON_VER1 }}
240253
if: needs.test_skip.outputs.skip == 0
241254
uses: actions/setup-python@v6
242255
with:
243-
python-version: ${{ env.PYTHON_VER1 }}
256+
python-version: ${{ matrix.python-version || env.PYTHON_VER1 }}
244257
cache: 'pip'
245258
- name: Prepare pip wheel
246259
if: needs.test_skip.outputs.skip == 0
@@ -250,8 +263,7 @@ jobs:
250263
- if: needs.test_skip.outputs.skip == 0
251264
name: Install PyTorch
252265
run: |
253-
# install the lowest version of PyTorch supported
254-
python -m pip install torch==${PYTORCH_VER1} torchvision==${TORCHVISION_VER1}
266+
python -m pip install "torch==${PYTORCH_VERSION:-$PYTORCH_VER1}" "torchvision==${TORCHVISION_VERSION:-$TORCHVISION_VER1}"
255267
shell: bash
256268
- if: runner.os == 'Linux' && needs.test_skip.outputs.skip == 0
257269
name: Install itk pre-release (Linux only)
@@ -275,6 +287,22 @@ jobs:
275287
nvidia-smi || true
276288
python monai/config/check_env.py --env --monai
277289
shell: bash
290+
- name: Verify resolved PyTorch versions
291+
if: matrix.pytorch-version && needs.test_skip.outputs.skip == 0
292+
shell: bash
293+
run: |
294+
INSTALLED_PACKAGES=$(python -m pip list --format=columns)
295+
ACTUAL_PYTORCH_VER=$(awk '$1 == "torch" {print $2}' <<< "$INSTALLED_PACKAGES")
296+
ACTUAL_TORCHVISION_VER=$(awk '$1 == "torchvision" {print $2}' <<< "$INSTALLED_PACKAGES")
297+
298+
# CPU wheels can include a local version suffix such as +cpu.
299+
if [[ "${ACTUAL_PYTORCH_VER%%+*}" != "$PYTORCH_VERSION" ||
300+
"${ACTUAL_TORCHVISION_VER%%+*}" != "$TORCHVISION_VERSION" ]]; then
301+
echo "Mismatched PyTorch/Torchvision versions:"
302+
echo " PyTorch version actual=$ACTUAL_PYTORCH_VER, expected=$PYTORCH_VERSION"
303+
echo " Torchvision version actual=$ACTUAL_TORCHVISION_VER, expected=$TORCHVISION_VERSION"
304+
exit 1
305+
fi
278306
- if: runner.os != 'macOS' && needs.test_skip.outputs.skip == 0
279307
name: Run full tests
280308
run: |

0 commit comments

Comments
 (0)