This commit is contained in:
Leonid Pershin
2025-10-17 06:51:46 +03:00
parent c133047f2d
commit ac1bbd7635

View File

@@ -9,6 +9,8 @@ jobs:
build: build:
name: Build and analyze name: Build and analyze
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
PATH: ${{ env.PATH }}:/root/.dotnet/tools
steps: steps:
- name: Set up JDK 17 - name: Set up JDK 17
uses: actions/setup-java@v4 uses: actions/setup-java@v4
@@ -29,8 +31,12 @@ jobs:
- name: Install coverlet.collector - name: Install coverlet.collector
run: | run: |
dotnet tool install --global coverlet.console dotnet tool install --global coverlet.console
echo "Adding .dotnet/tools to PATH..."
echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bashrc
export PATH="$PATH:/root/.dotnet/tools"
echo "Coverlet installed at:" echo "Coverlet installed at:"
which coverlet which coverlet || echo "Coverlet not found, trying full path..."
ls -la /root/.dotnet/tools/ | grep coverlet || echo "No coverlet in tools directory"
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore --verbosity normal run: dotnet restore --verbosity normal
- name: SonarQube begin - name: SonarQube begin
@@ -58,6 +64,8 @@ jobs:
echo "Trying to run coverlet..." 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 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" echo "Coverlet succeeded"
elif /root/.dotnet/tools/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 with full path"
else else
echo "Coverlet failed, trying built-in coverage collection..." echo "Coverlet failed, trying built-in coverage collection..."
dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults