Skip to content

Commit 3657fbd

Browse files
committed
Removed unnecessary debug statements from the parallel code coverage workflow
1 parent 1c2f238 commit 3657fbd

File tree

1 file changed

+21
-107
lines changed

1 file changed

+21
-107
lines changed

.github/workflows/coverage-check-parallel.yml

Lines changed: 21 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Discover test files
2222
id: discover
2323
run: |
24-
# Find all test files in e2e directory and create JSON array (excluding test_driver.py and test_parameterized_queries.py for now)
25-
TEST_FILES=$(find tests/e2e -name "test_*.py" -type f | grep -v -E "(test_driver\.py|test_parameterized_queries\.py)" | sort | jq -R -s -c 'split("\n")[:-1]')
24+
# Find all test files in e2e directory
25+
TEST_FILES=$(find tests/e2e -name "test_*.py" -type f | sort | jq -R -s -c 'split("\n")[:-1]')
2626
echo "test-files=$TEST_FILES" >> $GITHUB_OUTPUT
2727
echo "Discovered test files: $TEST_FILES"
2828
@@ -95,64 +95,25 @@ jobs:
9595
# Clean any previous coverage data to avoid conflicts
9696
rm -f .coverage*
9797
98-
echo "🧪 Running pytest with coverage..."
98+
echo "Running pytest with coverage..."
9999
poetry run pytest "${{ matrix.test_file }}" "$TEST_FILTER" "$TEST_EXPRESSION" \
100100
--cov=src --cov-report=xml:$COVERAGE_FILE --cov-report=term -v || [ $? -eq 5 ]
101101
102-
echo "🔍 DEBUG: Post-test file analysis..."
103-
echo "Current directory contents:"
104-
ls -la
105-
106-
echo "Coverage-related files:"
107-
ls -la .coverage* coverage-* 2>/dev/null || echo "No coverage files found"
108-
102+
# Save coverage data with unique name
109103
if [ -f ".coverage" ]; then
110-
COVERAGE_SIZE=$(stat -c%s .coverage 2>/dev/null || stat -f%z .coverage)
111-
echo "✅ .coverage file found (${COVERAGE_SIZE} bytes)"
112104
mv .coverage "$COVERAGE_DATA"
113-
echo "✅ Saved coverage data as $COVERAGE_DATA"
105+
echo "Coverage data saved as $COVERAGE_DATA"
114106
else
115-
echo "⚠️ No .coverage generated, creating minimal coverage file"
116-
# Create a minimal but valid coverage file using coverage.py
107+
# Create minimal coverage file for cases where no tests run
117108
poetry run coverage erase
118109
poetry run coverage run --source=src -m pytest --version > /dev/null 2>&1 || true
119110
if [ -f ".coverage" ]; then
120111
mv .coverage "$COVERAGE_DATA"
121-
echo "✅ Created minimal coverage file as $COVERAGE_DATA"
122112
else
123-
# Fallback: create empty file (will be handled gracefully in merge)
124113
touch "$COVERAGE_DATA"
125-
echo "⚠️ Created empty placeholder as $COVERAGE_DATA"
126114
fi
115+
echo "Created minimal coverage file as $COVERAGE_DATA"
127116
fi
128-
129-
if [ -f "$COVERAGE_FILE" ]; then
130-
XML_SIZE=$(stat -c%s "$COVERAGE_FILE" 2>/dev/null || stat -f%z "$COVERAGE_FILE")
131-
echo "✅ XML coverage file found: $COVERAGE_FILE (${XML_SIZE} bytes)"
132-
echo "XML preview:"
133-
head -3 "$COVERAGE_FILE" 2>/dev/null || echo "Cannot read XML file"
134-
else
135-
echo "❌ No XML coverage file generated: $COVERAGE_FILE"
136-
fi
137-
138-
echo "📁 Final files available for upload:"
139-
ls -la .coverage* coverage-* 2>/dev/null || echo "No coverage files found"
140-
141-
echo "🔍 Specifically checking for files to upload:"
142-
echo " coverage-data-* files:"
143-
ls -la coverage-data-* 2>/dev/null || echo " None found"
144-
echo " coverage-*-${{ matrix.mode }}.xml files:"
145-
ls -la coverage-*-${{ matrix.mode }}.xml 2>/dev/null || echo " None found"
146-
147-
echo "🔍 CRITICAL DEBUG: Checking exact upload patterns:"
148-
echo " Pattern 'coverage-data-*' matches:"
149-
find . -maxdepth 1 -name "coverage-data-*" -type f 2>/dev/null || echo " No matches"
150-
echo " Pattern 'coverage-*-${{ matrix.mode }}.xml' matches:"
151-
find . -maxdepth 1 -name "coverage-*-${{ matrix.mode }}.xml" -type f 2>/dev/null || echo " No matches"
152-
153-
echo "🔍 Working directory: $(pwd)"
154-
echo "🔍 All files in current directory:"
155-
ls -la
156117
157118
- name: Upload coverage artifact
158119
uses: actions/upload-artifact@v4
@@ -205,101 +166,54 @@ jobs:
205166

206167
- name: Merge coverage
207168
run: |
208-
echo "🔧 Installing xmllint..."
169+
# Install xmllint if not available
209170
if ! command -v xmllint &> /dev/null; then
210171
sudo apt-get update && sudo apt-get install -y libxml2-utils
211172
fi
212173
213-
echo "📁 DEBUG: Checking downloaded artifacts structure..."
214-
find coverage_files -type f -name "*" | head -20
215-
echo "Total files found: $(find coverage_files -type f | wc -l)"
216-
217-
echo "📁 Checking for coverage files in artifacts..."
174+
# Copy coverage data files from artifacts
218175
COVERAGE_FILES_FOUND=0
219176
for artifact_dir in coverage_files/*/; do
220177
if [ -d "$artifact_dir" ]; then
221-
echo "🔍 Artifact: $(basename "$artifact_dir")"
222-
echo " Contents:"
223-
ls -la "$artifact_dir" || echo " (empty or inaccessible)"
224-
225-
# Copy coverage data files
226178
for cov_file in "$artifact_dir"/coverage-data-*; do
227179
if [ -f "$cov_file" ]; then
228180
cp "$cov_file" .
229181
COVERAGE_FILES_FOUND=$((COVERAGE_FILES_FOUND + 1))
230-
echo " ✅ Copied $(basename "$cov_file") ($(stat -c%s "$cov_file" 2>/dev/null || stat -f%z "$cov_file") bytes)"
231-
fi
232-
done
233-
234-
# Copy XML files for debugging
235-
for xml_file in "$artifact_dir"/coverage-*.xml; do
236-
if [ -f "$xml_file" ]; then
237-
cp "$xml_file" .
238-
echo " 📄 Copied $(basename "$xml_file") ($(stat -c%s "$xml_file" 2>/dev/null || stat -f%z "$xml_file") bytes)"
239182
fi
240183
done
241184
fi
242185
done
243186
244-
echo "📊 SUMMARY: Found $COVERAGE_FILES_FOUND coverage data files"
245-
echo "Available coverage data files for merging:"
246-
ls -la coverage-data-* 2>/dev/null || echo "❌ No coverage-data-* files found"
247-
248-
echo "Available XML files:"
249-
ls -la coverage-*.xml 2>/dev/null || echo "❌ No XML files found"
187+
echo "Found $COVERAGE_FILES_FOUND coverage data files"
250188
251189
if [ $COVERAGE_FILES_FOUND -gt 0 ]; then
252-
echo "🔄 Combining coverage data..."
190+
echo "Combining coverage data..."
253191
254-
# Rename coverage-data-* files to .coverage format for combining
255192
for f in coverage-data-*; do
256193
if [ -f "$f" ]; then
257-
# Extract the suffix and create .coverage.suffix format
258194
suffix=$(echo "$f" | sed 's/coverage-data-/.coverage./')
259195
mv "$f" "$suffix"
260-
echo " 📝 Renamed $f to $suffix"
261196
fi
262197
done
263198
264-
poetry run coverage combine .coverage.* || {
265-
echo "❌ Coverage combine failed, checking individual files:"
266-
for f in .coverage.*; do
267-
if [ -f "$f" ]; then
268-
echo " File: $f ($(stat -c%s "$f" 2>/dev/null || stat -f%z "$f") bytes)"
269-
file "$f" 2>/dev/null || echo " Cannot determine file type"
270-
fi
271-
done
272-
echo "⚠️ Using fallback approach..."
273-
touch .coverage
274-
}
275-
276-
echo "📊 Generating XML report..."
277-
poetry run coverage xml || {
278-
echo "❌ XML generation failed, using fallback"
279-
echo '<coverage lines-covered="0" lines-valid="1"></coverage>' > coverage.xml
280-
}
281-
282-
echo "📋 Generating text report..."
283-
poetry run coverage report || echo "⚠️ Text report failed"
199+
# Combine coverage files and generate reports
200+
poetry run coverage combine .coverage.* 2>/dev/null || true
201+
poetry run coverage xml 2>/dev/null || echo '<coverage lines-covered="0" lines-valid="1"></coverage>' > coverage.xml
202+
poetry run coverage report 2>/dev/null || true
284203
else
285-
echo "⚠️ No coverage data files found, creating empty report"
204+
echo "No coverage data files found, creating empty report"
286205
echo '<coverage lines-covered="0" lines-valid="1"></coverage>' > coverage.xml
287206
fi
288-
289-
echo "📄 Final coverage.xml preview:"
290-
head -5 coverage.xml 2>/dev/null || echo "Cannot read coverage.xml"
291207
292208
- name: Report coverage percentage
293209
run: |
294-
COVERAGE_FILE="coverage.xml"
295-
if [ ! -f "$COVERAGE_FILE" ]; then
296-
echo "ERROR: Coverage file not found at $COVERAGE_FILE"
210+
if [ ! -f "coverage.xml" ]; then
211+
echo "ERROR: Coverage file not found"
297212
exit 1
298213
fi
299214
300-
COVERED=$(xmllint --xpath "string(//coverage/@lines-covered)" "$COVERAGE_FILE")
301-
TOTAL=$(xmllint --xpath "string(//coverage/@lines-valid)" "$COVERAGE_FILE")
302-
215+
COVERED=$(xmllint --xpath "string(//coverage/@lines-covered)" "coverage.xml")
216+
TOTAL=$(xmllint --xpath "string(//coverage/@lines-valid)" "coverage.xml")
303217
PERCENTAGE=$(python3 -c "covered=${COVERED}; total=${TOTAL}; print(round((covered/total)*100, 2))")
304218
305-
echo "📊 Combined Coverage: ${PERCENTAGE}%"
219+
echo "Combined Coverage: ${PERCENTAGE}%"

0 commit comments

Comments
 (0)