From 2c63fbf01ff0021af679c54c7d12040e8c9a2c33 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 18:27:09 +0300 Subject: [PATCH 01/11] Configure SonarCloud analysis for .NET 10 --- .github/workflows/build.yml | 78 +++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61c0a4d..bdec458 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,60 +5,78 @@ on: branches: - master - develop + - dev + - main pull_request: + branches: + - master + - develop + - dev + - main types: [opened, synchronize, reopened] jobs: sonarcloud_branch: + name: SonarCloud analysis runs-on: windows-latest + steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Java - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - java-version: '11' - distribution: 'adopt' + java-version: '17' + distribution: 'temurin' - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: '10.0.100' + + - name: Install SonarScanner + run: dotnet tool update --global dotnet-sonarscanner - name: Restore Dependencies run: dotnet restore ./Streetcode/Streetcode.sln - - name: Install xmldocmd - run: dotnet tool install xmldocmd -g + - name: SonarScanner Begin + run: > + dotnet sonarscanner begin + /k:"ita-social-projects_StreetCode" + /o:"ita-social-projects" + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + /d:sonar.host.url="https://sonarcloud.io" + /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" - name: Build - run: dotnet build ./Streetcode/Streetcode.sln --configuration Release --no-restore - - - name: Install coverlet.console - run: dotnet tool install -g coverlet.console + run: > + dotnet build ./Streetcode/Streetcode.sln + --configuration Release + --no-restore + /p:TreatWarningsAsErrors=false - name: Test and Code Coverage - run: | - dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./coverage/coverage.xml - - - name: Install SonarScanner - run: dotnet tool install --global dotnet-sonarscanner - - - name: Set SonarCloud Token - run: echo "SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}" >> $GITHUB_ENV + run: > + dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj + --configuration Release + --no-build + --verbosity normal + /p:CollectCoverage=true + /p:CoverletOutputFormat=opencover + /p:CoverletOutput=../../coverage/coverage.opencover.xml - - name: SonarScanner Analysis - id: sonar - run: | - dotnet sonarscanner begin /k:"ita-social-projects_StreetCode" /o:"ita-social-projects" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportPaths="./coverage/coverage.xml" - dotnet build ./Streetcode/Streetcode.sln --configuration Release - dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + - name: SonarScanner End + run: > + dotnet sonarscanner end + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - name: Publish Code Coverage Report if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: Code Coverage Report - path: | - ./coverage/coverage.xml + name: code-coverage-report + path: coverage/ \ No newline at end of file From f89b0fa0de90caf009d71ca0c7d45e9cf04a0b49 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 18:40:20 +0300 Subject: [PATCH 02/11] Fix SonarCloud workflow for .NET 10 --- .github/workflows/build.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bdec458..dd2960d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: java-version: '17' distribution: 'temurin' - - name: Setup .NET + - name: Setup .NET 10 uses: actions/setup-dotnet@v4 with: dotnet-version: '10.0.100' @@ -50,7 +50,6 @@ jobs: /o:"ita-social-projects" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" - /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" - name: Build run: > @@ -59,21 +58,11 @@ jobs: --no-restore /p:TreatWarningsAsErrors=false - - name: Test and Code Coverage - run: > - dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj - --configuration Release - --no-build - --verbosity normal - /p:CollectCoverage=true - /p:CoverletOutputFormat=opencover - /p:CoverletOutput=../../coverage/coverage.opencover.xml - - name: SonarScanner End run: > dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - + - name: Publish Code Coverage Report if: always() uses: actions/upload-artifact@v4 From 684695371d890d1286dc4cd07dd20dd9a857c09c Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 18:43:57 +0300 Subject: [PATCH 03/11] Fix and remove test SonarCloud workflow for .NET 10 --- .github/workflows/build.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd2960d..066464a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,13 +6,11 @@ on: - master - develop - dev - - main pull_request: branches: - master - develop - dev - - main types: [opened, synchronize, reopened] jobs: @@ -61,11 +59,4 @@ jobs: - name: SonarScanner End run: > dotnet sonarscanner end - /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - - - name: Publish Code Coverage Report - if: always() - uses: actions/upload-artifact@v4 - with: - name: code-coverage-report - path: coverage/ \ No newline at end of file + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file From 6e8b80226b73e79aeffd30e56a05d1fed66a6461 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 18:49:19 +0300 Subject: [PATCH 04/11] Fix SonarCloud build pipeline --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 066464a..b123ffd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,7 @@ on: - master - develop - dev + pull_request: branches: - master @@ -39,7 +40,7 @@ jobs: run: dotnet tool update --global dotnet-sonarscanner - name: Restore Dependencies - run: dotnet restore ./Streetcode/Streetcode.sln + run: dotnet restore ./Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj - name: SonarScanner Begin run: > @@ -49,9 +50,9 @@ jobs: /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" - - name: Build + - name: Build WebApi run: > - dotnet build ./Streetcode/Streetcode.sln + dotnet build ./Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj --configuration Release --no-restore /p:TreatWarningsAsErrors=false From 777fdc2e4f60a0275fb5ae553b147d5b71301586 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 18:58:48 +0300 Subject: [PATCH 05/11] Fix test and coverage SonarCloud build pipeline --- .github/workflows/build.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b123ffd..53071a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: run: dotnet tool update --global dotnet-sonarscanner - name: Restore Dependencies - run: dotnet restore ./Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj + run: dotnet restore ./Streetcode/Streetcode.sln - name: SonarScanner Begin run: > @@ -49,15 +49,32 @@ jobs: /o:"ita-social-projects" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" + /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" - - name: Build WebApi + - name: Build Solution run: > - dotnet build ./Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj + dotnet build ./Streetcode/Streetcode.sln --configuration Release --no-restore /p:TreatWarningsAsErrors=false + - name: Run Tests with Coverage + run: > + dotnet test ./Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj + --configuration Release + --no-build + /p:CollectCoverage=true + /p:CoverletOutputFormat=opencover + /p:CoverletOutput=../../coverage/coverage.opencover.xml + - name: SonarScanner End run: > dotnet sonarscanner end - /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file + /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + + - name: Upload Coverage Artifact + if: always() + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: coverage/ \ No newline at end of file From 5c5d17abd7f7a043a25d33820e4ca80eb548c1d3 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 19:09:02 +0300 Subject: [PATCH 06/11] Add FluentAssertions package --- Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj b/Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj index e7691e9..b025524 100644 --- a/Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj +++ b/Streetcode/Streetcode.XUnitTest/Streetcode.XUnitTest.csproj @@ -17,6 +17,7 @@ + all runtime; build; native; contentfiles; analyzers; buildtransitive From e22769da260960f03803cda9250cf8c0982bcc54 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 19:22:36 +0300 Subject: [PATCH 07/11] Test SonarCloud workflow --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d8e6e97..7ac218e 100644 --- a/README.md +++ b/README.md @@ -262,3 +262,4 @@ Reach out to us at one of the following places! ## License - **[MIT license](http://opensource.org/licenses/mit-license.php)** - Copyright 2022 © SoftServe IT Academy. +Test SonarCloud workflow \ No newline at end of file From 8b7a131a969d7d06a38e4732287aeb7391169ff7 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 19:46:57 +0300 Subject: [PATCH 08/11] Fix hospost issue --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53071a7..8575d16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,11 +43,13 @@ jobs: run: dotnet restore ./Streetcode/Streetcode.sln - name: SonarScanner Begin + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: > dotnet sonarscanner begin /k:"ita-social-projects_StreetCode" /o:"ita-social-projects" - /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + /d:sonar.token="$SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" @@ -70,7 +72,7 @@ jobs: - name: SonarScanner End run: > dotnet sonarscanner end - /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + /d:sonar.token="$SONAR_TOKEN" - name: Upload Coverage Artifact if: always() From e7ea354708c11a5cc21799c01c0be30599748159 Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 19:53:57 +0300 Subject: [PATCH 09/11] Fix SonarCloud token usage in workflow --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8575d16..a35922c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ jobs: dotnet sonarscanner begin /k:"ita-social-projects_StreetCode" /o:"ita-social-projects" - /d:sonar.token="$SONAR_TOKEN" + /d:sonar.token="$env:SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" @@ -70,9 +70,11 @@ jobs: /p:CoverletOutput=../../coverage/coverage.opencover.xml - name: SonarScanner End + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: > dotnet sonarscanner end - /d:sonar.token="$SONAR_TOKEN" + /d:sonar.token="$env:SONAR_TOKEN" - name: Upload Coverage Artifact if: always() From 880a7334aa8ddcb596e1a149d80c671e0c31ff7f Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 20:08:38 +0300 Subject: [PATCH 10/11] Fix SonarCloud paths --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a35922c..f6bf5b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -51,7 +51,7 @@ jobs: /o:"ita-social-projects" /d:sonar.token="$env:SONAR_TOKEN" /d:sonar.host.url="https://sonarcloud.io" - /d:sonar.cs.opencover.reportsPaths="coverage/coverage.opencover.xml" + /d:sonar.cs.opencover.reportsPaths="${{ github.workspace }}\coverage\coverage.opencover.xml" - name: Build Solution run: > @@ -67,7 +67,7 @@ jobs: --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - /p:CoverletOutput=../../coverage/coverage.opencover.xml + /p:CoverletOutput="${{ github.workspace }}\coverage\coverage.opencover.xml" - name: SonarScanner End env: From aefa1415773aba90b03c913141f4790b91d4cfaa Mon Sep 17 00:00:00 2001 From: Vasia1101 Date: Mon, 11 May 2026 20:22:58 +0300 Subject: [PATCH 11/11] remove changes from readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ac218e..bc774d0 100644 --- a/README.md +++ b/README.md @@ -261,5 +261,4 @@ Reach out to us at one of the following places! ## License - **[MIT license](http://opensource.org/licenses/mit-license.php)** -- Copyright 2022 © SoftServe IT Academy. -Test SonarCloud workflow \ No newline at end of file +- Copyright 2022 © SoftServe IT Academy. \ No newline at end of file