File tree Expand file tree Collapse file tree 3 files changed +43
-8
lines changed
Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 1+ name : SonarCloud for Video Service
2+ on :
3+ workflow_call :
4+ secrets :
5+ SONAR_TOKEN :
6+ required : true
7+ jobs :
8+ sonar_cloud_scan :
9+ name : Build and analyze
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v3
13+ with :
14+ fetch-depth : 0 # Shallow clones should be disabled for a better relevancy of analysis
15+ - name : Set up JDK 17
16+ uses : actions/setup-java@v3
17+ with :
18+ java-version : 17
19+ distribution : ' zulu' # Alternative distribution options are available.
20+ - name : Cache SonarCloud packages
21+ uses : actions/cache@v3
22+ with :
23+ path : ~/.sonar/cache
24+ key : ${{ runner.os }}-sonar
25+ restore-keys : ${{ runner.os }}-sonar
26+ - name : Cache Maven packages
27+ uses : actions/cache@v3
28+ with :
29+ path : ~/.m2
30+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
31+ restore-keys : ${{ runner.os }}-m2
32+ - name : Build and analyze
33+ env :
34+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
35+ run : mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=DevOps-Video-Sharing_VideoService
Original file line number Diff line number Diff line change @@ -26,14 +26,12 @@ jobs:
2626 - name : Unit Tests
2727 run : mvn -B test --file pom.xml
2828
29- # - name: SonarQube Scan
30- # env:
31- # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
32- # run: mvn org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar \
33- # -Dsonar.projectKey=devops-video-sharing \
34- # -Dsonar.host.url=https://sonarcloud.io \
35- # -Dsonar.login=${{ secrets.SONAR_TOKEN }}
36-
29+ sonar_cloud_scan :
30+ needs : testing
31+ uses : ./.github/workflows/SonarQube.yaml
32+ secrets :
33+ SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
34+
3735 build-image :
3836 needs : testing
3937 uses : ./.github/workflows/build-image.yaml
Original file line number Diff line number Diff line change 1515 <description >Demo project for Spring Boot</description >
1616 <properties >
1717 <java .version>17</java .version>
18+ <sonar .organization>devops-video-sharing</sonar .organization>
19+ <sonar .host.url>https://sonarcloud.io</sonar .host.url>
1820 </properties >
1921 <dependencies >
2022 <dependency >
You can’t perform that action at this time.
0 commit comments