Skip to content

Commit 63a6e0f

Browse files
committed
fix ci
1 parent 5cd07e0 commit 63a6e0f

File tree

2 files changed

+100
-5
lines changed

2 files changed

+100
-5
lines changed

.github/workflows/ci.yml

Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
test:
10+
test-unit:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
@@ -23,10 +23,103 @@ jobs:
2323
run: uv sync --all-extras
2424
- name: Install Playwright browsers
2525
run: |
26-
echo 'PW_CHROMIUM_ARGS=--no-sandbox' >> $GITHUB_ENV
26+
echo 'PW_CHROMIUM_ARGS=--no-sandbox --disable-dev-shm-usage --disable-gpu --single-process' >> $GITHUB_ENV
2727
uv run playwright install --with-deps chromium
28-
- name: Run tests with coverage
29-
run: uv run python -m pytest --cov=browser_fastmcp_server.py --cov=main.py --cov-report=xml --cov-report=term --reruns 10 --reruns-delay 10 test_browser_fastmcp_client.py test_browser_test.py test_browser_workflow_test.py -v
28+
- name: Run unit tests with coverage
29+
run: |
30+
# Limit CPU usage and run tests slowly
31+
export PYTEST_ADDOPTS="--durations=10 --tb=short"
32+
uv run python -m pytest \
33+
--cov=browser_fastmcp_server.py \
34+
--cov=main.py \
35+
--cov-report=xml \
36+
--cov-report=term \
37+
--reruns 3 \
38+
--reruns-delay 20 \
39+
test_browser_fastmcp_client.py \
40+
-v \
41+
--maxfail=1 \
42+
--timeout=300
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@v4
45+
with:
46+
files: ./coverage.xml
47+
fail_ci_if_error: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
50+
test-integration:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- name: Set up Python 3.12
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: '3.12'
58+
- name: Install uv
59+
run: pip install uv
60+
- name: Set UV_HTTP_TIMEOUT
61+
run: echo "UV_HTTP_TIMEOUT=120" >> $GITHUB_ENV
62+
- name: Install project dependencies
63+
run: uv sync --all-extras
64+
- name: Install Playwright browsers
65+
run: |
66+
echo 'PW_CHROMIUM_ARGS=--no-sandbox --disable-dev-shm-usage --disable-gpu --single-process' >> $GITHUB_ENV
67+
uv run playwright install --with-deps chromium
68+
- name: Run integration tests with coverage
69+
run: |
70+
# Limit CPU usage and run tests slowly
71+
export PYTEST_ADDOPTS="--durations=10 --tb=short"
72+
uv run python -m pytest \
73+
--cov=browser_fastmcp_server.py \
74+
--cov=main.py \
75+
--cov-report=xml \
76+
--cov-report=term \
77+
--reruns 3 \
78+
--reruns-delay 20 \
79+
test_browser_test.py \
80+
-v \
81+
--maxfail=1 \
82+
--timeout=300
83+
- name: Upload coverage to Codecov
84+
uses: codecov/codecov-action@v4
85+
with:
86+
files: ./coverage.xml
87+
fail_ci_if_error: true
88+
token: ${{ secrets.CODECOV_TOKEN }}
89+
90+
test-workflow:
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v4
94+
- name: Set up Python 3.12
95+
uses: actions/setup-python@v5
96+
with:
97+
python-version: '3.12'
98+
- name: Install uv
99+
run: pip install uv
100+
- name: Set UV_HTTP_TIMEOUT
101+
run: echo "UV_HTTP_TIMEOUT=120" >> $GITHUB_ENV
102+
- name: Install project dependencies
103+
run: uv sync --all-extras
104+
- name: Install Playwright browsers
105+
run: |
106+
echo 'PW_CHROMIUM_ARGS=--no-sandbox --disable-dev-shm-usage --disable-gpu --single-process' >> $GITHUB_ENV
107+
uv run playwright install --with-deps chromium
108+
- name: Run workflow tests with coverage
109+
run: |
110+
# Limit CPU usage and run tests slowly
111+
export PYTEST_ADDOPTS="--durations=10 --tb=short"
112+
uv run python -m pytest \
113+
--cov=browser_fastmcp_server.py \
114+
--cov=main.py \
115+
--cov-report=xml \
116+
--cov-report=term \
117+
--reruns 3 \
118+
--reruns-delay 20 \
119+
test_browser_workflow_test.py \
120+
-v \
121+
--maxfail=1 \
122+
--timeout=300
30123
- name: Upload coverage to Codecov
31124
uses: codecov/codecov-action@v4
32125
with:

test_browser_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ async def test_session_isolation(self):
7171
count = self.manager.get_session_count()
7272
self.assertGreaterEqual(count, 2)
7373
print(f"✅ Session count: {count}")
74-
74+
# 关闭
75+
await self.manager.close_session(session1)
76+
await self.manager.close_session(session2)
7577

7678

7779
async def test_session_cleanup(self):

0 commit comments

Comments
 (0)