Skip to content

SonarCloud Scan

SonarCloud Scan #15

Workflow file for this run

name: SonarCloud Scan
on:
push:
branches:
- main
paths:
- 'server/**'
- 'frontend/**'
workflow_dispatch: # add ability to run workflow.
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarQubeServer:
name: SonarQube Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Scan server
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # analysis token associated to your project
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
cd server/
./scripts/createServerKeys.sh
./gradlew build sonar --info
sonarQubeFrontend:
name: sonarQube Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Scan Frontend
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }} # analysis token associated to your project
SONAR_HOST_URL: ${{ secrets.SONAR_HOST }}
with:
projectBaseDir: frontend/