From c7bbb986a19a7faa733e0b2bcf8ea2951819bbf4 Mon Sep 17 00:00:00 2001 From: Miguel Matos Date: Sat, 17 Aug 2024 09:10:16 +0100 Subject: [PATCH] fix on sonar workflows --- .../{build.yml => build-backend.yml} | 21 +++++++++--- .github/workflows/build-frontend.yml | 33 +++++++++++++++++++ .../sonar-project.properties | 7 ++-- 3 files changed, 53 insertions(+), 8 deletions(-) rename .github/workflows/{build.yml => build-backend.yml} (58%) create mode 100644 .github/workflows/build-frontend.yml rename sonar-project.properties => frontend/sonar-project.properties (79%) diff --git a/.github/workflows/build.yml b/.github/workflows/build-backend.yml similarity index 58% rename from .github/workflows/build.yml rename to .github/workflows/build-backend.yml index 2796c76..bd688af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-backend.yml @@ -1,13 +1,24 @@ -name: Build +name: Build Frontend on: push: + paths: + - 'backend/**' + - '.github/workflows/**' branches: - main + pull_request: - types: [opened, synchronize, reopened] + paths: + - 'backend/**' + - '.github/workflows/**' + types: + - opened + - synchronize + - reopened + jobs: sonarcloud: - name: SonarCloud + name: SonarCloud Backend runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,6 +26,8 @@ jobs: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master + with: + projectBaseDir: backend env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }} diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml new file mode 100644 index 0000000..f385c48 --- /dev/null +++ b/.github/workflows/build-frontend.yml @@ -0,0 +1,33 @@ +name: Build Frontend +on: + push: + paths: + - 'frontend/**' + - '.github/workflows/**' + branches: + - main + + pull_request: + paths: + - 'frontend/**' + - '.github/workflows/**' + types: + - opened + - synchronize + - reopened + +jobs: + sonarcloud: + name: SonarCloud Frontend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + with: + projectBaseDir: frontend + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_FRONTEND }} diff --git a/sonar-project.properties b/frontend/sonar-project.properties similarity index 79% rename from sonar-project.properties rename to frontend/sonar-project.properties index 5cd5970..f22298f 100644 --- a/sonar-project.properties +++ b/frontend/sonar-project.properties @@ -1,13 +1,12 @@ -sonar.projectKey=d4d-backend +sonar.projectKey=d4d-frontend sonar.organization=aettua # This is the name and version displayed in the SonarCloud UI. -#sonar.projectName=d4d-backend +#sonar.projectName=d4d-frontend #sonar.projectVersion=1.0 - # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -#sonar.sources=. +sonar.sources=. # Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8