Skip to content

Commit aeaed41

Browse files
committed
Add extensive debugging for coverage.xml generation
- Use relative path instead of absolute path for coverage.xml - Add pre and post PHPUnit execution debugging - Search entire workspace for coverage.xml file - List all XML files to see what's being generated - Enhanced coverage file detection logic
1 parent 8f022c8 commit aeaed41

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

.github/workflows/code-coverage.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,18 @@ jobs:
6565

6666
- name: Generate code coverage report for current branch
6767
run: |
68-
vendor/bin/phpunit --dont-report-useless-tests --coverage-clover=${{ github.workspace }}/coverage.xml --coverage-text | tee coverage-output.txt
68+
echo "=== Debug: Before running PHPUnit ==="
69+
pwd
70+
ls -la
71+
echo "=== Running PHPUnit with coverage ==="
72+
vendor/bin/phpunit --dont-report-useless-tests --coverage-clover=coverage.xml --coverage-text | tee coverage-output.txt
73+
echo "=== Debug: After running PHPUnit ==="
74+
pwd
75+
ls -la coverage* 2>/dev/null || echo "No coverage files in current directory"
76+
echo "=== Searching entire workspace for coverage.xml ==="
77+
find . -name "coverage.xml" -type f 2>/dev/null || echo "No coverage.xml found anywhere"
78+
echo "=== Searching for any XML files ==="
79+
find . -name "*.xml" -type f 2>/dev/null | head -20
6980
continue-on-error: false
7081

7182
- name: Upload coverage to Codecov
@@ -83,20 +94,35 @@ jobs:
8394
# Debug: Check for coverage files
8495
echo "=== Debug: Looking for coverage files ==="
8596
ls -la coverage* 2>/dev/null || echo "No coverage files found in current directory"
86-
ls -la ${{ github.workspace }}/coverage* 2>/dev/null || echo "No coverage files in workspace"
87-
echo "=== Debug: Searching for coverage.xml recursively ==="
88-
find ${{ github.workspace }} -name "coverage.xml" 2>/dev/null || echo "No coverage.xml found anywhere"
8997
echo "=== Debug: Current directory ==="
9098
pwd
9199
echo "=== Debug: Workspace directory ==="
92100
echo "${{ github.workspace }}"
93101
94-
# Try both locations
102+
# Search for coverage.xml anywhere in the workspace
103+
echo "=== Searching for coverage.xml recursively ==="
104+
FOUND_FILES=$(find ${{ github.workspace }} -name "coverage.xml" -type f 2>/dev/null)
105+
if [ -n "$FOUND_FILES" ]; then
106+
echo "Found coverage.xml files:"
107+
echo "$FOUND_FILES"
108+
else
109+
echo "No coverage.xml found anywhere in workspace"
110+
fi
111+
112+
# Try to find coverage.xml in multiple locations
95113
COVERAGE_FILE=""
96114
if [ -f coverage.xml ]; then
97115
COVERAGE_FILE="coverage.xml"
116+
echo "Found coverage.xml in current directory"
98117
elif [ -f ${{ github.workspace }}/coverage.xml ]; then
99118
COVERAGE_FILE="${{ github.workspace }}/coverage.xml"
119+
echo "Found coverage.xml in workspace root"
120+
else
121+
# Try to find it anywhere
122+
COVERAGE_FILE=$(find ${{ github.workspace }} -name "coverage.xml" -type f 2>/dev/null | head -1)
123+
if [ -n "$COVERAGE_FILE" ]; then
124+
echo "Found coverage.xml at: $COVERAGE_FILE"
125+
fi
100126
fi
101127
102128
if [ -n "$COVERAGE_FILE" ]; then

0 commit comments

Comments
 (0)