From 2ffab4a3aa5bd78c7f4fec46e9a608d6e0f66cfe Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Tue, 11 Jun 2024 00:06:08 +0200 Subject: [PATCH] feat(cicd): publish jacoco report --- .github/workflows/main.yml | 10 ++++++++++ build.gradle | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2bb1a89..2b9bafd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -84,6 +84,16 @@ jobs: copyLatest: true ignoreMissingResults: true + # Jacoco + - name: 'Set up Cloud SDK' + if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 }} + uses: 'google-github-actions/setup-gcloud@v2' + + - name: 'Copy jacoco files' + if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 }} + run: | + gsutil -m rsync -d -r build/reports/jacoco/test/ gs://internal-kestra-host/${{ format('{0}/{1}/{2}', github.repository, env.GITHUB_HEAD_REF_SLUG != '' && env.GITHUB_HEAD_REF_SLUG || github.ref_name, 'jacoco') }} + # Publish - name: Publish package to Sonatype if: github.ref == 'refs/heads/master' diff --git a/build.gradle b/build.gradle index 7c28438..553ea6f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'java-library' id "idea" + id 'jacoco' id "com.adarshr.test-logger" version "4.0.0" id "com.github.johnrengelman.shadow" version "8.1.1" id 'ru.vyarus.java-lib' version '3.0.0' @@ -144,6 +145,17 @@ test { jvmArgs = [ "-javaagent:${configurations.agent.singleFile}" ] } +/**********************************************************************************************************************\ + * Jacoco + **********************************************************************************************************************/ +test { + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test +} + /**********************************************************************************************************************\ * Publish **********************************************************************************************************************/