diff --git a/.github/workflows/branches-and-prs.main.kts b/.github/workflows/branches-and-prs.main.kts index ed1b79d5e7..1497a59a4e 100755 --- a/.github/workflows/branches-and-prs.main.kts +++ b/.github/workflows/branches-and-prs.main.kts @@ -67,12 +67,18 @@ workflow( ) } + val matrix = Matrix.full + with(__FILE__.parentFile.resolve("../../codecov.yml")) { + readText() + .replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}") + .let(::writeText) + } job( id = "build-and-verify", name = "Build and Verify", runsOn = RunnerType.Custom(expr(Matrix.operatingSystem)), strategy = Strategy( - matrix = Matrix.full + matrix = matrix ) ) { uses( diff --git a/.github/workflows/common.main.kts b/.github/workflows/common.main.kts index 1742863719..53a7aa3122 100755 --- a/.github/workflows/common.main.kts +++ b/.github/workflows/common.main.kts @@ -58,6 +58,13 @@ data class Matrix( val exclude: (Element.() -> Boolean)? = null, val includes: List? = null ) { + val size by lazy { + originalElements + .filterNot(exclude ?: { true }) + .size + + (includes?.size ?: 0) + } + private val originalElements by lazy { (operatingSystems ?: listOf(null)) .map { Element(operatingSystem = it) } diff --git a/.github/workflows/release.main.kts b/.github/workflows/release.main.kts index 0f005e6000..6102fda380 100755 --- a/.github/workflows/release.main.kts +++ b/.github/workflows/release.main.kts @@ -46,13 +46,19 @@ workflow( val SONATYPE_OSS_PASSWORD by secrets val SIGNING_GPG_PASSWORD by secrets + val matrix = Matrix.full + with(__FILE__.parentFile.resolve("../../codecov.yml")) { + readText() + .replace("after_n_builds:.*+$".toRegex(), "after_n_builds: ${matrix.size}") + .let(::writeText) + } val buildAndVerify = job( id = "build-and-verify", name = "Build and Verify", runsOn = RunnerType.Custom(expr(Matrix.operatingSystem)), condition = "${github.repository} == 'spockframework/spock'", strategy = Strategy( - matrix = Matrix.full + matrix = matrix ) ) { uses(