|
1 | 1 | name: pytest |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | | - branches: [ main ] |
| 5 | + branches: [main] |
5 | 6 | pull_request: |
6 | | - branches: [ main ] |
7 | | - |
| 7 | + branches: [main] |
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | pytest: |
11 | 11 | runs-on: ${{ matrix.os }} |
12 | 12 | strategy: |
13 | 13 | matrix: |
14 | | - os: [ ubuntu-latest, macos-latest ] |
| 14 | + os: [ubuntu-latest, macos-latest] |
15 | 15 | python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
16 | 16 | include: |
17 | 17 | - os: ubuntu-latest |
18 | | - path: ~/.cache/pip |
| 18 | + uv-cache: ~/.cache/uv |
19 | 19 | - os: macos-latest |
20 | | - path: ~/Library/Caches/pip |
| 20 | + uv-cache: ~/Library/Caches/uv |
21 | 21 | env: |
22 | 22 | OS: ${{ matrix.os }} |
23 | 23 | PYTHON: ${{ matrix.python-version }} |
24 | 24 |
|
25 | | - |
26 | 25 | 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 |
30 | 27 |
|
31 | 28 | - name: Set up Python ${{ matrix.python-version }} |
32 | | - uses: actions/setup-python@v2 |
| 29 | + uses: actions/setup-python@v4 |
33 | 30 | with: |
34 | 31 | python-version: ${{ matrix.python-version }} |
35 | 32 |
|
36 | | - - name: Cache pip |
37 | | - uses: actions/cache@v2 |
| 33 | + - name: Cache uv cache |
| 34 | + uses: actions/cache@v4 |
38 | 35 | 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') }} |
41 | 38 | restore-keys: | |
42 | | - ${{ runner.os }}-pip- |
| 39 | + ${{ runner.os }}-uv- |
43 | 40 | ${{ runner.os }}- |
44 | 41 |
|
45 | | - - name: Install |
| 42 | + - name: Install dependencies using uv |
46 | 43 | 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 |
54 | 50 |
|
55 | | - - name: Run Test with Coverage |
| 51 | + - name: Run Tests |
56 | 52 | run: | |
| 53 | + source .venv/bin/activate |
57 | 54 | coverage erase |
58 | 55 | coverage run -m pytest |
59 | 56 |
|
60 | 57 | - name: Generate Coverage Report |
61 | 58 | run: | |
| 59 | + source .venv/bin/activate |
62 | 60 | coverage report -m -i |
63 | 61 | coverage xml -i |
64 | 62 |
|
|
0 commit comments