Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how Sonar is invoked for GHAs #162

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 }}