Skip to content

Commit 8b9eaef

Browse files
committed
chore: enable ci
1 parent f835a5e commit 8b9eaef

File tree

3 files changed

+183
-2
lines changed

3 files changed

+183
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "**"
9+
pull_request: {}
10+
11+
env:
12+
CI: true
13+
COLUMNS: 120
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
lint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: astral-sh/setup-uv@v3
25+
with:
26+
enable-cache: true
27+
28+
- name: Install dependencies
29+
run: uv sync --python 3.11 --frozen --all-extras --all-packages
30+
31+
- uses: pre-commit/action@v3.0.0
32+
with:
33+
extra_args: --all-files --verbose
34+
env:
35+
SKIP: no-commit-to-branch
36+
37+
test:
38+
name: test on ${{ matrix.python-version }}
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
python-version: ["3.11", "3.12", "3.13"]
45+
env:
46+
UV_PYTHON: ${{ matrix.python-version }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- uses: astral-sh/setup-uv@v3
51+
with:
52+
enable-cache: true
53+
54+
- run: mkdir coverage
55+
56+
- run: uv run --frozen coverage run -m pytest
57+
env:
58+
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-standard
59+
60+
- name: store coverage files
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: coverage-${{ matrix.python-version }}
64+
path: coverage
65+
include-hidden-files: true
66+
67+
coverage:
68+
runs-on: ubuntu-latest
69+
needs: [test]
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: get coverage files
74+
uses: actions/download-artifact@v4
75+
with:
76+
merge-multiple: true
77+
path: coverage
78+
79+
- uses: astral-sh/setup-uv@v3
80+
with:
81+
enable-cache: true
82+
83+
- run: uv sync --frozen
84+
- run: uv run --frozen coverage combine coverage
85+
86+
- run: uv run --frozen coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
87+
88+
- name: Store coverage html
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: coverage-html
92+
path: htmlcov
93+
include-hidden-files: true
94+
95+
- run: uv run --frozen coverage report --fail-under 70
96+
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
97+
check:
98+
if: always()
99+
needs: [lint, test, coverage]
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- name: Decide whether the needed jobs succeeded or failed
104+
uses: re-actors/alls-green@release/v1
105+
with:
106+
jobs: ${{ toJSON(needs) }}
107+
allowed-skips: test-live

pyproject.toml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,31 @@ mcp-proxy = "mcp_proxy.__main__:main"
1616
"*" = ["py.typed"]
1717

1818
[tool.uv]
19-
dev-dependencies = ["pytest>=8.3.3", "pytest-asyncio>=0.25.0"]
19+
dev-dependencies = [
20+
"pytest>=8.3.3",
21+
"pytest-asyncio>=0.25.0",
22+
"coverage>=7.6.0",
23+
]
24+
25+
[tool.coverage.run]
26+
branch = true
27+
28+
[tool.coverage.report]
29+
skip_covered = true
30+
show_missing = true
31+
precision = 2
32+
exclude_lines = [
33+
'pragma: no cover',
34+
'raise NotImplementedError',
35+
'if TYPE_CHECKING:',
36+
'if typing.TYPE_CHECKING:',
37+
'@overload',
38+
'@typing.overload',
39+
'\(Protocol\):$',
40+
'typing.assert_never',
41+
'$\s*assert_never\(',
42+
'if __name__ == .__main__.:',
43+
]
2044

2145
[tool.ruff.lint]
2246
select = ["ALL"]

uv.lock

Lines changed: 51 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)