SongodaCore/.github/workflows/sonarcloud.yml

45 lines
1.0 KiB
YAML
Raw Normal View History

2021-10-30 15:22:23 +02:00
name: SonarCloud
on:
push:
branches: [ master, development, development-v3 ]
2021-10-30 15:22:23 +02:00
pull_request:
types: [ opened, synchronize, reopened ]
permissions: read-all
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: songoda_SongodaCore
2021-10-30 15:22:23 +02:00
jobs:
Analyze:
2021-10-30 15:22:23 +02:00
runs-on: ubuntu-latest
2021-10-30 15:22:23 +02:00
steps:
- uses: actions/checkout@v3
if: ${{ env.SONAR_TOKEN != null }}
2021-10-30 15:22:23 +02:00
with:
fetch-depth: 0
2021-10-30 15:22:23 +02:00
- name: Prepare Workspace
if: ${{ env.SONAR_TOKEN != null }}
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 }}
uses: actions/cache@v3
2021-10-30 15:22:23 +02:00
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
2021-10-30 15:22:23 +02:00
- name: Analyze project
if: ${{ env.SONAR_TOKEN != null }}
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}