From 7095ef80acf1bd61bcdd2f4bff3099cdf8299064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oph=C3=A9lie=20Le=20Mentec?= <17216799+ouphi@users.noreply.github.com> Date: Mon, 15 Aug 2022 09:47:54 +0200 Subject: [PATCH] Upload test coverage to codecov. Upload test coverage to codecov. --- .github/workflows/verify.yaml | 4 ++++ build.gradle.kts | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 3be589d20..9cf34dece 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -45,6 +45,7 @@ jobs: timeout-minutes: 10 env: INTEGRATION_TEST: true + JACOCO: "true" - name: 'Publish Test Results' uses: EnricoMi/publish-unit-test-result-action@v1 @@ -52,6 +53,9 @@ jobs: with: files: "**/test-results/**/*.xml" + - name: CodeCov + uses: codecov/codecov-action@v3 + - name: 'docker-compose logs' run: docker-compose -f system-tests/tests/docker-compose.yml logs if: always() diff --git a/build.gradle.kts b/build.gradle.kts index 5eefc122a..5ad1c5814 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ plugins { `maven-publish` id("org.gradle.crypto.checksum") version "1.4.0" id("io.github.gradle-nexus.publish-plugin") version "1.1.0" + jacoco } repositories { @@ -84,6 +85,8 @@ subprojects{ allprojects { apply(plugin = "maven-publish") + apply(plugin = "java") + version = projectVersion group = projectGroup @@ -147,13 +150,26 @@ allprojects { } } - tasks.withType { + tasks.test { useJUnitPlatform() testLogging { showStandardStreams = true } } + if (System.getenv("JACOCO") == "true") { + apply(plugin = "jacoco") + tasks.test { + finalizedBy(tasks.jacocoTestReport) + } + tasks.jacocoTestReport { + reports { + // Generate XML report for codecov.io + xml.required.set(true) + } + } + } + // EdcRuntimeExtension uses this to determine the runtime classpath of the module to run. tasks.register("printClasspath") { doLast {