Skip to content

build: test against SonarQube 10.2.1 (#734) #399

build: test against SonarQube 10.2.1 (#734)

build: test against SonarQube 10.2.1 (#734) #399

Workflow file for this run

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-20.04
env:
# previous LTS version
SONAR_SERVER_VERSION: 8.9.9.56886
SONAR_PLUGIN_API_VERSION: 8.9.9.56886
SONAR_PLUGIN_API_GROUPID: org.sonarsource.sonarqube
SONAR_JAVA_VERSION: 6.15.1.26025
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@v3
with:
fetch-depth: 0
ref: ${{ steps.condval.outputs.value }}
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: |
~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build
run: |
mvn 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-plugin-api.groupId=${{ env.SONAR_PLUGIN_API_GROUPID }} \
-Dsonar-java.version=${{ env.SONAR_JAVA_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