Skip to content

Commit a920a0d

Browse files
committed
feat: add code coverage reporting via Codecov for backend and contracts
1 parent d16912b commit a920a0d

6 files changed

Lines changed: 1748 additions & 2201 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,20 @@ jobs:
9393
- name: Run Backend Tests
9494
run: |
9595
ls -la src/generated/prisma
96-
npx vitest run --reporter=basic
96+
npx vitest run --coverage
9797
working-directory: backend
9898
env:
9999
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test
100100
NODE_ENV: test
101101

102+
- name: Upload coverage to Codecov
103+
uses: codecov/codecov-action@v4
104+
with:
105+
files: ./backend/coverage/lcov.info
106+
flags: backend
107+
token: ${{ secrets.CODECOV_TOKEN }}
108+
fail_ci_if_error: true
109+
102110
contracts:
103111
name: Soroban Contracts CI
104112
runs-on: ubuntu-latest
@@ -125,6 +133,21 @@ jobs:
125133
run: cargo test
126134
working-directory: contracts
127135

136+
- name: Install cargo-tarpaulin
137+
uses: taiki-e/install-action@cargo-tarpaulin
138+
139+
- name: Run Contract Coverage
140+
run: cargo tarpaulin --out Xml --fail-under 70 --output-dir .
141+
working-directory: contracts
142+
143+
- name: Upload coverage to Codecov
144+
uses: codecov/codecov-action@v4
145+
with:
146+
files: ./contracts/tarpaulin-report.xml
147+
flags: contracts
148+
token: ${{ secrets.CODECOV_TOKEN }}
149+
fail_ci_if_error: true
150+
128151
- name: Install Stellar CLI
129152
run: |
130153
curl -fsSL https://github.com/stellar/stellar-cli/raw/main/install.sh | sh -s -- --install-deps

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# FlowFi
22

3+
[![codecov](https://codecov.io/gh/LabsCrypt/flowfi/branch/main/graph/badge.svg?token=)](https://codecov.io/gh/LabsCrypt/flowfi)
4+
35
**DeFi Payment Streaming on Stellar**
46

57
_Programmable, real-time payment streams and recurring subscriptions._

backend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"ts-node": "^10.9.2",
5252
"tsx": "^4.19.2",
5353
"typescript": "^5.9.3",
54-
"vitest": "^2.1.8"
54+
"vitest": "^2.1.8",
55+
"@vitest/coverage-v8": "^2.1.8"
5556
}
5657
}

backend/vitest.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ export default defineConfig({
77
setupFiles: [],
88
include: ['tests/**/*.{test,spec}.ts'],
99
coverage: {
10-
reporter: ['text', 'json', 'html'],
10+
reporter: ['text', 'json', 'html', 'lcov'],
11+
thresholds: {
12+
lines: 60,
13+
functions: 60,
14+
branches: 60,
15+
statements: 60,
16+
}
1117
},
1218
testTimeout: 30000,
1319
hookTimeout: 30000,

codecov.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1%
7+
patch:
8+
default:
9+
target: auto
10+
threshold: 0%
11+
12+
comment:
13+
layout: "reach, diff, flags, files"
14+
behavior: default
15+
require_changes: false

0 commit comments

Comments
 (0)