From 44fc4830853e588ffe0d2472446b07806edc8099 Mon Sep 17 00:00:00 2001 From: ds-lcapellino Date: Wed, 16 Oct 2024 10:49:10 +0200 Subject: [PATCH] feature: split sonar action from pr action --- .github/workflows/pull-request_backend.yml | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request_backend.yml b/.github/workflows/pull-request_backend.yml index 0915532be0..d17ae5a970 100644 --- a/.github/workflows/pull-request_backend.yml +++ b/.github/workflows/pull-request_backend.yml @@ -57,7 +57,7 @@ jobs: echo ${{steps.pom-version.outputs.pom_changed}} - Test-and-Sonar: + Test: permissions: checks: write pull-requests: write @@ -72,12 +72,45 @@ jobs: - name: Run unit & integration tests run: mvn -pl tx-models,tx-backend,tx-coverage -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B verify + - name: Upload integration test results + uses: actions/upload-artifact@v3 + with: + name: integration-test-results + path: "${{ github.workspace }}/tx-backend/target/failsafe-reports" + - name: Upload unit test results + uses: actions/upload-artifact@v3 + with: + name: unit-tests-results + path: "**/surefire-reports/" + + Sonar: + needs: Test + permissions: + checks: write + pull-requests: write + runs-on: ubuntu-latest + if: success() + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '${{ env.JAVA_VERSION }}' + distribution: 'temurin' + cache: 'maven' + - name: Download integration-test-results + uses: actions/download-artifact@v3 + with: + name: integration-test-results + - name: Download unit-tests-results + uses: actions/download-artifact@v3 + with: + name: unit-tests-results - name: Publish integration test results uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: - files: "${{ github.workspace }}/tx-backend/target/failsafe-reports/TEST-*.xml" + files: "integration-test-results/TEST-*.xml" check_name: "Integration Test Results" - name: Publish unit test results @@ -99,6 +132,8 @@ jobs: key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar + - name: Compile + run: mvn -pl tx-models,tx-backend,tx-coverage -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B compile - name: Verify Sonar Scan env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any