From 65a78c1de9a73bf474c8edb291fb0b61f045c428 Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Fri, 7 Jun 2024 23:55:32 +0200 Subject: [PATCH] feat(cicd): publish allure report --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ build.gradle | 23 +++++++++++++++++++++++ src/test/resources/allure.properties | 1 + 3 files changed, 50 insertions(+) create mode 100644 src/test/resources/allure.properties diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fda8f13..e58242f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,7 @@ jobs: runs-on: ubuntu-latest env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} steps: - uses: actions/checkout@v4 @@ -63,6 +64,31 @@ jobs: if: ${{ github.event.inputs.skip-test == 'false' || github.event.inputs.skip-test == '' }} run: ./gradlew check + # Allure check + - name: Auth to Google Cloud + id: auth + if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 }} + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GOOGLE_SERVICE_ACCOUNT }}' + + - uses: rlespinasse/github-slug-action@v4 + + - name: Publish allure report + uses: andrcuns/allure-publish-action@v2.6.0 + if: ${{ always() && env.GOOGLE_SERVICE_ACCOUNT != 0 && (github.event.inputs.skip-test == 'false' || github.event.inputs.skip-test == '') }} + env: + GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm/ + with: + storageType: gcs + resultsGlob: build/allure-results + bucket: internal-kestra-host + baseUrl: "https://internal.kestra.io" + prefix: ${{ format('{0}/{1}/{2}', github.repository, env.GITHUB_HEAD_REF_SLUG != '' && env.GITHUB_HEAD_REF_SLUG || github.ref_name, 'allure/java') }} + copyLatest: true + ignoreMissingResults: true + # Publish - name: Publish package to Sonatype if: github.ref == 'refs/heads/master' diff --git a/build.gradle b/build.gradle index 09c6c2c..927a8ae 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,29 @@ dependencies { testImplementation "org.hamcrest:hamcrest-library:2.2" } +/**********************************************************************************************************************\ + * Allure Reports + **********************************************************************************************************************/ +dependencies { + testImplementation platform("io.qameta.allure:allure-bom:2.27.0") + testImplementation "io.qameta.allure:allure-junit5" +} + +configurations { + agent { + canBeResolved = true + canBeConsumed = true + } +} + +dependencies { + agent "org.aspectj:aspectjweaver:1.9.22.1" +} + +test { + jvmArgs = [ "-javaagent:${configurations.agent.singleFile}" ] +} + /**********************************************************************************************************************\ * Publish **********************************************************************************************************************/ diff --git a/src/test/resources/allure.properties b/src/test/resources/allure.properties new file mode 100644 index 0000000..4873f6d --- /dev/null +++ b/src/test/resources/allure.properties @@ -0,0 +1 @@ +allure.results.directory=build/allure-results