diff --git a/.github/workflows/branches-and-prs.main.kts b/.github/workflows/branches-and-prs.main.kts index 9025113acd..78a38b9024 100755 --- a/.github/workflows/branches-and-prs.main.kts +++ b/.github/workflows/branches-and-prs.main.kts @@ -47,7 +47,6 @@ workflow( MergeGroup() ), sourceFile = __FILE__, - targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml", // https://stackoverflow.com/a/72408109/16358266 concurrency = Concurrency( group = "${expr { github.workflow }}-${expr("${github.eventPullRequest.pull_request.number} || ${github.ref}")}", @@ -76,12 +75,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( @@ -111,7 +116,9 @@ workflow( ) uses( name = "Upload to Codecov.io", - action = CodecovAction() + action = CodecovAction( + failCiIfError = true + ) ) } } diff --git a/.github/workflows/branches-and-prs.yml b/.github/workflows/branches-and-prs.yaml similarity index 94% rename from .github/workflows/branches-and-prs.yml rename to .github/workflows/branches-and-prs.yaml index 67a09b6c3c..49e0587a7e 100644 --- a/.github/workflows/branches-and-prs.yml +++ b/.github/workflows/branches-and-prs.yaml @@ -23,10 +23,10 @@ jobs: uses: 'actions/checkout@v4' - id: 'step-1' name: 'Execute script' - run: 'rm ''.github/workflows/branches-and-prs.yml'' && ''.github/workflows/branches-and-prs.main.kts''' + run: 'rm ''.github/workflows/branches-and-prs.yaml'' && ''.github/workflows/branches-and-prs.main.kts''' - id: 'step-2' name: 'Consistency check' - run: 'git diff --exit-code ''.github/workflows/branches-and-prs.yml''' + run: 'git diff --exit-code ''.github/workflows/branches-and-prs.yaml''' check_all_workflow_yaml_consistency: name: 'Check all Workflow YAML Consistency' runs-on: 'ubuntu-latest' @@ -112,3 +112,5 @@ jobs: - id: 'step-3' name: 'Upload to Codecov.io' uses: 'codecov/codecov-action@v5' + with: + fail_ci_if_error: 'true' diff --git a/.github/workflows/codeql-analysis.main.kts b/.github/workflows/codeql-analysis.main.kts index 1c9e1e5562..5b914c4e7e 100755 --- a/.github/workflows/codeql-analysis.main.kts +++ b/.github/workflows/codeql-analysis.main.kts @@ -55,7 +55,6 @@ workflow( ) ), sourceFile = __FILE__, - targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml", // https://stackoverflow.com/a/72408109/16358266 concurrency = Concurrency( group = "${expr { github.workflow }}-${expr("${github.eventPullRequest.pull_request.number} || ${github.ref}")}", diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yaml similarity index 93% rename from .github/workflows/codeql-analysis.yml rename to .github/workflows/codeql-analysis.yaml index 755b3faf1b..8757e31019 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yaml @@ -24,10 +24,10 @@ jobs: uses: 'actions/checkout@v4' - id: 'step-1' name: 'Execute script' - run: 'rm ''.github/workflows/codeql-analysis.yml'' && ''.github/workflows/codeql-analysis.main.kts''' + run: 'rm ''.github/workflows/codeql-analysis.yaml'' && ''.github/workflows/codeql-analysis.main.kts''' - id: 'step-2' name: 'Consistency check' - run: 'git diff --exit-code ''.github/workflows/codeql-analysis.yml''' + run: 'git diff --exit-code ''.github/workflows/codeql-analysis.yaml''' codeql-build: name: 'CodeQL-Build' runs-on: 'ubuntu-latest' diff --git a/.github/workflows/common.main.kts b/.github/workflows/common.main.kts index 894d471bbb..33aefb3cf5 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/docs-pr.main.kts b/.github/workflows/docs-pr.main.kts index 1334f7566f..e3c9c04448 100755 --- a/.github/workflows/docs-pr.main.kts +++ b/.github/workflows/docs-pr.main.kts @@ -46,7 +46,6 @@ workflow( MergeGroup() ), sourceFile = __FILE__, - targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml", // https://stackoverflow.com/a/72408109/16358266 concurrency = Concurrency( group = "${expr { github.workflow }}-${expr("${github.eventPullRequest.pull_request.number} || ${github.ref}")}", diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yaml similarity index 90% rename from .github/workflows/docs-pr.yml rename to .github/workflows/docs-pr.yaml index dc5e4cda86..35cbf4244a 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yaml @@ -23,10 +23,10 @@ jobs: uses: 'actions/checkout@v4' - id: 'step-1' name: 'Execute script' - run: 'rm ''.github/workflows/docs-pr.yml'' && ''.github/workflows/docs-pr.main.kts''' + run: 'rm ''.github/workflows/docs-pr.yaml'' && ''.github/workflows/docs-pr.main.kts''' - id: 'step-2' name: 'Consistency check' - run: 'git diff --exit-code ''.github/workflows/docs-pr.yml''' + run: 'git diff --exit-code ''.github/workflows/docs-pr.yaml''' docs-and-javadoc: name: 'Docs and JavaDoc' runs-on: 'ubuntu-latest' diff --git a/.github/workflows/release.main.kts b/.github/workflows/release.main.kts index d7119dd767..c8c0fd2cb0 100755 --- a/.github/workflows/release.main.kts +++ b/.github/workflows/release.main.kts @@ -39,21 +39,26 @@ workflow( tags = listOf("spock-*") ) ), - sourceFile = __FILE__, - targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml" + sourceFile = __FILE__ ) { val GITHUB_TOKEN by secrets val SONATYPE_OSS_USER by secrets 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( @@ -87,7 +92,9 @@ workflow( ) uses( name = "Upload to Codecov.io", - action = CodecovAction() + action = CodecovAction( + failCiIfError = true + ) ) } val releaseSpock = job( diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 95% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index d1ad9b36c1..ec302d72f4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -19,10 +19,10 @@ jobs: uses: 'actions/checkout@v4' - id: 'step-1' name: 'Execute script' - run: 'rm ''.github/workflows/release.yml'' && ''.github/workflows/release.main.kts''' + run: 'rm ''.github/workflows/release.yaml'' && ''.github/workflows/release.main.kts''' - id: 'step-2' name: 'Consistency check' - run: 'git diff --exit-code ''.github/workflows/release.yml''' + run: 'git diff --exit-code ''.github/workflows/release.yaml''' build-and-verify: name: 'Build and Verify' runs-on: '${{ matrix.os }}' @@ -95,6 +95,8 @@ jobs: - id: 'step-4' name: 'Upload to Codecov.io' uses: 'codecov/codecov-action@v5' + with: + fail_ci_if_error: 'true' release-spock: name: 'Release Spock' runs-on: '${{ matrix.os }}' diff --git a/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy b/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy index d04c8161fc..d9136c9074 100644 --- a/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy +++ b/build-logic/preprocess-workflows/src/main/groovy/org/spockframework/gradle/PreprocessWorkflowsPlugin.groovy @@ -68,7 +68,7 @@ class PreprocessWorkflowsPlugin implements Plugin { .files(getImportedFiles(project.file(workflowScript))) .withPropertyName("importedFiles") it.outputs - .file(new File(workflowScript.parent, "${workflowName}.yml")) + .file(new File(workflowScript.parent, "${workflowName}.yaml")) .withPropertyName('workflowFile') it.javaLauncher.set project.extensions.getByType(JavaToolchainService).launcherFor { diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..599046d6e8 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +codecov: + max_report_age: off + +comment: + layout: "reach, diff, flags, files" + after_n_builds: 18