Skip to content

Commit e2073e3

Browse files
authored
use uv to download requirements and cache
1 parent 5380258 commit e2073e3

1 file changed

Lines changed: 23 additions & 25 deletions

File tree

.github/workflows/main.yml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,62 @@
11
name: pytest
2+
23
on:
34
push:
4-
branches: [ main ]
5+
branches: [main]
56
pull_request:
6-
branches: [ main ]
7-
7+
branches: [main]
88

99
jobs:
1010
pytest:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [ ubuntu-latest, macos-latest ]
14+
os: [ubuntu-latest, macos-latest]
1515
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1616
include:
1717
- os: ubuntu-latest
18-
path: ~/.cache/pip
18+
uv-cache: ~/.cache/uv
1919
- os: macos-latest
20-
path: ~/Library/Caches/pip
20+
uv-cache: ~/Library/Caches/uv
2121
env:
2222
OS: ${{ matrix.os }}
2323
PYTHON: ${{ matrix.python-version }}
2424

25-
2625
steps:
27-
- uses: actions/checkout@v2
28-
with:
29-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
26+
- uses: actions/checkout@v4
3027

3128
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v2
29+
uses: actions/setup-python@v4
3330
with:
3431
python-version: ${{ matrix.python-version }}
3532

36-
- name: Cache pip
37-
uses: actions/cache@v2
33+
- name: Cache uv cache
34+
uses: actions/cache@v4
3835
with:
39-
path: ${{ matrix.path }}
40-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
36+
path: ${{ matrix.uv-cache }}
37+
key: ${{ runner.os }}-uv-${{ hashFiles('**/requirements.txt') }}
4138
restore-keys: |
42-
${{ runner.os }}-pip-
39+
${{ runner.os }}-uv-
4340
${{ runner.os }}-
4441
45-
- name: Install
42+
- name: Install dependencies using uv
4643
run: |
47-
python --version
48-
pip --version
49-
python -m pip install --upgrade pip
50-
pip install coverage pytest pytest-cov
51-
pip install ".[dev]"
52-
pip list
53-
shell: bash
44+
pip install uv
45+
uv venv
46+
source .venv/bin/activate
47+
uv pip install coverage pytest pytest-cov
48+
uv pip install ".[dev]"
49+
uv pip list
5450
55-
- name: Run Test with Coverage
51+
- name: Run Tests
5652
run: |
53+
source .venv/bin/activate
5754
coverage erase
5855
coverage run -m pytest
5956
6057
- name: Generate Coverage Report
6158
run: |
59+
source .venv/bin/activate
6260
coverage report -m -i
6361
coverage xml -i
6462

0 commit comments

Comments
 (0)