2021-07-01 14:47:30 +00:00
|
|
|
name: SonarCloud Scanner
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
|
2022-05-08 01:00:37 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-07-01 14:47:30 +00:00
|
|
|
jobs:
|
|
|
|
scan:
|
|
|
|
|
|
|
|
name: SonarCloud Scanner
|
|
|
|
runs-on: ubuntu-latest
|
2021-07-06 10:55:15 +00:00
|
|
|
|
2021-07-04 11:18:47 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
|
2021-07-01 14:47:30 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2023-09-30 10:51:46 +00:00
|
|
|
uses: actions/checkout@v4.1.0
|
2021-07-01 14:47:30 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-01-16 13:17:50 +00:00
|
|
|
- name: Set up JDK 17
|
2023-09-30 10:48:21 +00:00
|
|
|
uses: actions/setup-java@v3.13.0
|
2021-07-01 14:47:30 +00:00
|
|
|
with:
|
|
|
|
distribution: 'adopt'
|
2022-01-16 13:17:50 +00:00
|
|
|
java-version: '17'
|
2021-12-17 16:54:36 +00:00
|
|
|
java-package: jdk
|
|
|
|
architecture: x64
|
2021-07-01 14:47:30 +00:00
|
|
|
|
|
|
|
- name: Cache SonarCloud packages
|
2022-04-01 12:19:18 +00:00
|
|
|
uses: actions/cache@v3
|
2021-07-01 14:47:30 +00:00
|
|
|
with:
|
|
|
|
path: ~/.sonar/cache
|
|
|
|
key: ${{ runner.os }}-sonar
|
|
|
|
restore-keys: ${{ runner.os }}-sonar
|
|
|
|
|
|
|
|
- name: Cache Maven packages
|
2022-04-01 12:19:18 +00:00
|
|
|
uses: actions/cache@v3
|
2021-07-01 14:47:30 +00:00
|
|
|
with:
|
|
|
|
path: ~/.m2
|
|
|
|
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
|
|
|
restore-keys: ${{ runner.os }}-m2
|
|
|
|
|
|
|
|
- name: SonarCloud analysis
|
|
|
|
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
|
2021-07-06 10:55:15 +00:00
|
|
|
if: ${{ env.SONAR_TOKEN != 0 }}
|