Skip to content

Test against sonarqube 25.7 #299

Test against sonarqube 25.7

Test against sonarqube 25.7 #299

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '17', '21' ]
name: Unit tests Java ${{ matrix.Java }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.Java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.Java }}
cache: 'maven'
- name: Build and Test
run: mvn -B test
integration-tests:
name: Integration tests
runs-on: ${{ matrix.os }}
needs: unit-tests
strategy:
fail-fast: false
matrix:
include:
# 9.9 LTS
- SONAR_SERVER_VERSION: 9.9.9.104369
SONAR_PLUGIN_API_VERSION: 9.14.0.375
SONAR_PLUGIN_API_GROUPID: org.sonarsource.api.plugin
SONAR_SERVER_JAVA_VERSION: 17
os: ubuntu-latest
# 10.x
- SONAR_SERVER_VERSION: 10.4.0.87286
SONAR_SERVER_JAVA_VERSION: 17
os: ubuntu-latest
- SONAR_SERVER_VERSION: 10.7.0.96327
SONAR_SERVER_JAVA_VERSION: 17
os: ubuntu-latest
# 25.x
- SONAR_SERVER_VERSION: 25.7.0.110598
SONAR_SERVER_JAVA_VERSION: 17
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.SONAR_SERVER_JAVA_VERSION }}
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: |
~/.sonar/cache
~/.sonar/orchestrator/cache
key: ${{ runner.os }}-sonar-${{ matrix.SONAR_SERVER_VERSION }}
restore-keys: ${{ runner.os }}-sonar-${{ matrix.SONAR_SERVER_VERSION }}
- name: Build and Test
env:
SONAR_SCANNER_JAVA_OPTS: >
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED
run: >
mvn -B verify
-Dsonar.server.version=${{ matrix.SONAR_SERVER_VERSION }}
build:
name: Build
runs-on: ubuntu-latest
needs: integration-tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
server-id: central
server-username: SONATYPE_USERNAME
server-password: SONATYPE_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: |
~/.sonar/cache
key: ${{ runner.os }}-sonarcloud
restore-keys: ${{ runner.os }}-sonarcloud
- name: Build and analyze
run: mvn -B test org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=erroraway_sonar-erroraway-plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Deploy artifacts to Maven Central
run: mvn deploy -B -e -P deploy -DskipTests
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}