Skip to content

Commit

Permalink
Merge pull request #162 from AxonFramework/enhancement/gha-sonar
Browse files Browse the repository at this point in the history
Change how Sonar is invoked for GHAs
  • Loading branch information
smcvb committed Dec 15, 2021
2 parents 0c6bdd6 + 9138c42 commit 32529d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,21 @@ jobs:
restore-keys: |
${{ runner.os }}-maven
- name: Maven operation with Sonar
- name: Regular Build
run: |
./mvnw -B -U clean verify
- name: Sonar Analysis
if: matrix.sonar-enabled
run: |
mvn -B -U -Pcoverage \
clean verify \
sonar:sonar \
./mvnw -B -Pcoverage sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-amqp \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Sonatype
if: success()
run: |
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
sonar-enabled: false
- java-version: 11
sonar-enabled: true
fail-fast: false

steps:
- name: Checkout code
Expand All @@ -36,22 +37,17 @@ jobs:
restore-keys: |
${{ runner.os }}-maven
- name: Maven operation with Sonar
if: matrix.sonar-enabled
- name: Regular Build
run: |
mvn -B -U -Pcoverage \
clean verify \
sonar:sonar \
./mvnw -B -U clean verify
- name: Sonar Analysis
if: ${{ success() && matrix.sonar-enabled && github.event.pull_request.head.repo.full_name == github.repository }}
run: |
./mvnw -B -Pcoverage sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-amqp \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 32529d7

Please sign in to comment.