Skip to content

Commit 39168ab

Browse files
committed
feat: add codecov setting for test coverage
1 parent c5e2067 commit 39168ab

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/codecov.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
codecov:
2+
require_ci_to_pass: true
3+
notify:
4+
wait_for_ci: true
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: 50..80
10+
11+
status:
12+
project:
13+
default:
14+
target: 50% # 현재 수준으로 설정
15+
threshold: 5% # 5% 이하로 떨어지면 실패 (너무 엄격하지 않게)
16+
base: auto
17+
if_ci_failed: error # CI 실패 시 커버리지 체크도 실패
18+
patch:
19+
default:
20+
target: 60% # 새 코드는 조금 더 높은 기준
21+
threshold: 10% # 새 코드에 대해서는 관대하게
22+
base: auto
23+
if_not_found: success # 새 코드가 없으면 성공
24+
25+
comment:
26+
layout: "header, diff, flags, files, footer"
27+
behavior: default
28+
require_changes: true # 변경사항이 있을 때만 코멘트
29+
require_base: false
30+
require_head: true
31+
hide_project_coverage: false # 프로젝트 전체 커버리지 표시
32+
33+
# 점진적 개선을 위한 설정
34+
github_checks:
35+
annotations: true # GitHub에서 커버리지 누락 부분 표시
36+
37+
# 파일별 커버리지 임계값 (점진적 개선용)
38+
flag_management:
39+
default_rules:
40+
carryforward: true # 이전 커버리지 데이터 유지

.github/workflows/rust.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,28 @@ jobs:
8787
env:
8888
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
8989
run: cargo test --verbose
90+
91+
- name: Cache cargo-tarpaulin binary
92+
id: cache-tarpaulin
93+
uses: actions/cache@v4
94+
with:
95+
path: ~/.cargo/bin/cargo-tarpaulin
96+
key: ${{ runner.os }}-cargo-tarpaulin-${{ hashFiles('**/Cargo.lock') }}
97+
98+
- name: Install cargo-tarpaulin
99+
if: steps.cache-tarpaulin.outputs.cache-hit != 'true'
100+
run: cargo install cargo-tarpaulin
101+
102+
- name: Generate coverage report
103+
working-directory: rook
104+
env:
105+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
106+
run: cargo tarpaulin --out xml --output-dir coverage
107+
108+
- name: Upload coverage reports to Codecov
109+
uses: codecov/codecov-action@v5
110+
with:
111+
file: ./rook/coverage/cobertura.xml
112+
token: ${{ secrets.CODECOV_TOKEN }}
113+
verbose: true
114+
fail_ci_if_error: false

0 commit comments

Comments
 (0)