@@ -42,42 +42,29 @@ jobs:
4242 strategy :
4343 fail-fast : false
4444 matrix :
45- include :
45+ os : [macOS-14, ubuntu-22.04, windows-2022]
46+ config :
4647 # only run PyTorch latest
47- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
48- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
49- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
50- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
51- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
52- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
53- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
54- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
55- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
56- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
57- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
58- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
59- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
60- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
61- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
48+ - { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
49+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
50+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
51+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
52+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
53+
6254 # only run PyTorch latest with Python latest, use PyTorch scope to limit dependency issues
63- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
64- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
65- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
66- # "oldest" versions tests, only on minimum Python
67- - { os: "macOS-14", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
68- - { os: "ubuntu-22.04", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
69- - { os: "windows-2022", pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
55+ - { pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
56+
7057 # "pytorch" installs the standalone package
71- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
72- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
73- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
58+ - { pkg-name: "pytorch", python-version: "3.10", pytorch-version: "2.7" }
59+
7460 # adding recently cut Torch 2.7 - FUTURE
75- - { os: "macOS-14", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
76- - { os: "ubuntu-22.04", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
77- - { os: "windows-2022", pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
61+ - { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
62+
63+ # "oldest" versions tests, only on minimum Python
64+ - { pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
7865 timeout-minutes : 50
7966 env :
80- PACKAGE_NAME : ${{ matrix.pkg-name }}
67+ PACKAGE_NAME : ${{ matrix.config. pkg-name }}
8168 TORCH_URL : " https://download.pytorch.org/whl/cpu/"
8269 TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
8370 TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
@@ -88,10 +75,10 @@ jobs:
8875 steps :
8976 - uses : actions/checkout@v5
9077
91- - name : Set up Python ${{ matrix.python-version }}
78+ - name : Set up Python ${{ matrix.config. python-version }}
9279 uses : actions/setup-python@v5
9380 with :
94- python-version : ${{ matrix.python-version || '3.9' }}
81+ python-version : ${{ matrix.config. python-version || '3.9' }}
9582
9683 - name : basic setup
9784 run : pip install -q -r .actions/requirements.txt
11198 pip install -q -r requirements/ci.txt
11299 python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
113100 for fpath in `ls requirements/**/*.txt`; do \
114- python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
101+ python ./adjust-torch-versions.py $fpath ${{ matrix.config. pytorch-version }}; \
115102 done
116103 cat requirements/pytorch/base.txt
117104
@@ -127,13 +114,13 @@ jobs:
127114 - name : Env. variables
128115 run : |
129116 # Switch PyTorch URL between stable and test/future
130- python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
117+ python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.config. pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
131118 # Switch coverage scope
132- python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
119+ python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config. pkg-name}}' == 'lightning' else 'pytorch_lightning'))" >> $GITHUB_ENV
133120 # if you install mono-package set dependency only for this subpackage
134- python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
121+ python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config. pkg-name}}' != 'lightning' else 'pytorch-'))" >> $GITHUB_ENV
135122 # Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
136- python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
123+ python -c "print('USE_LIBUV=0' if '${{matrix.os}}' == 'windows-2022' and '${{matrix.config. pytorch-version}}' == '2.4' else '')" >> $GITHUB_ENV
137124
138125 - name : Install package & dependencies
139126 timeout-minutes : 20
@@ -146,11 +133,11 @@ jobs:
146133 --find-links="https://download.pytorch.org/whl/torch-tensorrt"
147134 pip list
148135 - name : Drop LAI from extensions
149- if : ${{ matrix.pkg-name != 'lightning' }}
136+ if : ${{ matrix.config. pkg-name != 'lightning' }}
150137 # Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
151138 run : pip uninstall -y lightning
152139 - name : Drop PL for LAI
153- if : ${{ matrix.pkg-name == 'lightning' }}
140+ if : ${{ matrix.config. pkg-name == 'lightning' }}
154141 run : pip uninstall -y pytorch-lightning
155142 - name : Dump handy wheels
156143 if : github.event_name == 'push' && github.ref == 'refs/heads/master'
@@ -171,10 +158,10 @@ jobs:
171158 run : |
172159 set -e
173160 python requirements/pytorch/check-avail-extras.py
174- python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.pytorch-version }}'), ver"
161+ python -c "from torch import __version__ as ver; assert ver.startswith('${{ matrix.config. pytorch-version }}'), ver"
175162
176163 - name : Adjust tests / env. -> PL
177- if : ${{ matrix.pkg-name != 'lightning' }}
164+ if : ${{ matrix.config. pkg-name != 'lightning' }}
178165 run : |
179166 python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
180167 --source_import="lightning.fabric,lightning.pytorch" \
@@ -224,7 +211,7 @@ jobs:
224211 with :
225212 token : ${{ secrets.CODECOV_TOKEN }}
226213 file : tests/tests_pytorch/coverage.xml
227- flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.python-version }},pytorch${{ matrix.pytorch-version }}
214+ flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest-full,python${{ matrix.config. python-version }},pytorch${{ matrix.config .pytorch-version }}
228215 name : CPU-coverage
229216 fail_ci_if_error : false
230217
0 commit comments