Skip to content

Commit 0ccea80

Browse files
authored
Merge pull request #168 from AxonFramework/enhancement/gha-sonar
Change how Sonar is invoked for GHAs
2 parents cafc799 + 44a2eca commit 0ccea80

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,21 @@ jobs:
4040
restore-keys: |
4141
${{ runner.os }}-maven
4242
43-
- name: Maven operation with Sonar
43+
- name: Regular Build
44+
run: |
45+
./mvnw -B -U clean verify
46+
47+
- name: Sonar Analysis
4448
if: matrix.sonar-enabled
4549
run: |
46-
mvn -B -U -Pcoverage \
47-
clean verify \
48-
sonar:sonar \
50+
./mvnw -B -Pcoverage sonar:sonar \
4951
-Dsonar.projectKey=AxonFramework_extension-kotlin \
5052
-Dsonar.organization=axonframework \
5153
-Dsonar.host.url=https://sonarcloud.io \
5254
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
5355
env:
5456
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5557

56-
- name: Maven operation without Sonar
57-
if: matrix.sonar-enabled != true
58-
run: |
59-
mvn -B -U clean verify
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
6358
- name: Deploy to Sonatype
6459
if: success()
6560
run: |

.github/workflows/pullrequest.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
sonar-enabled: false
1515
- java-version: 11
1616
sonar-enabled: true
17+
fail-fast: false
1718

1819
steps:
1920
- name: Checkout code
@@ -36,22 +37,17 @@ jobs:
3637
restore-keys: |
3738
${{ runner.os }}-maven
3839
39-
- name: Maven operation with Sonar
40-
if: matrix.sonar-enabled
40+
- name: Regular Build
4141
run: |
42-
mvn -B -U -Pcoverage \
43-
clean verify \
44-
sonar:sonar \
42+
./mvnw -B -U clean verify
43+
44+
- name: Sonar Analysis
45+
if: ${{ success() && matrix.sonar-enabled && github.event.pull_request.head.repo.full_name == github.repository }}
46+
run: |
47+
./mvnw -B -Pcoverage sonar:sonar \
4548
-Dsonar.projectKey=AxonFramework_extension-kotlin \
4649
-Dsonar.organization=axonframework \
4750
-Dsonar.host.url=https://sonarcloud.io \
4851
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
4952
env:
5053
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
52-
- name: Maven operation without Sonar
53-
if: matrix.sonar-enabled != true
54-
run: |
55-
mvn -B -U clean verify
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)