diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 61c0a4d..f6bf5b9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,60 +5,80 @@ on:
branches:
- master
- develop
+ - dev
+
pull_request:
+ branches:
+ - master
+ - develop
+ - dev
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
+ - name: Setup .NET 10
+ 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: Build
- run: dotnet build ./Streetcode/Streetcode.sln --configuration Release --no-restore
+ - 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="$env:SONAR_TOKEN"
+ /d:sonar.host.url="https://sonarcloud.io"
+ /d:sonar.cs.opencover.reportsPaths="${{ github.workspace }}\coverage\coverage.opencover.xml"
- - name: Install coverlet.console
- run: dotnet tool install -g coverlet.console
-
- - 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: Build Solution
+ run: >
+ dotnet build ./Streetcode/Streetcode.sln
+ --configuration Release
+ --no-restore
+ /p:TreatWarningsAsErrors=false
- - name: Set SonarCloud Token
- run: echo "SONAR_TOKEN=${{ secrets.SONAR_TOKEN }}" >> $GITHUB_ENV
+ - 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="${{ github.workspace }}\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
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: >
+ dotnet sonarscanner end
+ /d:sonar.token="$env:SONAR_TOKEN"
- - name: Publish Code Coverage Report
+ - name: Upload Coverage Artifact
if: always()
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v4
with:
- name: Code Coverage Report
- path: |
- ./coverage/coverage.xml
+ name: coverage-report
+ path: coverage/
\ No newline at end of file
diff --git a/README.md b/README.md
index d8e6e97..bc774d0 100644
--- a/README.md
+++ b/README.md
@@ -261,4 +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.
+- Copyright 2022 © SoftServe IT Academy.
\ No newline at end of file
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