test against SonarQube 10.7 (#1040) #846
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
on: | |
push: | |
branches: | |
- master | |
- sq-10 | |
paths-ignore: | |
- '.github/actions/**' | |
pull_request_target: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/actions/**' | |
release: | |
types: | |
- created | |
# set necessary permissions for SQ's GitHub integration | |
# https://docs.sonarqube.org/latest/analysis/github-integration/#header-2 | |
permissions: | |
checks: write | |
contents: read | |
pull-requests: write | |
statuses: read | |
jobs: | |
build: | |
# Forked repos do not have access to the Sonar account | |
if: github.repository == 'spotbugs/sonar-findbugs' | |
runs-on: ubuntu-latest | |
env: | |
# previous LTS version | |
SONAR_SERVER_VERSION: 9.9.0.65466 | |
SONAR_PLUGIN_API_VERSION: 9.14.0.375 | |
steps: | |
- name: Decide the ref to check out | |
uses: haya14busa/action-cond@v1 | |
id: condval | |
with: | |
cond: ${{ github.event_name == 'pull_request_target' }} | |
if_true: refs/pull/${{ github.event.pull_request.number }}/merge | |
if_false: ${{ github.ref }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ steps.condval.outputs.value }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: 'maven' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Build | |
run: | | |
./mvnw org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -B -e -V -DskipITs \ | |
-Dsonar.server.version=${{ env.SONAR_SERVER_VERSION }} \ | |
-Dsonar-plugin-api.version=${{ env.SONAR_PLUGIN_API_VERSION }} \ | |
-Dsonar.projectKey=com.github.spotbugs:sonar-findbugs-plugin \ | |
-Dsonar.organization=spotbugs \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.login=$SONAR_LOGIN \ | |
${PR_NUMBER:+ -Dsonar.pullrequest.key=$PR_NUMBER -Dsonar.pullrequest.branch=$PR_BRANCH } | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
PR_BRANCH: ${{ github.event.pull_request.head.ref }} | |
CI: true |