6
6
pull_request :
7
7
branches : [ "main" ]
8
8
9
+ permissions :
10
+ contents : read
11
+
9
12
jobs :
10
- build -and-test :
13
+ validate -and-test :
11
14
runs-on : ${{ matrix.os }}
12
15
strategy :
13
16
fail-fast : false
@@ -19,33 +22,34 @@ jobs:
19
22
- name : Check out repository
20
23
uses : actions/checkout@v4
21
24
25
+ - name : Install uv
26
+ uses : astral-sh/setup-uv-action@v1
27
+
22
28
- name : Set up Python ${{ matrix.python-version }}
23
29
uses : actions/setup-python@v5
24
30
with :
25
31
python-version : ${{ matrix.python-version }}
26
32
27
- - name : Install uv and dependencies
33
+ - name : Cache uv dependencies
34
+ uses : actions/cache@v4
35
+ with :
36
+ path : ~/.cache/uv
37
+ key : ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
38
+ restore-keys : |
39
+ ${{ runner.os }}-uv-${{ matrix.python-version }}-
40
+
41
+ - name : Install dependencies
42
+ run : uv pip install -e ".[dev]"
43
+
44
+ - name : Run linting and tests
28
45
run : |
29
- pip install uv
30
- uv venv
31
- uv pip install -e ".[dev]"
32
-
33
- - name : Run linting and formatting check
34
- run : .venv/bin/python -m ruff check src/ tests/ && .venv/bin/python -m ruff format --check src/ tests/
35
- if : runner.os != 'Windows'
36
- - name : Run linting and formatting check (Windows)
37
- run : .\.venv\Scripts\python.exe -m ruff check src/ tests/ ; .\.venv\Scripts\python.exe -m ruff format --check src/ tests/
38
- if : runner.os == 'Windows'
39
-
40
- - name : Run tests and generate coverage report
41
- run : .venv/bin/python -m coverage run -m unittest discover tests
42
- if : runner.os != 'Windows'
43
- - name : Run tests and generate coverage report (Windows)
44
- run : .\.venv\Scripts\python.exe -m coverage run -m unittest discover tests
45
- if : runner.os == 'Windows'
46
+ make lint
47
+ make coverage
48
+ shell : bash
46
49
47
50
- name : Upload coverage reports to Codecov
48
- uses : codecov/codecov-action@v4
51
+ uses : codecov/codecov-action@v5
49
52
with :
50
53
token : ${{ secrets.CODECOV_TOKEN }}
51
- fail_ci_if_error : true
54
+ env :
55
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments