diff --git a/.github/workflows/branches-and-prs.main.kts b/.github/workflows/branches-and-prs.main.kts index 0c3cb0608e..ab96a21d39 100755 --- a/.github/workflows/branches-and-prs.main.kts +++ b/.github/workflows/branches-and-prs.main.kts @@ -69,12 +69,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 6bbb90052d..e3d775f8de 100755 --- a/.github/workflows/common.main.kts +++ b/.github/workflows/common.main.kts @@ -55,6 +55,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 94c4b200e9..decac21791 100755 --- a/.github/workflows/release.main.kts +++ b/.github/workflows/release.main.kts @@ -47,13 +47,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( diff --git a/codecov.yml b/codecov.yml index 250c97597b..599046d6e8 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,4 +3,4 @@ codecov: comment: layout: "reach, diff, flags, files" - after_n_builds: 16 + after_n_builds: 18