Skip to content

Commit 49e091f

Browse files
authored
perf: speed up CI with uv (#1400)
* wip: replace pip with uv * add uv to CD and type checks
1 parent 7f47cc1 commit 49e091f

File tree

3 files changed

+20
-46
lines changed

3 files changed

+20
-46
lines changed

.github/workflows/cd.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,19 @@ jobs:
2525
fetch-depth: 0
2626
lfs: false
2727

28-
- name: Set up Python
29-
uses: actions/setup-python@v5
28+
- name: Install uv and set the python version
29+
uses: astral-sh/setup-uv@v5
3030
with:
3131
python-version: '3.9'
32+
enable-cache: true
3233

33-
- name: Cache dependency
34-
id: cache-dependencies
35-
uses: actions/cache@v4
36-
with:
37-
path: ~/.cache/pip
38-
key: ${{ runner.os }}-pip
39-
40-
- name: Install dependencies
34+
- name: Install dependencies with uv
4135
run: |
42-
python -m pip install --upgrade pip
43-
pip install -e .[dev]
36+
uv pip install -e .[dev]
4437
4538
- name: Run the fast and the slow CPU tests with coverage
4639
run: |
47-
pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml tests/
40+
uv run pytest -v -x -n auto -m "not gpu" --cov=sbi --cov-report=xml tests/
4841
4942
- name: Upload coverage to Codecov
5043
uses: codecov/codecov-action@v4-beta

.github/workflows/ci.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,20 @@ jobs:
2929
fetch-depth: 0
3030
lfs: false
3131

32-
- name: Set up Python
33-
uses: actions/setup-python@v5
32+
- name: Install uv and set the python version
33+
uses: astral-sh/setup-uv@v5
3434
with:
3535
python-version: ${{ matrix.python-version }}
36+
enable-cache: true
3637

37-
- name: Cache dependency
38-
id: cache-dependencies
39-
uses: actions/cache@v4
40-
with:
41-
path: ~/.cache/pip
42-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
43-
restore-keys: |
44-
${{ runner.os }}-pip-${{ matrix.python-version }}-
45-
${{ runner.os }}-pip-
46-
47-
- name: Install dependencies
38+
- name: Install dependencies with uv
4839
run: |
49-
python -m pip install --upgrade pip
50-
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
51-
pip install -e .[dev]
40+
uv pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
41+
uv pip install -e .[dev]
5242
5343
- name: Run the fast CPU tests with coverage
5444
run: |
55-
pytest -v -x -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml tests/
45+
uv run pytest -v -x -n auto -m "not slow and not gpu" --cov=sbi --cov-report=xml tests/
5646
5747
- name: Upload coverage to Codecov
5848
uses: codecov/codecov-action@v4

.github/workflows/lint.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,17 @@ jobs:
3737
fetch-depth: 0
3838
lfs: false
3939

40-
- name: Set up Python
41-
uses: actions/setup-python@v5
40+
- name: Install uv and set the python version
41+
uses: astral-sh/setup-uv@v5
4242
with:
4343
python-version: '3.9'
44+
enable-cache: true
4445

45-
- name: Cache dependency
46-
id: cache-dependencies
47-
uses: actions/cache@v4
48-
with:
49-
path: ~/.cache/pip
50-
key: ubuntu-latest-pip-3.9
51-
restore-keys: |
52-
ubuntu-latest-pip-
53-
54-
- name: Install dependencies
46+
- name: Install dependencies with uv
5547
run: |
56-
python -m pip install --upgrade pip
57-
pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
58-
pip install -e .[dev]
48+
uv pip install torch --extra-index-url https://download.pytorch.org/whl/cpu
49+
uv pip install -e .[dev]
5950
6051
- name: Check types with pyright
6152
run: |
62-
pyright sbi
53+
uv run pyright sbi

0 commit comments

Comments
 (0)