Skip to content

Commit

Permalink
[FIX] Fix sonarcloud workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
asteriskzie committed May 18, 2024
1 parent f3c9895 commit 5b315ac
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ name: SonarCloud analysis

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
workflow_dispatch:
branches:
- "**"

permissions:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
Expand All @@ -43,11 +41,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Analyze with SonarCloud
- name: Check out the Git repository
uses: actions/checkout@v4

- name: Set up Java toolchain
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "gradle"

- name: Build
run: ./gradlew build

- name: Analyze with SonarCloud
# You can pin the exact commit or the version.
# uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret)
Expand All @@ -58,11 +68,14 @@ jobs:
# mandatory
-Dsonar.projectKey=ADPRO-C11_snackscription-review
-Dsonar.organization=adpro-c11
-Dsonar.java.binaries=.
-Dsonar.sources=src/main/java
-Dsonar.tests=src/test/java
# Comma-separated paths to directories containing main source files.
#-Dsonar.sources= # optional, default is project base directory
# When you need the analysis to take place in a directory other than the one from which it was launched
#-Dsonar.projectBaseDir= # optional, default is .
# Comma-separated paths to directories containing test source files.
#-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/
# Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing.
#-Dsonar.verbose= # optional, default is false
#-Dsonar.verbose= # optional, default is false

0 comments on commit 5b315ac

Please sign in to comment.