From 72b4be5ca2db0d12843f6ae57d0ea774b004f12a Mon Sep 17 00:00:00 2001 From: AlbertoML1999 <146851709+AlbertoML1999@users.noreply.github.com> Date: Sun, 25 Jan 2026 13:07:52 +0100 Subject: [PATCH] Enhance CI with SonarQube analysis for backend and frontend Added SonarQube analysis steps for both backend and frontend. --- .github/workflows/basic.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index d7827b5..85873a7 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -5,6 +5,7 @@ on: push: branches: - 'feature/**' + - 'fix/**' jobs: @@ -23,6 +24,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up JDK 21 uses: actions/setup-java@v4 with: @@ -32,6 +35,20 @@ jobs: run: | cd backend mvn clean verify -Dtest="es.goeventsnow.backend.unit.EventTest" + + - name: SonarQube Analysis (Backend) + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd backend + mvn sonar:sonar \ + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} \ + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY_BACKEND }} \ + -Dsonar.projectName="2025-GoEventsNow Backend" \ + -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ + -Dsonar.login=${{ secrets.SONAR_TOKEN }} client-quality: name: Client - Basic CI @@ -39,6 +56,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Node.js 20 uses: actions/setup-node@v4 with: @@ -57,3 +76,19 @@ jobs: run: | cd frontend npx ng test --include=src/app/app.component.spec.ts --coverage + - name: SonarQube Analysis (Frontend) + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd frontend + npx sonar-scanner \ + -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} \ + -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY_FRONTEND }} \ + -Dsonar.projectName="2025-GoEventsNow Frontend" \ + -Dsonar.sources=src \ + -Dsonar.host.url=${{ secrets.SONAR_HOST_URL }} \ + -Dsonar.login=${{ secrets.SONAR_TOKEN }} \ + -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info +