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 **********************************************************************************************************************/