fix
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user