前端第二批测试 (42 用例): - AuthBloc: 16 用例 (启动恢复/登录/注册/角色选择/班级码/登出) - HomeBloc: 8 用例 (数据加载/今日检测/心情统计/连续天数/离线容错) - CalendarBloc: 10 用例 (月份切换/日期选择/视图模式/状态保持) - MoodBloc: 8 用例 (统计加载/周期切换/API解析/错误处理) 后端 P0 单元测试 (13 用例): - journal_service: 5 用例 (model_to_resp 转换/mood回退/weather回退/tags解析) - sync_service: 8 用例 (冲突收集/DTO构造/序列化roundtrip/非冲突排除) CI/CD: - pr-check.yml: PR 触发 cargo fmt+check+clippy+test + flutter analyze+test - main-merge.yml: main push 触发完整检查 + cargo audit 安全审计 测试统计: 前端 84 通过, 后端 73 通过 (全部通过)
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: Main Merge
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
backend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: crates → target
|
|
|
|
- name: cargo fmt
|
|
run: cargo fmt --all -- --check
|
|
|
|
- name: cargo check
|
|
run: cargo check --all-targets
|
|
|
|
- name: cargo clippy
|
|
run: cargo clippy --all-targets -- -D warnings
|
|
|
|
- name: cargo test
|
|
run: cargo test --all
|
|
|
|
- name: cargo audit # 安全审计(可选,允许失败)
|
|
run: |
|
|
cargo install cargo-audit 2>/dev/null || true
|
|
cargo audit || true
|
|
|
|
frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: '3.x'
|
|
channel: 'stable'
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
working-directory: app
|
|
|
|
- name: flutter analyze
|
|
run: flutter analyze --no-fatal-infos
|
|
working-directory: app
|
|
|
|
- name: flutter test
|
|
run: flutter test
|
|
working-directory: app
|