Skip to content

Commit

Permalink
✅ [CI] Added Sonar analysis
Browse files Browse the repository at this point in the history
Signed-off-by: Alberto Codutti <[email protected]>
  • Loading branch information
Coduz committed Dec 13, 2024
1 parent e545dbb commit 0dcdeb9
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 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:
# Trigger analysis when pushing to your main branches, and when creating a pull request.
push:
branches:
- develop
- fix-sonarCloudAnalysisViagutHubActions
- 'releases/**'
pull_request:
types: [opened, synchronize, reopened]

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 org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -DskipTests -Dsonar.projectKey=eclipse_kapua -Dsonar.organization=eclipse-github

6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<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>

Expand Down Expand Up @@ -501,6 +502,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
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 0dcdeb9

Please sign in to comment.