Skip to content

Commit ebdf9cc

Browse files
committed
build(ci/cd): improve performance development workflow
1 parent bbd4bd5 commit ebdf9cc

File tree

1 file changed

+77
-8
lines changed

1 file changed

+77
-8
lines changed

.github/workflows/develop.yml

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Development Workflow
22

33
on:
44
pull_request:
5-
branches: [ development ]
5+
branches: [ development ]
66
push:
77
branches: [ development ]
88

@@ -12,8 +12,8 @@ permissions:
1212
pull-requests: write
1313

1414
jobs:
15-
development:
16-
name: Test & Lint
15+
lint:
16+
name: Lint / Format / Type-check
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -23,24 +23,94 @@ jobs:
2323
- name: Set up UV
2424
uses: astral-sh/setup-uv@v6
2525
with:
26-
python-version: ${{ matrix.python-version }}
26+
python-version: '3.13'
2727

2828
- name: Cache UV
2929
uses: actions/cache@v4
3030
with:
3131
path: ~/.cache/uv
32-
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
32+
key: ${{ runner.os }}-uv-3.13-${{ hashFiles('uv.lock') }}
3333
restore-keys: |
34-
${{ runner.os }}-uv-${{ matrix.python-version }}-
34+
${{ runner.os }}-uv-3.13-
3535
3636
- name: Sync dev dependencies
3737
run: uv sync --locked --all-extras --dev --no-progress -q
3838

3939
- name: Lint / Format / Type-check
4040
run: uv run lint
4141

42+
tests:
43+
name: Run tests (matrix)
44+
runs-on: ubuntu-latest
45+
needs: lint
46+
strategy:
47+
matrix:
48+
python-version: [ '3.9', '3.10', '3.11', '3.12' ]
49+
fail-fast: false
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Set up UV
56+
uses: astral-sh/setup-uv@v6
57+
with:
58+
python-version: ${{ matrix.python-version }}
59+
60+
- name: Cache UV
61+
uses: actions/cache@v4
62+
with:
63+
path: ~/.cache/uv
64+
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
65+
restore-keys: |
66+
${{ runner.os }}-uv-${{ matrix.python-version }}-
67+
68+
- name: Sync dev dependencies
69+
run: uv sync --locked --all-extras --dev --no-progress -q
70+
4271
- name: Run tests
43-
run: uv run pytest
72+
run: uv run pytest --cov --cov-report=xml
73+
74+
- name: Upload coverage artifact
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: coverage-${{ matrix.python-version }}
78+
path: coverage.xml
79+
80+
codecov:
81+
name: Upload merged coverage to Codecov
82+
runs-on: ubuntu-latest
83+
needs: tests
84+
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v4
88+
89+
- name: Set up UV
90+
uses: astral-sh/setup-uv@v6
91+
with:
92+
python-version: '3.13'
93+
94+
- name: Cache UV
95+
uses: actions/cache@v4
96+
with:
97+
path: ~/.cache/uv
98+
key: ${{ runner.os }}-uv-3.13-${{ hashFiles('uv.lock') }}
99+
restore-keys: |
100+
${{ runner.os }}-uv-3.13-
101+
102+
- name: Sync dev dependencies
103+
run: uv sync --locked --all-extras --dev --no-progress -q
104+
105+
- name: Download all coverage artifacts
106+
uses: actions/download-artifact@v4
107+
with:
108+
path: coverages
109+
110+
- name: Merge coverage files
111+
run: |
112+
uv run coverage combine coverages/**/.coverage
113+
uv run coverage xml -o coverage.xml
44114
45115
- name: Upload coverage to Codecov
46116
uses: codecov/codecov-action@v4
@@ -50,4 +120,3 @@ jobs:
50120
fail_ci_if_error: true
51121
env:
52122
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53-

0 commit comments

Comments
 (0)