Skip to content

Commit a24711f

Browse files
update to fix path issues to code coverage resutls.
1 parent 9957abb commit a24711f

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

.github/workflows/run-tests-on-pr.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,18 @@ jobs:
3636
- name: Run tests with coverage
3737
run: |
3838
mkdir -p test-results
39-
mkdir -p coverage
40-
dotnet test --logger "trx;LogFileName=test-results.trx" --results-directory test-results --collect:"XPlat Code Coverage" --results-directory coverage
39+
dotnet test --logger "trx;LogFileName=test-results.trx" --results-directory test-results --collect:"XPlat Code Coverage"
4140
continue-on-error: true
4241

4342
- name: Display code coverage summary
4443
run: |
4544
echo "Code Coverage Results:"
46-
find coverage -name "coverage.cobertura.xml" -exec echo "Coverage file: {}" \;
45+
find test-results -name "coverage.cobertura.xml" -exec echo "Coverage file: {}" \;
4746
# Install reportgenerator tool to create summary
4847
dotnet tool install -g dotnet-reportgenerator-globaltool
49-
if [ -f coverage/*/coverage.cobertura.xml ]; then
50-
reportgenerator -reports:coverage/*/coverage.cobertura.xml -targetdir:coverage/report -reporttypes:TextSummary
51-
cat coverage/report/Summary.txt
48+
if [ -f test-results/*/coverage.cobertura.xml ]; then
49+
reportgenerator -reports:test-results/*/coverage.cobertura.xml -targetdir:test-results/coverage-report -reporttypes:TextSummary
50+
cat test-results/coverage-report/Summary.txt
5251
else
5352
echo "No coverage files found"
5453
fi
@@ -58,11 +57,11 @@ jobs:
5857
echo "Contents of test-results directory:"
5958
ls -la test-results/ || echo "test-results directory not found"
6059
echo "Looking for .trx files:"
61-
find . -name "*.trx" -type f || echo "No .trx files found"
62-
echo "Current working directory:"
63-
pwd
64-
echo "All files in current directory:"
65-
ls -la
60+
find test-results -name "*.trx" -type f || echo "No .trx files found"
61+
echo "Looking for coverage files:"
62+
find test-results -name "coverage.cobertura.xml" -type f || echo "No coverage files found"
63+
echo "Full directory structure of test-results:"
64+
find test-results -type f || echo "test-results directory is empty"
6665
6766
- name: Publish Test Results
6867
uses: dorny/test-reporter@v1
@@ -76,7 +75,7 @@ jobs:
7675
uses: irongut/CodeCoverageSummary@v1.3.0
7776
if: always()
7877
with:
79-
filename: coverage/*/coverage.cobertura.xml
78+
filename: test-results/*/coverage.cobertura.xml
8079
badge: true
8180
fail_below_min: false
8281
format: markdown
@@ -96,5 +95,5 @@ jobs:
9695
- name: Upload coverage reports to Codecov
9796
uses: codecov/codecov-action@v4
9897
with:
99-
files: coverage/*/coverage.cobertura.xml
98+
files: test-results/*/coverage.cobertura.xml
10099
fail_ci_if_error: true

0 commit comments

Comments
 (0)