Skip to content

Commit

Permalink
feature: split sonar action from pr action
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-lcapellino committed Oct 16, 2024
1 parent 25a4bdd commit 1bf6566
Showing 1 changed file with 38 additions and 6 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/pull-request_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ jobs:
run: |
echo ${{steps.pom-version.outputs.pom_changed}}
Test-and-Sonar:
Test:
permissions:
checks: write
pull-requests: write
Expand All @@ -72,17 +71,48 @@ 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
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: "**/surefire-reports/TEST-*.xml"
check_name: "Unit Test Results"
Expand All @@ -99,6 +129,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
Expand All @@ -108,7 +140,7 @@ jobs:
run: mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --batch-mode sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=${{ github.workspace }}/tx-coverage/target/site/jacoco-aggregate/jacoco.xml -Dsonar.projectKey=${{ vars.SONAR_PROJECT_KEY_BACKEND }} -Dsonar.organization=${{ vars.SONAR_ORGANIZATION }}

Publish-docker-image:
# needs: [ "Test-and-Sonar" ]
# needs: [ "Test-and-Sonar" ]
runs-on: ubuntu-latest
defaults:
run:
Expand Down

0 comments on commit 1bf6566

Please sign in to comment.