From 4d75deb12050b2a3f6212f4de4bac658e57dcaea Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Tue, 11 Jun 2024 00:06:07 +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 e58242f..59887ca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,6 +89,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 927a8ae..e686697 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' @@ -112,6 +113,17 @@ test { jvmArgs = [ "-javaagent:${configurations.agent.singleFile}" ] } +/**********************************************************************************************************************\ + * Jacoco + **********************************************************************************************************************/ +test { + finalizedBy jacocoTestReport +} + +jacocoTestReport { + dependsOn test +} + /**********************************************************************************************************************\ * Publish **********************************************************************************************************************/