Add Sonar analysis #151
Workflow file for this run
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
name: Pull Request | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
- 'hotfix/v*.*.*' | |
jobs: | |
build-jar: | |
name: Build JAR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Cache SonarQube packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Check style | |
run: mvn checkstyle:check | |
- name: Build and test | |
run: mvn clean package | |
- name: Publish test report | |
if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: '**/target/surefire-reports/TEST-*.xml' | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docsource-jar | |
path: target/docsource.jar | |
- name: Sonar | |
if: env.SONAR_TOKEN != '' | |
run: mvn verify sonar:sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Docker | |
run: mvn clean package -DskipTests jib:dockerBuild | |
build-native: | |
name: Build Native Image ${{ matrix.platform }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] | |
include: | |
- os: 'ubuntu-latest' | |
platform: 'linux-amd64' | |
extension: '' | |
- os: 'macos-latest' | |
platform: 'darwin-arm64' | |
extension: '' | |
- os: 'windows-latest' | |
platform: 'windows-amd64' | |
extension: '.exe' | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: 'graalvm' | |
java-version: '21.0.1' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Check style | |
run: mvn checkstyle:check | |
- name: Build and test | |
run: mvn clean package -Pnative -PnativeTest | |
- name: Publish native test report | |
if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: '**/target/native-test-reports/TEST-*.xml' | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docsource-${{ matrix.platform }} | |
path: target/docsource${{ matrix.extension }} | |
- name: Docker | |
if: matrix.os == 'ubuntu-latest' | |
run: mvn clean package -DskipTests -Pnative jib:dockerBuild |