From e054991753b9759f620ad6b138f4850358545423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:35:07 +0200 Subject: [PATCH 1/8] Don't run SonarQube if no secrets are available --- .github/workflows/validate.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 625eaf54..4f8a8bfc 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -31,7 +31,8 @@ jobs: - name: Begin SonarQube Cloud analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' + if: ${{ env.SONAR_TOKEN != '' }} + run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' working-directory: './src' - name: 'Restore .NET solution' run: 'dotnet restore' @@ -59,5 +60,6 @@ jobs: - name: End SonarQube Cloud analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: 'dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"' + if: ${{ env.SONAR_TOKEN != '' }} + run: 'dotnet-sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"' working-directory: './src' From 50de476db35de14f0518a4981325d94376d5da5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:35:17 +0200 Subject: [PATCH 2/8] test --- .github/workflows/validate.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 4f8a8bfc..39d5993f 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -30,7 +30,7 @@ jobs: run: 'dotnet tool install --global dotnet-sonarscanner' - name: Begin SonarQube Cloud analysis env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEDDN }} if: ${{ env.SONAR_TOKEN != '' }} run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' working-directory: './src' @@ -59,7 +59,7 @@ jobs: working-directory: './src/Turnierplan.App/Client/' - name: End SonarQube Cloud analysis env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEDDN }} if: ${{ env.SONAR_TOKEN != '' }} run: 'dotnet-sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"' working-directory: './src' From b33320b8d7f1f04c755d51fffc78f84b71ffd63a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:37:15 +0200 Subject: [PATCH 3/8] =?UTF-8?q?like=20this=3D=3F?= --- .github/workflows/validate.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 39d5993f..8215ba32 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -9,6 +9,8 @@ jobs: validate: name: 'Validate' runs-on: ubuntu-24.04 + env: + RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TOKEN != '' }} steps: - uses: actions/checkout@v2 with: @@ -29,10 +31,8 @@ jobs: - name: Install SonarQube Cloud scanner run: 'dotnet tool install --global dotnet-sonarscanner' - name: Begin SonarQube Cloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEDDN }} - if: ${{ env.SONAR_TOKEN != '' }} - run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ env.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' + if: ${{ env.RUN_SONARQUBE_ANALYSIS }} + run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' working-directory: './src' - name: 'Restore .NET solution' run: 'dotnet restore' @@ -58,8 +58,6 @@ jobs: run: 'npm run test:ci' working-directory: './src/Turnierplan.App/Client/' - name: End SonarQube Cloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEDDN }} - if: ${{ env.SONAR_TOKEN != '' }} - run: 'dotnet-sonarscanner end /d:sonar.token="${{ env.SONAR_TOKEN }}"' + if: ${{ env.RUN_SONARQUBE_ANALYSIS }} + run: 'dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"' working-directory: './src' From 56be159a10c30a57734071142ebaea02884446dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:37:21 +0200 Subject: [PATCH 4/8] tmp --- .github/workflows/validate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 8215ba32..0719cd64 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -10,7 +10,7 @@ jobs: name: 'Validate' runs-on: ubuntu-24.04 env: - RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TOKEN != '' }} + RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TDDOKEN != '' }} steps: - uses: actions/checkout@v2 with: From a3d6dab4bc2abe397d0df7ea1db6754cb1bd877b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:38:02 +0200 Subject: [PATCH 5/8] woops --- .github/workflows/validate.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 0719cd64..94b6af58 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -29,6 +29,7 @@ jobs: - name: 'Set CHROME_BIN environment variable' run: 'echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV' - name: Install SonarQube Cloud scanner + if: ${{ env.RUN_SONARQUBE_ANALYSIS }} run: 'dotnet tool install --global dotnet-sonarscanner' - name: Begin SonarQube Cloud analysis if: ${{ env.RUN_SONARQUBE_ANALYSIS }} From afe827f534b92a707e5a63e84560f43b489850da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:38:30 +0200 Subject: [PATCH 6/8] test --- .github/workflows/validate.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 94b6af58..27edc6b8 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -28,6 +28,8 @@ jobs: id: 'setup-chrome' - name: 'Set CHROME_BIN environment variable' run: 'echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV' + - name: 'Test' + run: 'echo ${{env.RUN_SONARQUBE_ANALYSIS}}' - name: Install SonarQube Cloud scanner if: ${{ env.RUN_SONARQUBE_ANALYSIS }} run: 'dotnet tool install --global dotnet-sonarscanner' From 64639e97e7b7084caafb3e58cdbb1aebd0668035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:39:25 +0200 Subject: [PATCH 7/8] sfd --- .github/workflows/validate.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index 27edc6b8..e2772ba0 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -28,13 +28,11 @@ jobs: id: 'setup-chrome' - name: 'Set CHROME_BIN environment variable' run: 'echo "CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV' - - name: 'Test' - run: 'echo ${{env.RUN_SONARQUBE_ANALYSIS}}' - name: Install SonarQube Cloud scanner - if: ${{ env.RUN_SONARQUBE_ANALYSIS }} + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet tool install --global dotnet-sonarscanner' - name: Begin SonarQube Cloud analysis - if: ${{ env.RUN_SONARQUBE_ANALYSIS }} + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet-sonarscanner begin /k:"turnierplan-NET_turnierplan.NET" /o:"turnierplan-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" /d:sonar.javascript.lcov.reportPaths="**/lcov.info" /d:sonar.coverage.exclusions="**/*.spec.ts" /d:sonar.exclusions="Turnierplan.Dal/Migrations/*"' working-directory: './src' - name: 'Restore .NET solution' @@ -61,6 +59,6 @@ jobs: run: 'npm run test:ci' working-directory: './src/Turnierplan.App/Client/' - name: End SonarQube Cloud analysis - if: ${{ env.RUN_SONARQUBE_ANALYSIS }} + if: ${{ env.RUN_SONARQUBE_ANALYSIS == 'true' }} run: 'dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"' working-directory: './src' From 0bbd7a59e85a8fbae8489ddda4fb51b6b1444fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=B6rner?= Date: Tue, 27 May 2025 18:41:30 +0200 Subject: [PATCH 8/8] fix --- .github/workflows/validate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml index e2772ba0..f1b99b2d 100644 --- a/.github/workflows/validate.yaml +++ b/.github/workflows/validate.yaml @@ -10,7 +10,7 @@ jobs: name: 'Validate' runs-on: ubuntu-24.04 env: - RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TDDOKEN != '' }} + RUN_SONARQUBE_ANALYSIS: ${{ secrets.SONAR_TOKEN != '' }} steps: - uses: actions/checkout@v2 with: