Skip to content

Commit 418bfd8

Browse files
committed
Add GitHub Actions
1 parent 4aed21f commit 418bfd8

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
# Automatically cancel previous runs of this workflow on the same branch
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
linux:
12+
# Skip building pull requests from the same repository
13+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: read
18+
env:
19+
PYTHONUNBUFFERED: 1
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v5
23+
24+
- name: Update pyproject.toml version
25+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
26+
shell: bash
27+
run: |
28+
# Extract version from tag (strip 'v' prefix if present)
29+
VERSION=${GITHUB_REF#refs/tags/}
30+
VERSION=${VERSION#v}
31+
echo "Extracted version: $VERSION"
32+
33+
# Update version in pyproject.toml (works on both GNU and BSD sed)
34+
sed -i.bak "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
35+
rm pyproject.toml.bak
36+
37+
- name: Install uv
38+
uses: astral-sh/setup-uv@v6
39+
with:
40+
version: "0.9.3"
41+
42+
- name: Create venv
43+
run: uv sync
44+
45+
- name: Type check
46+
run: uvx ty check
47+
48+
- name: Test JSON-RPC
49+
run: uv run coverage run --data-file=.coverage.jsonrpc tests/jsonrpc_test.py
50+
51+
- name: Test MCP
52+
run: uv run coverage run --data-file=.coverage.mcp tests/mcp_test.py
53+
54+
- name: Generate coverage report
55+
run: |
56+
uv run coverage combine
57+
uv run coverage report
58+
59+
- name: Publish
60+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
61+
run: uv build && uv publish

tests/mcp_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ async def test_serve():
216216
bufsize=1,
217217
)
218218
try:
219+
await asyncio.sleep(0.5) # Wait for server to start
219220
await test_sse(address)
220221
await test_streamablehttp(address)
221222
finally:
@@ -225,8 +226,8 @@ async def test_serve():
225226
pass
226227

227228
async def main():
228-
await test_stdio()
229229
await test_serve()
230+
await test_stdio()
230231

231232
if __name__ == "__main__":
232233
import os

0 commit comments

Comments
 (0)