Skip to content

Commit f373686

Browse files
committed
ci: add sonarCloud GitHub Action for Java
1 parent bcffe4e commit f373686

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/sonarCloud.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
build:
13+
name: SonarCloud Analysis
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: 'temurin'
24+
java-version: '21'
25+
26+
- name: Cache Sonar packages
27+
uses: actions/cache@v4
28+
with:
29+
path: ~/.sonar/cache
30+
key: ${{ runner.os }}-sonar
31+
restore-keys: ${{ runner.os }}-sonar
32+
33+
- name: Cache Maven packages
34+
uses: actions/cache@v4
35+
with:
36+
path: |
37+
~/.m2/repository
38+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
39+
restore-keys: ${{ runner.os }}-maven
40+
41+
- name: SonarCloud Scan
42+
run: mvn verify sonar:sonar -DskipTests \
43+
-Dsonar.projectKey=felipemelozx_TrackMoney \
44+
-Dsonar.organization=felipemelozx-trackmoney \
45+
-Dsonar.host.url=https://sonarcloud.io \
46+
-Dsonar.login=${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)