@@ -62,49 +62,57 @@ jobs:
62
62
env :
63
63
PACKAGE_NAME : ${{ matrix.config.pkg-name }}
64
64
FREEZE_REQUIREMENTS : ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
65
- PYPI_CACHE_DIR : " _pip-wheels"
66
65
TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
67
66
TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
68
67
# TODO: Remove this - Enable running MPS tests on this platform
69
68
DISABLE_MPS : ${{ matrix.os == 'macOS-14' && '1' || '0' }}
70
69
steps :
71
70
- uses : actions/checkout@v5
72
71
73
- - name : Set up Python ${{ matrix.config.python-version }}
74
- uses : actions /setup-python@v5
72
+ - name : Install uv and set Python version
73
+ uses : astral-sh /setup-uv@v6
75
74
with :
76
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
77
80
78
- - name : basic setup
79
- run : pip install -q -r .actions/requirements.txt
81
+ - name : Basic setup
82
+ run : uv pip install -q -r .actions/requirements.txt
83
+
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
80
97
81
98
- name : Set min. dependencies
82
99
if : ${{ matrix.config.requires == 'oldest' }}
83
100
run : |
84
101
cd requirements/fabric
85
- pip install -U "lightning-utilities[cli]"
102
+ uv pip install -U "lightning-utilities[cli]"
86
103
python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'strategies.txt', 'test.txt']"
87
- pip install "cython<3.0" wheel
88
- 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
89
106
90
107
- name : Adjust PyTorch versions in requirements files
91
108
if : ${{ matrix.config.requires != 'oldest' }}
92
109
run : |
93
- pip install -q -r requirements/ci.txt
110
+ uv pip install -q -r requirements/ci.txt
94
111
python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
95
112
for fpath in `ls requirements/**/*.txt`; do \
96
113
python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
97
114
done
98
115
99
- - name : pip wheels cache
100
- uses : actions/cache/restore@v4
101
- with :
102
- path : ${{ env.PYPI_CACHE_DIR }}
103
- key : pypi_wheels
104
- - run : |
105
- mkdir -p $PYPI_CACHE_DIR
106
- ls -lh $PYPI_CACHE_DIR
107
-
108
116
- name : Expand Env. variables
109
117
run : |
110
118
# Switch PyTorch URL between stable and test/future
@@ -113,25 +121,15 @@ jobs:
113
121
python -c "print('COVERAGE_SCOPE=' + str('lightning' if '${{matrix.config.pkg-name}}' == 'lightning' else 'lightning_fabric'))" >> $GITHUB_ENV
114
122
# if you install mono-package set dependency only for this subpackage
115
123
python -c "print('EXTRA_PREFIX=' + str('' if '${{matrix.config.pkg-name}}' != 'lightning' else 'fabric-'))" >> $GITHUB_ENV
116
- - name : Append Env. vars for MacOS
117
- if : ${{ runner.os == 'macOS' }}
118
- run : |
119
- # trying to avoid "gloo" issue with SIGABRT
120
- echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
121
- - name : Append Env. vars for Windows
122
- if : ${{ runner.os == 'windows' }}
123
- run : |
124
- # Avoid issue on Windows with PyTorch 2.4: "RuntimeError: use_libuv was requested but PyTorch was build without libuv support"
125
- echo "USE_LIBUV=0" >> $GITHUB_ENV
126
124
127
125
- name : Install package & dependencies
128
126
timeout-minutes : 20
129
127
run : |
130
- pip install -e ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
131
- -U -- upgrade-strategy=eager --prefer-binary \
132
- --extra-index-url ="${TORCH_URL}" \
133
- --find-links="${PYPI_CACHE_DIR}"
134
- pip list
128
+ uv pip install ".[${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
129
+ -- upgrade \
130
+ --find-links ="${TORCH_URL}"
131
+ uv pip list
132
+
135
133
- name : Dump handy wheels
136
134
if : github.event_name == 'push' && github.ref == 'refs/heads/master'
137
135
continue-on-error : true
@@ -179,6 +177,9 @@ jobs:
179
177
name : CPU-coverage
180
178
fail_ci_if_error : false
181
179
180
+ - name : Minimize uv cache
181
+ run : uv cache prune --ci
182
+
182
183
fabric-cpu-guardian :
183
184
runs-on : ubuntu-latest
184
185
needs : fabric-cpu
0 commit comments