Sonar Check #87
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
# Perform sonar check after pull requests and updates to the main branch have been completed | |
# Has to be a separate workflow so that it uses the secrets of the main repository | |
name: Sonar Check | |
on: | |
workflow_run: | |
workflows: [ "Check PR" ] | |
types: | |
- completed | |
jobs: | |
sonar-check: | |
timeout-minutes: 20 | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Cache Gradle packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: ${{ runner.os }}-gradle | |
- name: Sonar Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew build sonar --info | |
- name: Upload Test Data | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: test-results | |
path: '**/test-results/**/*.xml' |