-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #607 from ehrbase/feature/fix-github-action-sonar-…
…access Add sonar analyses as workflow_run
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: "Report Sonar Results" | ||
|
||
# we have multiple workflows - this helps to distinguish for them | ||
run-name: "${{ github.event.pull_request.title && github.event.pull_request.title || github.ref_name }} - Report Sonar Results" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build & Test"] # runs after build and test workflow | ||
types: | ||
- completed | ||
|
||
jobs: | ||
# | ||
# Collect Junit reports generated by build_and_test | ||
# | ||
collect-junit-reports: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Download jacoco overall coverage from build & test output | ||
- name: Download - Jacoco Overall Coverage | ||
uses: actions/download-artifact@v4 | ||
with: | ||
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
run-id: ${{ github.event.workflow_run.id }} # download artifacts from build and test workflow | ||
pattern: jacoco-coverage-overall # uses artifact of build and test workflow | ||
merge-multiple: true | ||
path: ./ | ||
|
||
- name: Sonar - Analyze | ||
# Dependabot has no access to the SONAR_TOKEN secret, so we need to skip sonar. | ||
# if: ${{ github.actor != 'dependabot[bot]' && github.repository_owner == 'ehrbase' }} | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
run: | | ||
mvn --batch-mode sonar:sonar \ | ||
-Dsonar.host.url=https://sonarcloud.io \ | ||
-Dsonar.organization=ehrbase \ | ||
-Dsonar.projectKey=ehrbase_openEHR_SDK \ | ||
-Dsonar.exclusions=test/** \ | ||
-Dsonar.coverage.exclusions=test/**,test-data/**/*,opt-14/**/*,response-dto/**/* \ | ||
-Dsonar.coverage.jacoco.xmlReportPaths=${{ github.workspace }}/test-coverage/target/site/jacoco-overall-coverage/jacoco.xml |