Skip to content

Commit

Permalink
Merge pull request #159 from AxonFramework/enhancement/gha-analysis
Browse files Browse the repository at this point in the history
Change how Sonar is invoked for GHA's
  • Loading branch information
smcvb committed Dec 10, 2021
2 parents 59551e7 + 91298ca commit 09b4194
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,18 @@ 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 sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-mongo \
-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()
Expand Down
22 changes: 8 additions & 14 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 # run both to the end

steps:
- name: Checkout code
Expand All @@ -36,22 +37,15 @@ 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 -Possrh clean verify
- name: Sonar Analysis
if: ${{ success() && matrix.sonar-enabled && github.event.pull_request.head.repo.full_name == github.repository }}
run: |
./mvnw -B sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-mongo \
-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 09b4194

Please sign in to comment.