-
Notifications
You must be signed in to change notification settings - Fork 167
88 lines (81 loc) · 3.47 KB
/
sonar-scan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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