From 22b386951ada724ce8f37bc738d3fb5b6ac39dee Mon Sep 17 00:00:00 2001 From: lwih Date: Wed, 3 Jan 2024 18:03:50 +0100 Subject: [PATCH] Sonar - update setup for monorepo --- .github/workflows/release.yml | 4 +-- .github/workflows/sonarcloud.yml | 44 ++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4d8870cd..eebb817d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: "Release" on: - push: - branches: [ "main" ] + # push: + # branches: [ "main" ] release: types: [ published ] diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 233e0ebd..92b50226 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -40,34 +40,40 @@ permissions: pull-requests: read # allows SonarCloud to decorate PRs with analysis results jobs: - Analysis: + sonarcloudScan-backend: + name: SonarCloudScanBackend runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 with: - # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: backend/ + args: + -Dsonar.projectKey=MTES-MCT_rapportnav2 + -Dsonar.organization=mtes-mct - - name: Analyze with SonarCloud - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 + sonarcloudScan-frontend: + name: SonarCloudScanFrontend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} with: + projectBaseDir: frontend/ args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory -Dsonar.projectKey=MTES-MCT_rapportnav2 -Dsonar.organization=mtes-mct - # -Dsonar.scm.disabled=true - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - -Dsonar.verbose=true # optional, default is false + +