Skip to content

Commit

Permalink
Merge pull request #4156 from Coduz/fix-sonarCloudAnalysisViagutHubAc…
Browse files Browse the repository at this point in the history
…tions

✅ [CI] Added Sonar analysis
  • Loading branch information
Coduz authored Dec 13, 2024
2 parents e545dbb + 63d9783 commit 9abe47c
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 13 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/sonarCloud-scan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Sonar Scan

on:
push:
branches:
- 'develop'
- 'release-**'
pull_request:
branches:
- 'develop'
- 'release-**'

jobs:
build:
name: Analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- name: Set up Node 16
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files
run: 'npm install -g @apidevtools/swagger-cli'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B compile -PsonarScan

4 changes: 2 additions & 2 deletions commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<version>${mapstruct.version}</version>
</path>
<!-- other annotation processors -->
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${org.hibernate.hibernate-jpamodelgen.version}</version>
<version>${hibernate-jpamodelgen.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
Expand Down
42 changes: 35 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<commons-logging.version>1.2</commons-logging.version>
<commons-pool.version>2.3</commons-pool.version>
<compress-lzf.version>1.0.3</compress-lzf.version>
<cucumber.version>6.11.0</cucumber.version>
<!-- Do NOT bump eclipselink further than this version. For details, see issue: https://github.com/eclipse/kapua/issues/3955 -->
<eclipselink.version>2.7.12</eclipselink.version>
<dropwizard-metrics.version>3.2.2</dropwizard-metrics.version>
Expand All @@ -82,6 +83,7 @@
<guice.version>5.1.0</guice.version>
<hamcrest-core.version>2.2</hamcrest-core.version>
<h2.version>1.4.200</h2.version>
<hibernate-jpamodelgen.version>5.5.4.Final</hibernate-jpamodelgen.version>
<hikaricp.version>4.0.3</hikaricp.version>
<hk2-api.version>2.6.1</hk2-api.version>
<httpcomponents-asyncclient.version>4.1.5</httpcomponents-asyncclient.version>
Expand All @@ -96,7 +98,6 @@
<javax-json.version>1.0.4</javax-json.version>
<javax-persistence.version>2.1.1</javax-persistence.version>
<javax-servlet-api.version>3.1.0</javax-servlet-api.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<javax-validation-api.version>2.0.1.Final</javax-validation-api.version>
<jakarta-ws-rs-api.version>2.1.6</jakarta-ws-rs-api.version>
<jakarta-xml-bind-api.version>2.3.3</jakarta-xml-bind-api.version>
Expand All @@ -115,6 +116,7 @@
<log4j-api.version>2.17.1</log4j-api.version>
<log4j2-mock.version>0.0.2</log4j2-mock.version>
<logback.version>1.5.12</logback.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<mockito.version>1.10.19</mockito.version>
<netty.version>4.1.114.Final</netty.version>
<netty3.version>3.10.6.Final</netty3.version>
Expand All @@ -134,9 +136,6 @@
<swagger-ui.version>5.3.1</swagger-ui.version>
<zxing.version>3.4.1</zxing.version>

<cucumber.version>6.11.0</cucumber.version>
<spotify.version>8.15.1</spotify.version>

<!-- Plugins versions -->
<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
<maven-assembly-plugin.version>3.0.0</maven-assembly-plugin.version>
Expand Down Expand Up @@ -169,15 +168,18 @@
<karaf-maven-plugin.version>4.4.2</karaf-maven-plugin.version>
<license-maven-plugin.version>1.9</license-maven-plugin.version>
<nexus-staging-maven-plugin.version>1.6.5</nexus-staging-maven-plugin.version>
<sonar-maven-plugin.version>5.0.0.4389</sonar-maven-plugin.version>
<sql-maven-plugin.version>1.5</sql-maven-plugin.version>
<surefire.version>3.0.0-M7</surefire.version>

<org.hibernate.hibernate-jpamodelgen.version>5.5.4.Final</org.hibernate.hibernate-jpamodelgen.version>
<!-- Docker configuration -->
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<timestamp>${maven.build.timestamp}</timestamp>

<!-- Sonar Configuration-->
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.projectKey>eclipse_kapua</sonar.projectKey>
<sonar.organization>eclipse-github</sonar.organization>
</properties>

<build>
Expand Down Expand Up @@ -501,6 +503,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${sonar-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>

Expand Down Expand Up @@ -2084,7 +2091,7 @@
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
<version>${mapstruct.version}</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -2647,7 +2654,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${org.hibernate.hibernate-jpamodelgen.version}</version>
<version>${hibernate-jpamodelgen.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -2837,6 +2844,27 @@
</plugins>
</build>
</profile>

<profile>
<id>sonarScan</id>
<build>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

</profiles>

<licenses>
Expand Down
4 changes: 2 additions & 2 deletions service/account/internal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<version>${mapstruct.version}</version>
</path>
<!-- other annotation processors -->
<path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${org.hibernate.hibernate-jpamodelgen.version}</version>
<version>${hibernate-jpamodelgen.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
Expand Down
2 changes: 0 additions & 2 deletions simulator-kura/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
<groupId>org.eclipse.kapua</groupId>
<artifactId>kapua</artifactId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>

<artifactId>kapua-simulator-kura</artifactId>
<description>This is a framework for simulating Eclipse Kura IoT gateway instances</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<docker.account>kapua</docker.account>
<osgi.version>6.0.0</osgi.version>
</properties>
Expand Down

0 comments on commit 9abe47c

Please sign in to comment.