Skip to content

Commit dc580b1

Browse files
author
Jinge Wang
committed
Add code coverage CI workflow.
1 parent 415d9d6 commit dc580b1

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

.github/workflows/code-coverage.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow generate code coverage report and upload it to Codecov.
2+
3+
name: Coverage
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
code-coverage:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up JDK 17
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: '17'
23+
distribution: 'temurin'
24+
- run: chmod +x ./gradlew
25+
- name: Generate code coverage report with JaCoCo
26+
run: ./gradlew jacocoTestReport
27+
- name: Upload report to Codecov
28+
uses: codecov/codecov-action@v2
29+
with:
30+
files: ./build/reports/jacoco/test/jacocoTestReport.xml
31+
flags: unittests
32+
name: codecov-algorithms
33+
fail_ci_if_error: true # Let CI fail if upload failed
34+
verbose: true

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
plugins {
99
id 'java'
1010
id 'application'
11+
id 'jacoco'
1112
}
1213

1314
repositories {
@@ -38,4 +39,12 @@ tasks.named('test') {
3839

3940
application {
4041
getMainClass().set(findProperty("className").toString())
42+
}
43+
44+
jacocoTestReport {
45+
reports {
46+
xml.required = true
47+
}
48+
setSourceCompatibility(1.8)
49+
dependsOn(test)
4150
}

0 commit comments

Comments
 (0)