Must-share information (formatted with Markdown):
- sonar plugin for gradle
org.sonarqube
3.2.0
- Github action
- Get correct coverage result for Github Merge Queue
- Tried looking for a different settings for merge queue and normal PRs in both Github and Sonarcloud. Didn’t find any difference
In normal PR
the sonar cloud analysis result is correct. It posts the result from the branch made for PR and exclude the files that are configured in sonar cloud administration settings to exclude.
In merge queue
the sonar cloud analysis result comes from main where I believe it should come the temporary branch created by merge queue. No files are excluded for coverage.
Github action
We use this to run in github action
name: my workflow
on:
merge_group:
pull_request:
branches:
- main
jobs:
run_unit_tests:
- name: Run unit tests
run: bash ./gradlew clean testDevDebugUnitTest --scan
- name: generate-jacoco-coverage
run: bash ./gradlew jacocoTestReportMerged
- name: Upload Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
with:
name: jacoco-report
path: build/reports/jacoco/jacoco.xml
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube