-
Notifications
You must be signed in to change notification settings - Fork 1
203 lines (179 loc) · 6.83 KB
/
Copy pathci.yml
File metadata and controls
203 lines (179 loc) · 6.83 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
run_e2e:
description: 'Run E2E ASR tests'
type: boolean
default: false
run_stress:
description: 'Run Stress tests (memory, long audio)'
type: boolean
default: false
# 取消同一 PR 的重复运行
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
QWEN_MODEL_VERSION: "Qwen3-ASR-0.6B"
jobs:
# ============================================================
# Tier 1: Swift Unit Tests (每个 PR 必跑, ~1min)
# ============================================================
unit-tests:
name: "Unit Tests (Swift)"
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build & Run Unit Tests
run: |
xcodebuild test \
-scheme Typeless \
-destination 'platform=macOS' \
-only-testing:TypelessTests/QwenASRUnitTests \
-resultBundlePath TestResults/unit.xcresult \
| xcbeautify || true
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-test-results
path: TestResults/
retention-days: 7
# ============================================================
# Tier 1: Concurrency Tests - Mock only (每个 PR 必跑)
# ============================================================
concurrency-tests:
name: "Concurrency Tests (Mock)"
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Mock Concurrency Tests
run: |
xcodebuild test \
-scheme Typeless \
-destination 'platform=macOS' \
-only-testing:TypelessTests/QwenASRConcurrencyTests/testEngineRapidProcessAndFlush \
-only-testing:TypelessTests/QwenASRConcurrencyTests/testRecordingManagerWithMockEngine \
| xcbeautify || true
# ============================================================
# Tier 2: E2E ASR Tests (条件触发)
# 触发条件: push to main / PR label "run-e2e" / 手动触发
# ============================================================
e2e-tests:
name: "E2E ASR Tests"
runs-on: macos-15
if: >
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' && github.event.inputs.run_e2e == 'true' ||
contains(github.event.pull_request.labels.*.name, 'run-e2e')
steps:
- name: Checkout
uses: actions/checkout@v4
# ── 模型缓存 ──
- name: Cache Qwen3-ASR Model
id: cache-model
uses: actions/cache@v4
with:
path: ~/Library/Application Support/Nano Typeless/models/Qwen3-ASR-0.6B
key: qwen3-asr-model-${{ env.QWEN_MODEL_VERSION }}
- name: Download Qwen3-ASR Model
if: steps.cache-model.outputs.cache-hit != 'true'
run: |
MODEL_DIR="$HOME/Library/Application Support/Nano Typeless/models/Qwen3-ASR-0.6B"
mkdir -p "$MODEL_DIR"
echo "::warning::Model not in cache. Please manually upload model files or configure download source."
echo "Expected path: $MODEL_DIR"
# TODO: 替换为实际的模型下载命令
# 例如: wget -q -O model.tar.gz "https://your-model-host/Qwen3-ASR-0.6B.tar.gz"
# tar -xzf model.tar.gz -C "$MODEL_DIR"
# ── 生成测试语料 ──
- name: Cache Test Audio Fixtures
id: cache-audio
uses: actions/cache@v4
with:
path: tests/fixtures/audio
key: test-audio-v4-${{ hashFiles('scripts/generate_synthetic_corpus.py', 'scripts/synthetic_corpus.yaml') }}
- name: Install uv
if: steps.cache-audio.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@v4
- name: Generate Test Corpus
if: steps.cache-audio.outputs.cache-hit != 'true'
run: uv run --with pyyaml python scripts/generate_synthetic_corpus.py
# ── 运行 E2E 测试 ──
- name: Run E2E Tests
run: |
xcodebuild test \
-scheme Typeless \
-destination 'platform=macOS' \
-only-testing:TypelessTests/QwenASRE2ETests \
-resultBundlePath TestResults/e2e.xcresult \
| xcbeautify || true
- name: Upload E2E Results
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results
path: TestResults/
retention-days: 14
# ============================================================
# Tier 3: Stress Tests (手动触发 / main push)
# 包含: Boundary tests, 内存增长, 长音频, 并发(真实模型)
# ============================================================
stress-tests:
name: "Stress & Boundary Tests"
runs-on: macos-15
if: >
github.event_name == 'workflow_dispatch' && github.event.inputs.run_stress == 'true' ||
github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Qwen3-ASR Model
id: cache-model
uses: actions/cache@v4
with:
path: ~/Library/Application Support/Nano Typeless/models/Qwen3-ASR-0.6B
key: qwen3-asr-model-${{ env.QWEN_MODEL_VERSION }}
- name: Download Qwen3-ASR Model
if: steps.cache-model.outputs.cache-hit != 'true'
run: |
MODEL_DIR="$HOME/Library/Application Support/Nano Typeless/models/Qwen3-ASR-0.6B"
mkdir -p "$MODEL_DIR"
echo "::warning::Model not in cache."
# 语料
- name: Cache Test Audio Fixtures
id: cache-audio
uses: actions/cache@v4
with:
path: tests/fixtures/audio
key: test-audio-v4-${{ hashFiles('scripts/generate_synthetic_corpus.py', 'scripts/synthetic_corpus.yaml') }}
- name: Install uv
if: steps.cache-audio.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@v4
- name: Generate Test Corpus
if: steps.cache-audio.outputs.cache-hit != 'true'
run: uv run --with pyyaml python scripts/generate_synthetic_corpus.py
- name: Run Boundary & Concurrency Tests
run: |
xcodebuild test \
-scheme Typeless \
-destination 'platform=macOS' \
-only-testing:TypelessTests/QwenASRBoundaryTests \
-only-testing:TypelessTests/QwenASRConcurrencyTests \
-resultBundlePath TestResults/stress.xcresult \
| xcbeautify || true
- name: Upload Stress Results
if: always()
uses: actions/upload-artifact@v4
with:
name: stress-test-results
path: TestResults/
retention-days: 14