-
Notifications
You must be signed in to change notification settings - Fork 40
116 lines (98 loc) · 3.32 KB
/
Copy pathcoverage.yml
File metadata and controls
116 lines (98 loc) · 3.32 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
name: Coverage
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
# ── Backend (Rust) ────────────────────────────────────────────────────────
backend-coverage:
name: Backend – cargo llvm-cov (≥ 70 %)
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports: ["6379:6379"]
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain (stable + llvm-tools)
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache cargo registry & build artefacts
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-${{ hashFiles('backend/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Run tests with coverage
working-directory: backend
env:
DATABASE_URL: sqlite::memory:
REDIS_URL: redis://127.0.0.1:6379
run: |
cargo llvm-cov \
--all-features \
--workspace \
--lcov --output-path lcov.info \
--fail-under-fns 80
- name: Upload coverage report (LCOV)
uses: actions/upload-artifact@v4
with:
name: backend-coverage-lcov
path: backend/lcov.info
retention-days: 14
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: backend/lcov.info
flags: backend
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# ── Frontend (Vitest) ─────────────────────────────────────────────────────
frontend-coverage:
name: Frontend – Vitest (≥ 70 %)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
cache-dependency-path: frontend/pnpm-lock.yaml
- name: Install dependencies
working-directory: frontend
run: pnpm install --frozen-lockfile
- name: Run tests with coverage (thresholds enforced in vitest.config.ts)
working-directory: frontend
run: pnpm vitest run --coverage
- name: Upload coverage report (LCOV)
uses: actions/upload-artifact@v4
with:
name: frontend-coverage-lcov
path: frontend/coverage/lcov.info
retention-days: 14
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: frontend/coverage/lcov.info
flags: frontend
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}