From bc948be4bdcd5ce89b4253f5b24fab9edee41a52 Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 13:31:18 +0200 Subject: [PATCH 1/6] add sonar workflow --- .github/workflows/sonarcloud.yml | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..6e1965f --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,42 @@ +name: SonarCloud Analysis + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build-and-analyze: + name: Build and Analyze on SonarCloud + runs-on: ubuntu-latest + + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install SonarScanner + run: dotnet tool install --global dotnet-sonarscanner + + - name: Install dependencies + run: dotnet restore + + - name: Begin SonarCloud Analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + dotnet sonarscanner begin /k:"faura" /o:"JosepFe" /d:sonar.login="${SONAR_TOKEN}" /d:sonar.host.url="https://sonarcloud.io" + + - name: Build solution + run: dotnet build --no-restore + + - name: End SonarCloud Analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}" From bc8b1c1bc0315468403e428afca1803ca3ebd4cd Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 15:40:59 +0200 Subject: [PATCH 2/6] update workflow --- .github/workflows/sonarcloud.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 6e1965f..0d8a8e2 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -24,8 +24,8 @@ jobs: - name: Install SonarScanner run: dotnet tool install --global dotnet-sonarscanner - - name: Install dependencies - run: dotnet restore + - name: Restore dependencies + run: dotnet restore src/Faura.sln - name: Begin SonarCloud Analysis env: @@ -33,8 +33,18 @@ jobs: run: | dotnet sonarscanner begin /k:"faura" /o:"JosepFe" /d:sonar.login="${SONAR_TOKEN}" /d:sonar.host.url="https://sonarcloud.io" + - name: Begin SonarCloud Analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + dotnet sonarscanner begin \ + /k:"faura" \ + /o:"JosepFe" \ + /d:sonar.login="${SONAR_TOKEN}" \ + /d:sonar.host.url="https://sonarcloud.io" + - name: Build solution - run: dotnet build --no-restore + run: dotnet build src/Faura.sln --no-restore --no-incremental - name: End SonarCloud Analysis env: From 0a55d7d030a3f30e4b5279a4d39474c3b7c28335 Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 15:43:56 +0200 Subject: [PATCH 3/6] update organization key --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 0d8a8e2..484c221 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -39,7 +39,7 @@ jobs: run: | dotnet sonarscanner begin \ /k:"faura" \ - /o:"JosepFe" \ + /o:"josepfe" \ /d:sonar.login="${SONAR_TOKEN}" \ /d:sonar.host.url="https://sonarcloud.io" From 59afe48d656b6f9b9cb2eaf9c44212920155f20c Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 15:46:59 +0200 Subject: [PATCH 4/6] update organization name for sonar --- .github/workflows/sonarcloud.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 484c221..73b0a66 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -27,12 +27,6 @@ jobs: - name: Restore dependencies run: dotnet restore src/Faura.sln - - name: Begin SonarCloud Analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - dotnet sonarscanner begin /k:"faura" /o:"JosepFe" /d:sonar.login="${SONAR_TOKEN}" /d:sonar.host.url="https://sonarcloud.io" - - name: Begin SonarCloud Analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From ca78d80e1bce2cb8f436be35c0f0ddef2ae07f93 Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 15:49:50 +0200 Subject: [PATCH 5/6] update action --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 73b0a66..c7882bd 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -32,7 +32,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | dotnet sonarscanner begin \ - /k:"faura" \ + /k:"josepfe_faura" \ /o:"josepfe" \ /d:sonar.login="${SONAR_TOKEN}" \ /d:sonar.host.url="https://sonarcloud.io" From afca58b78b2bae9ba65ede79ecf8d71f6666d525 Mon Sep 17 00:00:00 2001 From: JosepFe Date: Thu, 5 Jun 2025 15:51:51 +0200 Subject: [PATCH 6/6] update script --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c7882bd..bf8bb3d 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -32,7 +32,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | dotnet sonarscanner begin \ - /k:"josepfe_faura" \ + /k:"JosepFe_faura" \ /o:"josepfe" \ /d:sonar.login="${SONAR_TOKEN}" \ /d:sonar.host.url="https://sonarcloud.io"