From 232c16e988f8639f16ee4372302635b88326391a Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Fri, 17 Oct 2025 07:23:43 +0300 Subject: [PATCH] fix --- .gitea/workflows/build.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2eddce3..2e96cb5 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -16,6 +16,8 @@ jobs: build: name: Build, Test, Coverage, and Analyze runs-on: ubuntu-latest + env: + PATH: ${{ env.PATH }}:/root/.dotnet/tools steps: - uses: actions/checkout@v4 @@ -28,7 +30,14 @@ jobs: run: dotnet restore - name: Install dotnet-coverage - run: dotnet tool install --global dotnet-coverage + run: | + dotnet tool install --global dotnet-coverage + echo "Adding .dotnet/tools to PATH..." + echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bashrc + export PATH="$PATH:/root/.dotnet/tools" + echo "dotnet-coverage location:" + which dotnet-coverage || echo "dotnet-coverage not found in PATH" + ls -la /root/.dotnet/tools/ | grep dotnet-coverage || echo "No dotnet-coverage in tools directory" - name: Install SonarCloud Scanner run: dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner @@ -41,7 +50,22 @@ jobs: run: dotnet build --no-incremental - name: Run tests and collect coverage - run: dotnet-coverage collect "dotnet test --no-build" -f xml -o "coverage.xml" + run: | + echo "Running tests and collecting coverage..." + echo "PATH: $PATH" + echo "Trying dotnet-coverage from PATH..." + if dotnet-coverage collect "dotnet test --no-build" -f xml -o "coverage.xml"; then + echo "dotnet-coverage succeeded from PATH" + elif /root/.dotnet/tools/dotnet-coverage collect "dotnet test --no-build" -f xml -o "coverage.xml"; then + echo "dotnet-coverage succeeded with full path" + else + echo "dotnet-coverage failed, trying built-in coverage collection..." + dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults --no-build + echo "Looking for coverage files..." + find ./TestResults -name "*.xml" -exec echo "Found: {}" \; + # Convert to the expected format + find ./TestResults -name "coverage.cobertura.xml" -exec cp {} coverage.xml \; + fi - name: List files for debug run: ls -la