2021-10-30 15:22:23 +02:00
|
|
|
name: SonarCloud
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master, development ]
|
|
|
|
pull_request:
|
|
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
|
2022-08-07 19:33:38 +02:00
|
|
|
permissions: read-all
|
|
|
|
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
SONAR_PROJECT_KEY: songoda_SongodaCore
|
|
|
|
|
2021-10-30 15:22:23 +02:00
|
|
|
jobs:
|
2022-08-07 19:33:38 +02:00
|
|
|
Analyze:
|
2021-10-30 15:22:23 +02:00
|
|
|
runs-on: ubuntu-latest
|
2022-04-27 21:42:15 +02:00
|
|
|
|
2021-10-30 15:22:23 +02:00
|
|
|
steps:
|
2022-08-07 19:33:38 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-02 22:50:31 +01:00
|
|
|
if: ${{ env.SONAR_TOKEN != null }}
|
2021-10-30 15:22:23 +02:00
|
|
|
with:
|
2022-08-07 19:33:38 +02:00
|
|
|
fetch-depth: 0
|
2021-10-30 15:22:23 +02:00
|
|
|
|
2022-08-07 19:33:38 +02:00
|
|
|
- name: Prepare Workspace
|
2022-01-02 22:50:31 +01:00
|
|
|
if: ${{ env.SONAR_TOKEN != null }}
|
2022-08-07 19:33:38 +02:00
|
|
|
uses: ./.github/actions/setup_project_workspace
|
2022-03-18 14:32:20 +01:00
|
|
|
|
2021-10-30 15:22:23 +02:00
|
|
|
- name: 'Cache: SonarCloud'
|
2022-03-18 14:32:20 +01:00
|
|
|
if: ${{ env.SONAR_TOKEN != null }}
|
2022-08-07 19:33:38 +02:00
|
|
|
uses: actions/cache@v3
|
2021-10-30 15:22:23 +02:00
|
|
|
with:
|
|
|
|
path: ~/.sonar/cache
|
|
|
|
key: ${{ runner.os }}-sonar
|
|
|
|
- name: Analyze project
|
2022-01-02 22:50:31 +01:00
|
|
|
if: ${{ env.SONAR_TOKEN != null }}
|
2022-08-07 19:33:38 +02:00
|
|
|
run: >
|
|
|
|
mvn -B \
|
|
|
|
verify \
|
|
|
|
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
|
|
|
|
"-Dsonar.projectKey=$SONAR_PROJECT_KEY"
|
2021-10-30 15:22:23 +02:00
|
|
|
env:
|
2022-08-07 19:33:38 +02:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|