@@ -38,113 +38,98 @@ jobs:
38
38
strategy :
39
39
fail-fast : false
40
40
matrix :
41
- include :
41
+ os : [macOS-14, ubuntu-22.04, windows-2022]
42
+ config :
42
43
# only run PyTorch latest
43
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
44
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
45
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
46
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
47
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
48
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
49
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
50
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
51
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
52
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
53
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
54
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
55
- - { os: "macOS-14", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
56
- - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
57
- - { os: "windows-2022", pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
44
+ - { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
45
+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
46
+ - { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
47
+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
48
+ - { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }
49
+
58
50
# only run PyTorch latest with Python latest, use Fabric scope to limit dependency issues
59
- - { os: "macOS-14", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" }
60
- - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" }
61
- - { os: "windows-2022", pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" }
62
- # "oldest" versions tests, only on minimum Python
63
- - { os: "macOS-14", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" }
64
- - { os: "ubuntu-22.04", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" }
65
- - { os: "windows-2022", pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" }
51
+ - { pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" }
52
+
66
53
# "fabric" installs the standalone package
67
- - { os: "macOS-14", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" }
68
- - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" }
69
- - { os: "windows-2022", pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" }
54
+ - { pkg-name: "fabric", python-version: "3.10", pytorch-version: "2.7" }
55
+
70
56
# adding recently cut Torch 2.7 - FUTURE
71
- - { os: "macOS-14", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" }
72
- - { os: "ubuntu-22.04", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" }
73
- - { os: "windows-2022", pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" }
57
+ - { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" }
58
+
59
+ # "oldest" versions tests, only on minimum Python
60
+ - { pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" }
74
61
timeout-minutes : 25 # because of building grpcio on Mac
75
62
env :
76
- PACKAGE_NAME : ${{ matrix.pkg-name }}
63
+ PACKAGE_NAME : ${{ matrix.config. pkg-name }}
77
64
FREEZE_REQUIREMENTS : ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
78
- PYPI_CACHE_DIR : " _pip-wheels"
79
65
TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
80
66
TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
81
67
# TODO: Remove this - Enable running MPS tests on this platform
82
68
DISABLE_MPS : ${{ matrix.os == 'macOS-14' && '1' || '0' }}
83
69
steps :
84
70
- uses : actions/checkout@v5
85
71
86
- - name : Set up Python ${{ matrix.python-version }}
87
- uses : actions /setup-python@v5
72
+ - name : Install uv and set Python version
73
+ uses : astral-sh /setup-uv@v6
88
74
with :
89
- python-version : ${{ matrix.python-version || '3.9' }}
75
+ python-version : ${{ matrix.config.python-version || '3.9' }}
76
+ # TODO: Avoid activating environment like this
77
+ # see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
78
+ activate-environment : true
79
+ enable-cache : true
80
+
81
+ - name : Basic setup
82
+ run : uv pip install -q -r .actions/requirements.txt
90
83
91
- - name : basic setup
92
- run : pip install -q -r .actions/requirements.txt
84
+ - name : Append Env. vars for Linux
85
+ if : ${{ runner.os == 'Linux' }}
86
+ run : echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV
87
+
88
+ - name : Append Env. vars for MacOS
89
+ if : ${{ runner.os == 'macOS' }}
90
+ run : echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
91
+
92
+ - name : Append Env. vars for Windows
93
+ if : ${{ runner.os == 'windows' }}
94
+ run : |
95
+ # Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
96
+ echo "USE_LIBUV=0" >> $GITHUB_ENV
93
97
94
98
- name : Set min. dependencies
95
- if : ${{ matrix.requires == 'oldest' }}
99
+ if : ${{ matrix.config. requires == 'oldest' }}
96
100
run : |
97
101
cd requirements/fabric
98
- pip install -U "lightning-utilities[cli]"
102
+ uv pip install -U "lightning-utilities[cli]"
99
103
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']"
100
- pip install "cython<3.0" wheel
101
- pip install "pyyaml==5.4" --no-build-isolation
104
+ uv pip install "cython<3.0" wheel
105
+ uv pip install "pyyaml==5.4" --no-build-isolation
102
106
103
107
- name : Adjust PyTorch versions in requirements files
104
- if : ${{ matrix.requires != 'oldest' }}
108
+ if : ${{ matrix.config. requires != 'oldest' }}
105
109
run : |
106
- pip install -q -r requirements/ci.txt
110
+ uv pip install -q -r requirements/ci.txt
107
111
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
108
112
for fpath in `ls requirements/**/*.txt`; do \
109
- python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
113
+ python ./adjust-torch-versions.py $fpath ${{ matrix.config. pytorch-version }}; \
110
114
done
111
115
112
- - name : pip wheels cache
113
- uses : actions/cache/restore@v4
114
- with :
115
- path : ${{ env.PYPI_CACHE_DIR }}
116
- key : pypi_wheels
117
- - run : |
118
- mkdir -p $PYPI_CACHE_DIR
119
- ls -lh $PYPI_CACHE_DIR
120
-
121
116
- name : Expand Env. variables
122
117
run : |
123
118
# Switch PyTorch URL between stable and test/future
124
- python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
119
+ python -c "print('TORCH_URL=' + str('${{env.TORCH_URL_TEST}}' if '${{ matrix.config. pytorch-version }}' == '2.7' else '${{env.TORCH_URL_STABLE}}'))" >> $GITHUB_ENV
125
120
# Switch coverage scope
126
- python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.pkg-name}}' == 'lightning' else 'lightning_fabric'))" >> $GITHUB_ENV
121
+ python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config. pkg-name}}' == 'lightning' else 'lightning_fabric'))" >> $GITHUB_ENV
127
122
# if you install mono-package set dependency only for this subpackage
128
- python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV
129
- - name : Append Env. vars for MacOS
130
- if : ${{ runner.os == 'macOS' }}
131
- run : |
132
- # trying to avoid "gloo" issue with SIGABRT
133
- echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
134
- - name : Append Env. vars for Windows
135
- if : ${{ runner.os == 'windows' }}
136
- run : |
137
- # Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
138
- echo "USE_LIBUV=0" >> $GITHUB_ENV
123
+ python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV
139
124
140
125
- name : Install package & dependencies
141
126
timeout-minutes : 20
142
127
run : |
143
- pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
144
- -U -- upgrade-strategy=eager --prefer-binary \
145
- --extra-index-url ="${TORCH_URL}" \
146
- --find-links="${PYPI_CACHE_DIR}"
147
- pip list
128
+ uv pip install ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
129
+ -- upgrade \
130
+ --find-links ="${TORCH_URL}"
131
+ uv pip list
132
+
148
133
- name : Dump handy wheels
149
134
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
150
135
continue-on-error : true
@@ -155,7 +140,7 @@ jobs:
155
140
cache-key : " pypi_wheels"
156
141
157
142
- name : Adjust tests
158
- if : ${{ matrix.pkg-name != 'lightning' }}
143
+ if : ${{ matrix.config. pkg-name != 'lightning' }}
159
144
run : |
160
145
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
161
146
--source_import="lightning.fabric" --target_import="lightning_fabric"
@@ -188,10 +173,13 @@ jobs:
188
173
with :
189
174
token : ${{ secrets.CODECOV_TOKEN }}
190
175
file : tests/tests_fabric/coverage.xml
191
- flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest,python${{ matrix.python-version }}
176
+ flags : ${{ env.COVERAGE_SCOPE }},cpu,pytest,python${{ matrix.config. python-version }}
192
177
name : CPU-coverage
193
178
fail_ci_if_error : false
194
179
180
+ - name : Minimize uv cache
181
+ run : uv cache prune --ci
182
+
195
183
fabric-cpu-guardian :
196
184
runs-on : ubuntu-latest
197
185
needs : fabric-cpu
0 commit comments