Skip to content

Commit 55cacb8

Browse files
committed
add: sonarcloud
1 parent efca3ff commit 55cacb8

File tree

10 files changed

+55
-0
lines changed

10 files changed

+55
-0
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: SonarCloud
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
build:
10+
name: Build and analyze
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v3
18+
with:
19+
java-version: 17
20+
distribution: 'zulu' # Alternative distribution options are available.
21+
- name: Cache SonarCloud packages
22+
uses: actions/cache@v3
23+
with:
24+
path: ~/.sonar/cache
25+
key: ${{ runner.os }}-sonar
26+
restore-keys: ${{ runner.os }}-sonar
27+
- name: Cache Maven packages
28+
uses: actions/cache@v3
29+
with:
30+
path: ~/.m2
31+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: ${{ runner.os }}-m2
33+
- name: Build and analyze
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
36+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=hoangtien2k3_ecommerce-microservices

api-gateway/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

discovery-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

favourite-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

inventory-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

notification-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

order-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

payment-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

product-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

user-service/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<properties>
1717
<java.version>17</java.version>
1818
<spring-cloud.version>2021.0.8</spring-cloud.version>
19+
<sonar.organization>hoangtien2k3</sonar.organization>
20+
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
1921
</properties>
2022
<dependencies>
2123
<dependency>

0 commit comments

Comments
 (0)