diff --git a/.github/workflows/staging-deploy-action.yml b/.github/workflows/staging-deploy-action.yml
index d63e2162b3..f1d6855042 100644
--- a/.github/workflows/staging-deploy-action.yml
+++ b/.github/workflows/staging-deploy-action.yml
@@ -242,10 +242,28 @@ jobs:
--form "projectVersion=latest" \
--form "bom=@sbom.xml"
- clean-up:
- needs: [generate-and-push-sbom]
+ sonarqube:
runs-on: ubuntu-latest
-
+ needs: [upload-to-quay]
steps:
- - name: remove dockers
- run: docker ps -aq | xargs -r docker rm -f
\ No newline at end of file
+ - uses: actions/checkout@v4
+
+ - name: Set up JDK ${{ vars.JAVA_VERSION }}
+ uses: actions/setup-java@v4
+ with:
+ java-version: ${{ vars.JAVA_VERSION }}
+ distribution: 'temurin'
+
+ - name: Set up node ${{ vars.NODE_VERSION }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ vars.NODE_VERSION }}
+
+ - name: Install frontend dependencies
+ run: cd frontend && npm ci
+
+ - name: Generate frontend test coverage
+ run: cd frontend && npm run test -- --coverage
+
+ - name: Build and analyze
+ run: mvn clean verify sonar:sonar -Dsonar.login=${{ secrets.SONAR_TOKEN }} -Dsonar.host.url=${{vars.SONAR_HOST_URL}}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 678f62ef45..1ecd646478 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,9 +26,9 @@ hs_err_pid*
/.idea/
parent.iml
backend/backend.iml
-sonar-project.properties
.scannerwork
/frontend/cypress/downloads/
/frontend/cypress/screenshots/
/toolchains.xml
/backend/src/main/resources/db/okr_schema.sql
+**/sonar/
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 028f661865..c16e93cdb6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,8 +29,35 @@
UTF-8
+
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ 1.2.1
+
+
+ clean
+
+ read-project-properties
+
+
+
+ sonar-project.properties
+
+
+ false
+
+
+
+
+
+
+ org.sonarsource.scanner.maven
+ sonar-maven-plugin
+ 5.0.0.4389
+
com.fizzed
fizzed-watcher-maven-plugin
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 0000000000..1eff0daefe
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,14 @@
+sonar.projectKey=Puzzle-OKR
+sonar.projectName=Puzzle-OKR
+
+#For local usage only, on the pipeline the following server is used: https://sonar-githubactions.puzzle.ch
+sonar.host.url=https://sonar.puzzle.ch
+
+
+sonar.test.exclusions=backend/src/test/**/*, frontend/src/app/**/*.spec.ts, frontend/src/app/**/*.scss, frontend/src/app/**/*.html
+
+sonar.sources=frontend/src/app
+
+sonar.coverage.exclusions=**/OkrApplication.java
+sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco-merged-test-coverage-report/jacoco.xml
+sonar.javascript.lcov.reportPaths=frontend/coverage/lcov.info