Skip to content

Sonar scan

Sonar scan #304

Workflow file for this run

name: Sonar scan
env:
BASE_JAVA_VERSION: '17'
SONAR_ORG: quarkusio-quarkus-super-heroes
SONAR_HOST_URL: https://sonarcloud.io
on:
workflow_run:
workflows:
- "Basic build and test"
branches:
- main
types:
- completed
workflow_dispatch:
concurrency:
group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.workflow_run.head_branch || github.event.ref || github.ref }}"
cancel-in-progress: false
jobs:
sonar-scan:
if: (github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && (github.event.workflow_run.conclusion == 'success')))
name: "sonar-scan-${{ matrix.project }}"
strategy:
fail-fast: false
matrix:
project:
- event-statistics
- rest-fights
- rest-heroes
- rest-villains
- rest-narration
- grpc-locations
- ui-super-heroes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java ${{ env.BASE_JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.BASE_JAVA_VERSION }}
distribution: temurin
cache: maven
- name: Sonar scan (Non-ui project)
if: matrix.project != 'ui-super-heroes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ${{ matrix.project }}
run: |
./mvnw -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pit-coverage \
-Dquarkus.http.host=0.0.0.0 \
-Dmaven.compiler.release=${{ env.BASE_JAVA_VERSION }} \
-Dquarkus.package.write-transformed-bytecode-to-build-output=true \
-Dsonar.host.url=${{ env.SONAR_HOST_URL }} \
-Dsonar.organization=${{ env.SONAR_ORG }} \
-Dsonar.projectKey=${{ env.SONAR_ORG }}_${{ matrix.project }} \
-Dsonar.coverage.jacoco.xmlReportPaths=target/jacoco-report/jacoco.xml \
-Dsonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports
- name: Sonar scan (ui project)
if: matrix.project == 'ui-super-heroes'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
working-directory: ${{ matrix.project }}
run: |
./mvnw -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pit-coverage \
-Dquarkus.http.host=0.0.0.0 \
-Dmaven.compiler.release=${{ env.BASE_JAVA_VERSION }} \
-Dquarkus.package.write-transformed-bytecode-to-build-output=true \
-Dquarkus.quinoa.package-manager-command.test="run coverage" \
-Dsonar.host.url=${{ env.SONAR_HOST_URL }} \
-Dsonar.organization=${{ env.SONAR_ORG }} \
-Dsonar.projectKey=${{ env.SONAR_ORG }}_${{ matrix.project }} \
-Dsonar.coverage.jacoco.xmlReportPaths=target/jacoco-report/jacoco.xml \
-Dsonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports \
-Dsonar.test.inclusions="**/*.test.js" \
-Dsonar.exclusions="**/*.test.js" \
-Dsonar.coverage.exclusions="src/test/java/**/*" \
-Dsonar.javascript.lcov.reportPaths=src/main/webui/coverage/lcov.info \
-Dsonar.sources=src/main/java,src/test/java,src/main/webui/src