57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: SonarQube Analysis
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
analyze:
|
|
name: Build and Analyze
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
image: node:24
|
|
options: --network pg_network
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
|
with:
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
|
|
|
- name: Set up JDK 25
|
|
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
|
|
with:
|
|
java-version: "25"
|
|
distribution: "zulu" # Alternative distribution options are available.
|
|
|
|
- name: Cache SonarQube packages
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.sonar/cache
|
|
key: ${{ runner.os }}-sonar
|
|
restore-keys: ${{ runner.os }}-sonar
|
|
|
|
- name: Cache Gradle packages
|
|
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
|
with:
|
|
path: ~/.gradle/caches
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.gradle.kts*') }}
|
|
restore-keys: ${{ runner.os }}-gradle
|
|
|
|
- name: Make Gradle Executable
|
|
run: chmod +x ./gradlew
|
|
working-directory: backend
|
|
|
|
- name: Build and Analyze
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
run: ./gradlew build sonar --info
|
|
working-directory: backend
|