-
Notifications
You must be signed in to change notification settings - Fork 18.5k
112 lines (90 loc) · 2.95 KB
/
Copy pathci.yml
File metadata and controls
112 lines (90 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: CI
on:
pull_request:
push:
branches:
- main
jobs:
tests:
name: Python ${{ matrix.python-version }} tests
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.13"]
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
env:
MPT_TEST_REDIS_HOST: 127.0.0.1
MPT_TEST_REDIS_PORT: 6379
MPT_TEST_REDIS_DB: 15
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install dependencies
run: uv sync --frozen --python ${{ matrix.python-version }}
- name: Compile Python sources
run: uv run --no-sync python -m compileall app cli.py main.py webui test
- name: Lint Python sources
if: matrix.python-version == '3.11'
run: uv run --no-sync ruff check app cli.py main.py webui test
- name: Run unit tests with coverage
# pytest 兼容现有 unittest.TestCase,同时会收集仓库中的 pytest 风格
# 测试,避免测试文件已存在但 CI 没有真正执行。
run: uv run --no-sync python -X utf8 -m coverage run -m pytest -q test
- name: Report test coverage
run: uv run --no-sync python -m coverage report
- name: Export coverage report
run: uv run --no-sync python -m coverage xml
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-python-${{ matrix.python-version }}
path: coverage.xml
retention-days: 7
windows-smoke:
name: Windows smoke tests
runs-on: windows-latest
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install dependencies
run: uv sync --frozen --python 3.11
- name: Compile Python sources
run: uv run --no-sync python -m compileall app cli.py main.py webui test
- name: Run core service smoke tests
run: >-
uv run --no-sync python -X utf8 -m pytest -q
test/services/test_config.py
test/services/test_state.py
test/services/test_task.py
test/services/test_task_manager.py
test/services/test_upload_post.py
test/services/test_controller_video.py
test/services/test_webui_task.py