Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
with:
submodules: 'true'

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
java-version: 17
distribution: zulu
cache: gradle

- uses: gradle/actions/setup-gradle@v6

- name: Build project and run tests
shell: bash
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ jobs:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
java-version: 17
distribution: zulu
cache: gradle

- uses: gradle/actions/setup-gradle@v6

# See: https://github.com/al-cheb/configure-pagefile-action
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.3

- name: Build project and run tests
shell: cmd
# For the reason on `--no-daemon` see https://github.com/actions/cache/issues/454
run: gradlew.bat build --stacktrace --no-daemon
run: gradlew.bat build --stacktrace

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

# Detect the Hugo site root (`docs/` or `site/`) by looking for a Hugo
# config file. Hugo config may live directly in the site root or in a
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ensure-reports-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
# Configure the checkout of all branches so that it is possible to run the comparison.
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
7 changes: 4 additions & 3 deletions .github/workflows/increment-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: 'true'

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
java-version: 17
distribution: zulu
cache: gradle

- uses: gradle/actions/setup-gradle@v6

- name: Check version is not yet published
shell: bash
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: 'true'

- uses: actions/setup-java@v4
- uses: actions/setup-java@v5
with:
java-version: 17
distribution: zulu
cache: gradle

- uses: gradle/actions/setup-gradle@v6

- name: Decrypt CloudRepo credentials
run: ./config/scripts/decrypt.sh "$CLOUDREPO_CREDENTIALS_KEY" ./.github/keys/cloudrepo.properties.gpg ./cloudrepo.properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
outputs:
package-names: ${{ steps.request-package-names.outputs.package-names }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: 'true'

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/config-tester.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ val tempFolder = File("./tmp")
ConfigTester(config, tasks, tempFolder)
.addRepo(SpineRepos.baseTypes) // Builds `base-types` at `master`.
.addRepo(SpineRepos.base) // Builds `base` at `master`.
.addRepo(SpineRepos.coreJava) // Builds `core-java` at `master`.
.addRepo(SpineRepos.coreJvm) // Builds `core-jvm` at `master`.

// This is how one builds a specific branch of some repository:
// .addRepo(SpineRepos.coreJava, Branch("grpc-concurrency-fixes"))
// .addRepo(SpineRepos.coreJvm, Branch("grpc-concurrency-fixes"))

// Register the produced task under the selected name to invoke manually upon need.
.registerUnder("buildDependants")
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/io/spine/gradle/ConfigTester.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import org.gradle.api.tasks.TaskContainer
* A tool to execute the Gradle `build` task in selected Git repositories
* with the local version of [config] contents.
*
* Checks out the content of selected repositories into the specified [tempFolder]. The folder
* is created if it does not exist. By default, uses `./tmp` as a temp folder.
* Checks out the content of selected repositories into the specified [tempFolder].
* The folder is created if it does not exist. By default, uses `./tmp` as a temp folder.
*
* Replaces the `config` and `buildSrc` folders in the checked out repository by the local versions
* of code. If the repository-under-test already contains its own `buildSrc` or `config` folders,
Expand Down Expand Up @@ -356,7 +356,7 @@ object SpineRepos {

val base: URI = library("base")
val baseTypes: URI = library("base-types")
val coreJava: URI = library("core-java")
val coreJvm: URI = library("core-jvm")
val web: URI = library("web")

private fun library(repo: String) = URI(libsOrg + repo)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright 2026, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.spine.gradle.report.coverage

import kotlinx.kover.gradle.plugin.dsl.KoverProjectExtension
import org.gradle.api.Project
import org.gradle.api.Task

/**
* Credits the test coverage produced by the [contributor] module for the classes
* of this project to this project's own Kover report.
*
* Some modules' production classes are exercised only by the tests of a sibling
* module — for example, the language-neutral `psi` classes are tested through
* the Java-PSI fixtures that live in `psi-java`. Kover's per-module report sees
* only this module's own `test` execution data, so that cross-module coverage is
* otherwise missing from the per-module report (which is what Codecov consumes),
* even though the root aggregated report already accounts for it.
*
* This function adds the [contributor]'s JaCoCo execution data to this project's
* `total` report as an additional binary report. Only this project's classes are
* credited from it — coverage of unrelated classes in the same execution data is
* ignored, because a Kover report is scoped to the owning project's classes. The
* report tasks are wired to run after the contributor's `test` task so the data
* is present when a report is generated.
*
* Requires the Kover plugin to be applied to this project.
* A cross-project **task** dependency is used, not a project dependency,
* so it does not introduce a dependency cycle even when the [contributor]
* already depends on this project.
*/
fun Project.creditTestCoverageFrom(contributor: Project) {
val execFile = contributor.layout.buildDirectory.file(TEST_EXEC_FILE)
extensions.configure(KoverProjectExtension::class.java) {
reports {
total {
additionalBinaryReports.add(execFile.map { it.asFile })
}
}
}
tasks.matching { it.consumesCoverageBinaryReports() }.configureEach {
dependsOn("${contributor.path}:test")
}
}

/**
* The Kover/JaCoCo execution-data file produced by a module's `test` task when
* the coverage engine is pinned to JaCoCo via `useJacoco(...)`.
*/
private const val TEST_EXEC_FILE: String = "kover/bin-reports/test.exec"

/**
* Tells whether this is a Kover task that reads the binary reports and therefore
* must run only after the [contributor's][creditTestCoverageFrom] test data exists.
*
* This matches both the report tasks (`koverXmlReport`, `koverHtmlReport`,
* `koverBinaryReport`) and the verification tasks (`koverVerify` and its
* cacheable companion `koverCachedVerify`) — the suffix test covers the
* `Cached*` variants Kover registers, which are the ones that actually consume
* the binary reports.
*/
private fun Task.consumesCoverageBinaryReports(): Boolean =
name.startsWith("kover") && (name.endsWith("Report") || name.endsWith("Verify"))
Loading
Loading