Przeglądaj źródła

Add sonar cloud check (#269)

* Update sonar.yaml

Fix scan only kafka-ui-react-app

* Update pom.xml

Add sonar cloud properties

* Update sonar.yaml

Change scan sonar cloud by maven

* include sonar scan to backend build job

* remove projectname from pom.xml
Dmitriy Kharlamov 4 lat temu
rodzic
commit
7a8417e0d1
3 zmienionych plików z 13 dodań i 22 usunięć
  1. 11 2
      .github/workflows/backend.yml
  2. 0 20
      .github/workflows/sonar.yaml
  3. 2 0
      pom.xml

+ 11 - 2
.github/workflows/backend.yml

@@ -23,5 +23,14 @@ jobs:
       uses: actions/setup-java@v1
       with:
         java-version: 1.13
-    - name: Build with Maven
-      run: mvn clean package -Pprod
+    - name: Cache SonarCloud packages
+      uses: actions/cache@v1
+      with:
+        path: ~/.sonar/cache
+        key: ${{ runner.os }}-sonar
+        restore-keys: ${{ runner.os }}-sonar
+    - name: Build and analyze
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
+        SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+      run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar    

+ 0 - 20
.github/workflows/sonar.yaml

@@ -1,20 +0,0 @@
-name: Build
-on:
-  push:
-    branches:
-      - master
-  pull_request:
-    types: [opened, synchronize, reopened]
-jobs:
-  sonarcloud:
-    name: SonarCloud
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-        with:
-          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
-      - name: SonarCloud Scan
-        uses: SonarSource/sonarcloud-github-action@master
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
-          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

+ 2 - 0
pom.xml

@@ -40,6 +40,8 @@
 		<assertj.version>3.19.0</assertj.version>
 
 		<frontend-generated-sources-directory>..//kafka-ui-react-app/src/generated-sources</frontend-generated-sources-directory>
+		<sonar.organization>provectus</sonar.organization>
+		<sonar.host.url>https://sonarcloud.io</sonar.host.url>
 	</properties>
 
 	<repositories>