formatting and coverage #316
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
name: SonarCloud Scan | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "server/**" | |
- "frontend/**" | |
- "screenshot/**" | |
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 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
run_install: true | |
- name: Run coverage | |
run: | | |
cd frontend | |
pnpm run coverage | |
- 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/ | |
sonarQubeScreenshot: | |
name: SonarQube Screenshot | |
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 screenshot | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # analysis token associated to your project | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | |
run: | | |
cd screenshot/ | |
./gradlew build sonar --info |