Skip to content

Commit c6891e2

Browse files
authored
Add codecov (#920)
1 parent 76aba35 commit c6891e2

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.github/workflows/codecov.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Workflow for Codecov
2+
on: [push, pull_request]
3+
jobs:
4+
run:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v4
9+
with:
10+
submodules: 'true'
11+
- name: Install dependencies, run tests, and collect coverage
12+
run: docker compose -f docker/buildkite/docker-compose.yaml run unit-test-test-service
13+
- name: Upload coverage to Codecov
14+
uses: codecov/codecov-action@v4
15+
env:
16+
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
17+
slug: uber/cadence

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ task registerDomain(type:JavaExec) {
287287
test {
288288
dependsOn 'registerDomain'
289289
dependsOn 'licenseMain'
290+
finalizedBy jacocoTestReport // report is always generated after tests run
290291
testLogging {
291292
events 'passed', 'skipped', 'failed'
292293
exceptionFormat 'full'
@@ -355,6 +356,7 @@ jacoco {
355356
}
356357

357358
jacocoTestReport {
359+
dependsOn test
358360
reports {
359361
xml.enabled = true // coveralls plugin depends on xml format report
360362
html.enabled = true

codecov.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Refs:
2+
# - https://docs.codecov.com/docs/common-recipe-list
3+
# - https://docs.codecov.com/docs/codecovyml-reference
4+
#
5+
# After making changes, run below command to validate
6+
# curl --data-binary @codecov.yml https://codecov.io/validate
7+
coverage:
8+
range: 80...100
9+
round: down
10+
precision: 2
11+
status:
12+
project: # measuring the overall project coverage
13+
default: # context, you can create multiple ones with custom titles
14+
informational: true
15+
target: 85% # specify the target coverage for each commit status
16+
# option: "auto" (compare against parent commit or pull request base)
17+
# option: "X%" a static target percentage to hit
18+
threshold: 0% # allow the coverage drop by x% before marking as failure
19+
if_ci_failed: ignore # require the CI to pass before setting the status
20+
patch:
21+
default:
22+
target: 85% # specify the target coverage for each commit status
23+
# option: "auto" (compare against parent commit or pull request base)
24+
# option: "X%" a static target percentage to hit
25+
threshold: 0% # allow the coverage drop by x% before marking as failure
26+
comment:
27+
layout: "header, files, footer"
28+
hide_project_coverage: false
29+
codecov:
30+
require_ci_to_pass: false

0 commit comments

Comments
 (0)