Skip to content

Commit 31e3127

Browse files
committed
Use uv instead of pip during tests
While also using uv cache if the dependencies are the same in requirements and requirements-dev
1 parent fa88160 commit 31e3127

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

.github/workflows/lintandformat.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,22 @@ jobs:
1919
uses: actions/setup-python@v5
2020
with:
2121
python-version: "3.11"
22-
cache: "pip"
22+
23+
- name: Cache uv folder
24+
id: cache-uv
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.cache/uv
28+
# Replace 3.11 with ${{ matrix.python-version }} when ready
29+
key: ${{ runner.os }}-python-3.11-uv-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
30+
31+
- name: Install uv
32+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
2333

2434
- name: Install dependencies
2535
run: |
26-
python -m pip install --upgrade pip
27-
pip install -r requirements-dev.txt
28-
pip install "fastapi[all]"
36+
uv pip install --system -r requirements-dev.txt
37+
uv pip install --system "fastapi[all]"
2938
3039
- name: Cache .ruff_cache folder
3140
id: ruff_cache

.github/workflows/test.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,22 @@ jobs:
4040
uses: actions/setup-python@v5
4141
with:
4242
python-version: "3.11"
43-
cache: "pip"
43+
44+
- name: Cache uv folder
45+
id: cache-uv
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/uv
49+
# Replace 3.11 with ${{ matrix.python-version }} when ready
50+
key: ${{ runner.os }}-python-3.11-uv-${{ hashFiles('**/requirements.txt', '**/requirements-dev.txt') }}
51+
52+
- name: Install uv
53+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
4454

4555
- name: Install dependencies
4656
run: |
47-
python -m pip install --upgrade pip
48-
pip install -r requirements-dev.txt
49-
pip install "fastapi[all]"
57+
uv pip install --system -r requirements-dev.txt
58+
uv pip install --system "fastapi[all]"
5059
5160
- name: Cache .pytest_cache folder
5261
id: pytest_cache

0 commit comments

Comments
 (0)