-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (68 loc) · 2.47 KB
/
Copy pathci.yml
File metadata and controls
71 lines (68 loc) · 2.47 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
66
67
68
69
70
71
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Java
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5.3.0
with:
distribution: temurin
java-version: "21"
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
- 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
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7
with:
files: build/reports/jacoco/jacocoAllReport/jacocoAllReport.xml
fail_ci_if_error: false