Skip to content

Commit 603946a

Browse files
author
Oleksandr Dzhychko
authored
Merge pull request #628 from modelix/MODELIX-791-Enable-coverage-reporting-in-PR-pipelines
MODELIX-791: enable coverage reporting in PR pipelines
2 parents 445b7d7 + 1d13f91 commit 603946a

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

.github/workflows/build.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Build
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
run: ./gradlew --build-cache build detekt -PciBuild=true
35+
run: ./gradlew --build-cache build detekt :koverHtmlReport :koverXmlReport -PciBuild=true
3636
- name: Publish test results
3737
uses: EnricoMi/publish-unit-test-result-action@v2
3838
# Also report in case the build failed
@@ -49,6 +49,13 @@ jobs:
4949
path: |
5050
*/build/test-results
5151
*/build/reports
52+
- name: Report test coverage
53+
uses: madrapps/[email protected]
54+
with:
55+
paths: ${{ github.workspace }}/build/reports/kover/report.xml
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
title: JVM coverage report
58+
update-comment: true
5259
- name: Upload SARIF file
5360
uses: github/codeql-action/upload-sarif@v3
5461
with:

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ plugins {
4545
alias(libs.plugins.dokka)
4646
alias(libs.plugins.node) apply false
4747
alias(libs.plugins.detekt) apply false
48+
alias(libs.plugins.kotlinx.kover)
4849
}
4950

5051
group = "org.modelix"
@@ -69,6 +70,11 @@ fun computeVersion(): Any {
6970

7071
dependencies {
7172
dokkaPlugin(libs.dokka.versioning)
73+
74+
// Generate a combined coverage report
75+
project.subprojects.forEach {
76+
kover(it)
77+
}
7278
}
7379

7480
val parentProject = project
@@ -78,6 +84,7 @@ subprojects {
7884
apply(plugin = "maven-publish")
7985
apply(plugin = "org.jetbrains.dokka")
8086
apply(plugin = "io.gitlab.arturbosch.detekt")
87+
apply(plugin = "org.jetbrains.kotlinx.kover")
8188

8289
version = rootProject.version
8390
group = rootProject.group

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ test-logger = { id = "com.adarshr.test-logger", version = "4.0.0" }
2323
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
2424
intellij = { id = "org.jetbrains.intellij", version = "1.17.2" }
2525
openapi-generator = {id = "org.openapi.generator", version.ref = "openapi"}
26+
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.5" }
2627

2728
[versions]
2829
kotlin = "1.9.23"

model-server/src/main/kotlin/org/modelix/model/server/handlers/HistoryHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class HistoryHandler(val client: IModelClient, private val repositoriesManager:
107107
}
108108
}
109109

110-
suspend fun revert(repositoryAndBranch: BranchReference, from: String?, to: String?, author: String?) {
110+
private suspend fun revert(repositoryAndBranch: BranchReference, from: String?, to: String?, author: String?) {
111111
val version = repositoriesManager.getVersion(repositoryAndBranch) ?: throw RuntimeException("Branch doesn't exist: $repositoryAndBranch")
112112
val branch = OTBranch(PBranch(version.tree, client.idGenerator), client.idGenerator, client.storeCache!!)
113113
branch.runWriteT { t ->

model-server/src/main/kotlin/org/modelix/model/server/store/IgniteStoreClient.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ private val LOG = KotlinLogging.logger { }
3131

3232
class IgniteStoreClient(jdbcConfFile: File? = null, inmemory: Boolean = false) : IStoreClient, AutoCloseable {
3333

34-
private val ENTRY_CHANGED_TOPIC = "entryChanged"
34+
companion object {
35+
private const val ENTRY_CHANGED_TOPIC = "entryChanged"
36+
}
37+
3538
private lateinit var ignite: Ignite
3639
private val cache: IgniteCache<String, String?>
3740
private val changeNotifier = ChangeNotifier(this)

0 commit comments

Comments
 (0)