@@ -69,48 +69,49 @@ jobs:
6969 TORCH_URL_STABLE : " https://download.pytorch.org/whl/cpu/"
7070 TORCH_URL_TEST : " https://download.pytorch.org/whl/test/cpu/"
7171 FREEZE_REQUIREMENTS : ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
72- PYPI_CACHE_DIR : " _pip-wheels"
7372 # TODO: Remove this - Enable running MPS tests on this platform
7473 DISABLE_MPS : ${{ matrix.os == 'macOS-14' && '1' || '0' }}
7574 steps :
7675 - uses : actions/checkout@v5
7776
78- - name : Set up Python ${{ matrix.config.python-version }}
79- uses : actions /setup-python@v5
77+ - name : Install uv and set Python version
78+ uses : astral-sh /setup-uv@v6
8079 with :
8180 python-version : ${{ matrix.config.python-version || '3.9' }}
81+ # TODO: Avoid activating environment like this
82+ # see: https://github.com/astral-sh/setup-uv/tree/v6/?tab=readme-ov-file#activate-environment
83+ activate-environment : true
84+ enable-cache : true
8285
83- - name : basic setup
84- run : pip install -q -r .actions/requirements.txt
86+ - name : Basic setup
87+ run : uv pip install -q -r .actions/requirements.txt
88+
89+ - name : Append Env. vars for Linux
90+ if : ${{ runner.os == 'Linux' }}
91+ run : echo "GLOO_SOCKET_IFNAME=eth0" >> $GITHUB_ENV
92+ - name : Append Env. vars for MacOS
93+ if : ${{ runner.os == 'macOS' }}
94+ run : echo "GLOO_SOCKET_IFNAME=lo0" >> $GITHUB_ENV
8595
8696 - name : Set min. dependencies
87- if : ${{ matrix.requires == 'oldest' }}
97+ if : ${{ matrix.config. requires == 'oldest' }}
8898 run : |
8999 cd requirements/pytorch
90- pip install -U "lightning-utilities[cli]"
100+ uv pip install -U "lightning-utilities[cli]"
91101 python -m lightning_utilities.cli requirements set-oldest --req_files "['base.txt', 'extra.txt', 'strategies.txt', 'examples.txt', 'test.txt']"
92- pip install "cython<3.0" wheel
93- pip install "pyyaml==5.4" --no-build-isolation
102+ uv pip install "cython<3.0" wheel
103+ uv pip install "pyyaml==5.4" --no-build-isolation
94104
95105 - name : Adjust PyTorch versions in requirements files
96- if : ${{ matrix.requires != 'oldest' }}
106+ if : ${{ matrix.config. requires != 'oldest' }}
97107 run : |
98- pip install -q -r requirements/ci.txt
108+ uv pip install -q -r requirements/ci.txt
99109 python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
100110 for fpath in `ls requirements/**/*.txt`; do \
101111 python ./adjust-torch-versions.py $fpath ${{ matrix.config.pytorch-version }}; \
102112 done
103113 cat requirements/pytorch/base.txt
104114
105- - name : pip wheels cache
106- uses : actions/cache/restore@v4
107- with :
108- path : ${{ env.PYPI_CACHE_DIR }}
109- key : pypi_wheels
110- - run : |
111- mkdir -p $PYPI_CACHE_DIR
112- ls -lh $PYPI_CACHE_DIR
113-
114115 - name : Env. variables
115116 run : |
116117 # Switch PyTorch URL between stable and test/future
@@ -125,20 +126,22 @@ jobs:
125126 - name : Install package & dependencies
126127 timeout-minutes : 20
127128 run : |
128- pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
129- -U -- upgrade-strategy=eager --prefer-binary \
129+ uv pip install ".[${EXTRA_PREFIX}extra,${EXTRA_PREFIX}test,${EXTRA_PREFIX}strategies]" \
130+ -- upgrade \
130131 -r requirements/_integrations/accelerators.txt \
131- --extra-index-url="${TORCH_URL}" \
132- --find-links="${PYPI_CACHE_DIR}" \
132+ --find-links="${TORCH_URL}" \
133133 --find-links="https://download.pytorch.org/whl/torch-tensorrt"
134- pip list
134+ uv pip list
135+
135136 - name : Drop LAI from extensions
136137 if : ${{ matrix.config.pkg-name != 'lightning' }}
137138 # Lightning is dependency of Habana or other accelerators/integrations so in case we test PL we need to remove it
138- run : pip uninstall -y lightning
139+ run : uv pip uninstall lightning
140+
139141 - name : Drop PL for LAI
140142 if : ${{ matrix.config.pkg-name == 'lightning' }}
141- run : pip uninstall -y pytorch-lightning
143+ run : uv pip uninstall pytorch-lightning
144+
142145 - name : Dump handy wheels
143146 if : github.event_name == 'push' && github.ref == 'refs/heads/master'
144147 continue-on-error : true
@@ -215,6 +218,9 @@ jobs:
215218 name : CPU-coverage
216219 fail_ci_if_error : false
217220
221+ - name : Minimize uv cache
222+ run : uv cache prune --ci
223+
218224 pl-cpu-guardian :
219225 runs-on : ubuntu-latest
220226 needs : pl-cpu
0 commit comments