fix cover
This commit is contained in:
@@ -26,8 +26,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.sonar/scanner
|
mkdir -p ~/.sonar/scanner
|
||||||
dotnet tool install dotnet-sonarscanner --tool-path ~/.sonar/scanner
|
dotnet tool install dotnet-sonarscanner --tool-path ~/.sonar/scanner
|
||||||
- name: Install dotnet-coverage
|
- name: Install coverlet.collector
|
||||||
run: dotnet tool install --global dotnet-coverage
|
run: |
|
||||||
|
dotnet tool install --global coverlet.console
|
||||||
|
echo "Coverlet installed at:"
|
||||||
|
which coverlet
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: dotnet restore --verbosity normal
|
run: dotnet restore --verbosity normal
|
||||||
- name: SonarQube begin
|
- name: SonarQube begin
|
||||||
@@ -39,7 +42,7 @@ jobs:
|
|||||||
echo "Listing files:"
|
echo "Listing files:"
|
||||||
ls -la
|
ls -la
|
||||||
echo "Installing SonarQube scanner..."
|
echo "Installing SonarQube scanner..."
|
||||||
~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
|
~/.sonar/scanner/dotnet-sonarscanner begin /k:"mrleo1nid_chatbot" /o:"mrleo1nid" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.opencover.reportsPaths=coverage.xml /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: |
|
run: |
|
||||||
@@ -49,7 +52,20 @@ jobs:
|
|||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: |
|
run: |
|
||||||
echo "Running tests with coverage..."
|
echo "Running tests with coverage..."
|
||||||
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
|
echo "PATH: $PATH"
|
||||||
|
echo "Coverlet location:"
|
||||||
|
which coverlet || echo "Coverlet not found in PATH"
|
||||||
|
echo "Trying to run coverlet..."
|
||||||
|
if coverlet ./ChatBot.Tests/bin/Debug/net9.0/ChatBot.Tests.dll --target "dotnet" --targetargs "test --no-build" -f=opencover -o="coverage.xml"; then
|
||||||
|
echo "Coverlet succeeded"
|
||||||
|
else
|
||||||
|
echo "Coverlet failed, trying built-in coverage collection..."
|
||||||
|
dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults
|
||||||
|
echo "Looking for coverage files..."
|
||||||
|
find ./TestResults -name "*.xml" -exec echo "Found: {}" \;
|
||||||
|
# Convert to OpenCover format if needed
|
||||||
|
find ./TestResults -name "coverage.cobertura.xml" -exec cp {} coverage.xml \;
|
||||||
|
fi
|
||||||
|
|
||||||
- name: SonarQube end
|
- name: SonarQube end
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in New Issue
Block a user