Skip to content

Commit b6a5183

Browse files
authored
JaCoCo CI workflow (#16)
*JaCoCo CI workflow with support of Morana OSS
1 parent 90b6243 commit b6a5183

File tree

11 files changed

+642
-187
lines changed

11 files changed

+642
-187
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @benedeki @lsulak @Zejnilovic @salamonpavel @petr-pokorny-absa @oto-macenauer-absa
1+
* @benedeki @lsulak @Zejnilovic @salamonpavel @petr-pokorny-absa @oto-macenauer-absa @tmikula-dev
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: JaCoCo Report
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
types: [ opened, edited, synchronize, reopened ]
7+
8+
env:
9+
scalaLong: 2.13.11
10+
scalaShort: "2.13"
11+
coverage-overall: 80.0
12+
coverage-changed-files: 80.0
13+
coverage-per-changed-file: 0.0
14+
check-overall-coverages: true
15+
16+
jobs:
17+
jacoco-report:
18+
name: JaCoCo Report
19+
runs-on: ubuntu-latest
20+
services:
21+
dynamodb-local:
22+
image: "amazon/dynamodb-local:latest"
23+
ports:
24+
- "8000:8000"
25+
26+
steps:
27+
- name: Checkout code
28+
id: code-checkout
29+
uses: actions/checkout@v4
30+
with:
31+
persist-credentials: false
32+
33+
- name: Setup JVM and SBT
34+
id: jvm-setup
35+
uses: coursier/setup-action@v1.3.5
36+
with:
37+
jvm: corretto:21.0.2.13.1
38+
apps: sbt
39+
40+
- name: Build and run tests with test coverage
41+
id: jacoco-run
42+
continue-on-error: true
43+
run: sbt jacoco
44+
env:
45+
AWS_REGION: "ignored"
46+
AWS_ACCESS_KEY_ID: "ignored"
47+
AWS_SECRET_ACCESS_KEY: "ignored"
48+
49+
- name: Publish JaCoCo Report in PR comments
50+
id: jacoco
51+
uses: MoranaApps/jacoco-report@v2
52+
with:
53+
token: '${{ secrets.GITHUB_TOKEN }}'
54+
paths: |
55+
**/target/**/jacoco/report/jacoco.xml
56+
sensitivity: "detail"
57+
comment-mode: 'single'
58+
min-coverage-overall: ${{ env.coverage-overall }}
59+
min-coverage-changed-files: ${{ env.coverage-changed-files }}
60+
min-coverage-per-changed-file: ${{ env.coverage-per-changed-file }}
61+
skip-unchanged: false

.github/workflows/status-board-tests.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

.sbtrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ alias test=; testOnly *UnitTests
77
alias testDynamo=; testOnly *DynamoDBIntegrationTests
88
alias testSMTP=; testOnly *SMTPIntegrationTests
99
alias testMSTeams=; testOnly *MSTeamsIntegrationTests
10+
11+
# JaCoCo Aliases
12+
alias jacoco=; jacocoOn; +clean; +test; jacocoReportAll; jacocoOff
13+
alias jacocoOff=; set every jacocoPluginEnabled := false
14+
alias jacocoOn=; set every jacocoPluginEnabled := true

build.sbt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616
import Dependencies.*
17-
import JacocoSetup.*
18-
1917
import scala.collection.Seq
2018

2119
ThisBuild / scalaVersion := Versions.scala213
@@ -57,8 +55,7 @@ lazy val root = (project in file("."))
5755
Test / parallelExecution := false,
5856
(assembly / test) := {},
5957
publish := {},
60-
jacocoReportSettings := jacocoSettings(scalaVersion.value, "status-board"),
61-
jacocoExcludes := jacocoProjectExcludes()
6258
)
6359
.enablePlugins(AutomateHeaderPlugin)
6460
.enablePlugins(AssemblyPlugin)
61+
.enablePlugins(FilteredJacocoAgentPlugin)

jmf-rules.txt

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# jacoco-method-filter — Default Rules & HowTo (Scala)
2+
# [jmf:1.0.0]
3+
#
4+
# This file defines which methods should be annotated as *Generated so JaCoCo ignores them.
5+
# One rule per line.
6+
#
7+
# ─────────────────────────────────────────────────────────────────────────────
8+
# HOW TO USE (quick)
9+
# 1) Replace YOUR.PACKAGE.ROOT with your project’s package root (e.g., com.example.app).
10+
# 2) Start with the CONSERVATIVE section only.
11+
# 3) If clean, enable STANDARD. Use AGGRESSIVE only inside DTO/auto‑generated packages.
12+
# 4) Keep rules narrow (by package), prefer flags (synthetic/bridge) for compiler artifacts,
13+
# and add `id:` labels so logs are easy to read.
14+
#
15+
# ─────────────────────────────────────────────────────────────────────────────
16+
# ALLOWED SYNTAX (cheat sheet)
17+
#
18+
# General form:
19+
# <FQCN_glob>#<method_glob>(<descriptor_glob>) [FLAGS and PREDICATES...]
20+
#
21+
# FQCN_glob (dot form; $ allowed for inner classes):
22+
# Examples: *.model.*, com.example.*, *
23+
#
24+
# method_glob (glob on method name):
25+
# Examples: copy | $anonfun$* | get* | *_$eq
26+
#
27+
# descriptor_glob (JVM descriptor in (args)ret). You may omit it entirely.
28+
# • Omitting descriptor ⇒ treated as "(*)*" (any args, any return).
29+
# • Short/empty forms "", "()", "(*)" normalize to "(*)*".
30+
# Examples:
31+
# (I)I # takes int, returns int
32+
# (Ljava/lang/String;)V # takes String, returns void
33+
# () or (*) or omitted # any args, any return
34+
#
35+
# FLAGS (optional) — space or comma separated:
36+
# public | protected | private | synthetic | bridge | static | abstract
37+
#
38+
# PREDICATES (optional):
39+
# ret:<glob> # match return type only (e.g., ret:V, ret:I, ret:Lcom/example/*;)
40+
# id:<string> # identifier shown in logs/reports
41+
# name-contains:<s> # method name must contain <s>
42+
# name-starts:<s> # method name must start with <s>
43+
# name-ends:<s> # method name must end with <s>
44+
#
45+
# Notes
46+
# - Always use dot-form (com.example.Foo) for class names.
47+
# - Comments (# …) and blank lines are ignored.
48+
#
49+
# ─────────────────────────────────────────────────────────────────────────────
50+
# QUICK EXAMPLES
51+
#
52+
# Simple wildcards
53+
# *#*(*)
54+
# → Match EVERY method in EVERY class (any package). Useful only for diagnostics.
55+
# "(*)" normalizes to "(*)*" ⇒ any args, any return.
56+
# *.dto.*#*(*)
57+
# → Match every method on any class under any package segment named "dto".
58+
# Good when you treat DTOs as generated/boilerplate.
59+
60+
# Scala case class helpers
61+
# *.model.*#copy(*)
62+
# → Matches Scala case-class `copy` methods under `*.model.*`.
63+
# Hides boilerplate clones with any parameter list and any return.
64+
# *.model.*#productArity()
65+
# → Matches zero-arg `productArity` (case-class/Product API).
66+
# *.model.*#productElement(*)
67+
# → Matches `productElement(int)` (or any descriptor form) on case classes.
68+
# *.model.*#productPrefix()
69+
# → Matches `productPrefix()`; returns the case class' constructor name.
70+
71+
# Companion objects and defaults
72+
# *.model.*$*#apply(*)
73+
# → Matches companion `apply` factories under `*.model.*` (any args).
74+
# BE CAREFUL: can hide real factory logic; keep the package scope narrow.
75+
# *.model.*$*#unapply(*)
76+
# → Matches extractor `unapply` methods in companions under `*.model.*`.
77+
# *#*$default$*(*)
78+
# → Matches Scala-generated default-argument helpers everywhere.
79+
# Safe to keep enabled; they’re compiler-synthesized.
80+
81+
# Anonymous / synthetic / bridge
82+
# *#$anonfun$*
83+
# → Matches any method whose name contains `$anonfun$` (Scala lambdas).
84+
# Consider adding `synthetic` and/or a package scope in real configs.
85+
# *#*(*):synthetic # any synthetic
86+
# → Matches ANY method marked `synthetic` (compiler-generated).
87+
# Powerful; scope by package to avoid hiding intentional glue code.
88+
# *#*(*):bridge # any bridge
89+
# → Matches Java generic bridge methods the compiler inserts.
90+
# Usually safe globally, but scoping is still recommended.
91+
92+
# Setters / fluent APIs
93+
# *.dto.*#*_$eq(*)
94+
# → Matches Scala var setters in DTO packages (e.g., `name_=(...)`).
95+
# Good for excluding trivial field writes.
96+
# *.builder.*#with*(*)
97+
# → Matches builder-style fluent setters (`withXxx(...)`) in builder pkgs.
98+
# Treats chainable configuration as boilerplate.
99+
# *.client.*#with*(*) ret:Lcom/api/client/*
100+
# → Like above but ONLY when the return type matches your client package.
101+
# The `ret:` predicate protects real logic that returns other types.
102+
103+
# Return-type constraints
104+
# *.jobs.*#*(*):ret:V
105+
# → Any method under `*.jobs.*` returning `void` (`V`). Often orchestration.
106+
# *.math.*#*(*):ret:I
107+
# → Any method under `*.math.*` returning primitive int (`I`).
108+
# *.model.*#*(*):ret:Lcom/example/model/*
109+
# → Any method under `*.model.*` that returns a type in `com.example.model`.
110+
# Handy when the *return type* uniquely identifies boilerplate.
111+
112+
# ─────────────────────────────────────────────────────────────────────────────
113+
# GLOBALS RULES
114+
# ─────────────────────────────────────────────────────────────────────────────
115+
# ** all case class boilerplate
116+
117+
# Scala case class helpers
118+
*#canEqual(*) id:case-canequal
119+
*#equals(*) id:case-equals
120+
*#apply(*) id:case-apply
121+
*#unapply(*) id:case-unapply
122+
*#hashCode(*) id:case-hashcode
123+
*#copy(*) id:case-copy
124+
*#copy$default$*(*) id:case-copy-defaults
125+
*#productElement() id:case-prod-element
126+
*#productArity() id:case-prod-arity
127+
*#productPrefix() id:case-prod-prefix
128+
*#productIterator() id:case-prod-iterator
129+
*#tupled() id:case-tupled
130+
*#curried() id:case-curried
131+
*#toString() id:case-tostring
132+
*#name() id:case-name
133+
*#groups() id:case-groups
134+
*#optionalAttributes() id:case-optionalAttributes
135+
136+
# Companion objects, constructors, and static definitions
137+
*$#<init>(*) id:gen-ctor # constructors
138+
*$#<clinit>() id:gen-clinit # static initializer blocks
139+
140+
# Companion objects and defaults
141+
*$*#apply(*) id:comp-apply
142+
*$*#unapply(*) id:comp-unapply
143+
*$*#toString(*) id:comp-tostring
144+
*$*#readResolve(*) id:comp-readresolve
145+
146+
# anonymous class created by a macro expansion
147+
*$macro$*#$anonfun$inst$macro$* id:macro-inst
148+
*$macro$*#inst$macro$* id:macro-inst
149+
150+
# lambda
151+
*#* synthetic name-contains:$anonfun$ id:scala-anonfun
152+
153+
# ─────────────────────────────────────────────────────────────────────────────
154+
# PROJECT RULES
155+
# ─────────────────────────────────────────────────────────────────────────────
156+
157+
# Options for method filtering:
158+
# *.api.http*#*
159+
# *.config*#*
160+
# za.co.absa.statusboard.Main*#*
161+
# za.co.absa.statusboard.repository.DynamoDb*#*
162+
# za.co.absa.statusboard.utils.DynamoDb*#*

0 commit comments

Comments
 (0)