-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (62 loc) · 2.1 KB
/
Copy pathci.yml
File metadata and controls
65 lines (62 loc) · 2.1 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
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
build:
name: Tests / ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: "21"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
gradle-version: "8.10.2"
- name: Run tests and checks
run: ./gradlew check jacocoAllReport --stacktrace
- name: Publish coverage summary
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
report="build/reports/jacoco/jacocoAllReport/jacocoAllReport.csv"
awk -F, '
NR > 1 {
branchMissed += $6
branchCovered += $7
lineMissed += $8
lineCovered += $9
}
END {
lineTotal = lineMissed + lineCovered
branchTotal = branchMissed + branchCovered
lineCoverage = lineTotal == 0 ? 100 : (lineCovered * 100 / lineTotal)
branchCoverage = branchTotal == 0 ? 100 : (branchCovered * 100 / branchTotal)
print "### JaCoCo coverage"
print ""
print "| Metric | Coverage |"
print "| --- | ---: |"
printf "| Lines | %.2f%% |\n", lineCoverage
printf "| Branches | %.2f%% |\n", branchCoverage
}
' "$report" >> "$GITHUB_STEP_SUMMARY"
- name: Upload coverage report
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: jacoco-report-${{ github.run_id }}
path: build/reports/jacoco/jacocoAllReport/html