Skip to content

Commit f3b820c

Browse files
committed
Use astral uv on CI testing
1 parent d8f27b4 commit f3b820c

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

.github/workflows/unit-tests.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,44 +57,33 @@ jobs:
5757

5858
steps:
5959
- uses: actions/checkout@v4
60-
- uses: actions/setup-python@v4
60+
- uses: astral-sh/setup-uv@v6
6161
with:
6262
python-version: ${{ matrix.python-version }}
63+
activate-environment: true
64+
enable-cache: true
6365

6466
- name: Get year & week number
6567
id: get-date
6668
run: |
6769
echo "date=$(/bin/date "+%Y-%U")" >> $GITHUB_OUTPUT
6870
69-
- name: Get pip cache dir
70-
id: pip-cache
71-
run: |
72-
pip install -U pip || python -m pip install -U pip
73-
echo "pip_cache=$(pip cache dir)" >> $GITHUB_OUTPUT
74-
75-
- uses: actions/cache@v3
76-
with:
77-
path: |
78-
${{ steps.pip-cache.outputs.pip_cache }}
79-
key: ${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-channel }}-${{ hashFiles('requirements-dev.txt') }}
80-
restore-keys: |
81-
${{ steps.get-date.outputs.date }}-pytorch-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.pytorch-channel }}-
82-
83-
- run: pip install pip wheel setuptools -Uqq
71+
- name: Install dev tools
72+
run: uv pip install wheel setuptools -Uqq
8473

8574
- name: Install PyTorch
8675
if: ${{ matrix.pytorch-channel == 'pytorch' }}
87-
run: pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
76+
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
8877

8978
- name: Install PyTorch (nightly)
9079
if: ${{ matrix.pytorch-channel == 'pytorch-nightly' }}
91-
run: pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --pre
80+
run: uv pip install torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu --pre
9281

9382
- name: Install dependencies
9483
run: |
95-
pip install -r requirements-dev.txt
96-
pip install .
97-
pip list
84+
uv pip install -r requirements-dev.txt
85+
uv pip install .
86+
uv pip list
9887
9988
- name: Check code formatting
10089
run: |
@@ -154,7 +143,7 @@ jobs:
154143
# 3.1) mnist_with_tensorboard.py with tbX
155144
python examples/mnist/mnist_with_tensorboard.py --epochs=1
156145
# 3.2) mnist_with_tensorboard.py with native torch tb
157-
pip uninstall -y tensorboardX
146+
uv pip uninstall tensorboardX
158147
python examples/mnist/mnist_with_tensorboard.py --epochs=1
159148
160149
- name: Run MNIST Example With Crash

0 commit comments

Comments
 (0)