|
95 | 95 | poetry run pytest "${{ matrix.test_file }}" "$TEST_FILTER" "$TEST_EXPRESSION" \ |
96 | 96 | --cov=src --cov-report=xml:$COVERAGE_FILE --cov-report=term \ |
97 | 97 | -v || [ $? -eq 5 ] |
| 98 | + |
| 99 | + # Ensure .coverage file exists for merging (even if empty) |
| 100 | + if [ ! -f ".coverage" ]; then |
| 101 | + touch .coverage |
| 102 | + fi |
98 | 103 |
|
99 | 104 | - name: Upload coverage artifact |
100 | 105 | uses: actions/upload-artifact@v4 |
@@ -153,13 +158,24 @@ jobs: |
153 | 158 | fi |
154 | 159 | |
155 | 160 | # Copy all coverage files with unique names |
| 161 | + echo "📁 Checking for coverage files in artifacts..." |
156 | 162 | for artifact_dir in coverage_files/*/; do |
157 | | - if [ -f "$artifact_dir/.coverage" ]; then |
158 | | - artifact_name=$(basename "$artifact_dir") |
159 | | - cp "$artifact_dir/.coverage" ".coverage.$artifact_name" |
| 163 | + if [ -d "$artifact_dir" ]; then |
| 164 | + echo "Artifact: $(basename "$artifact_dir")" |
| 165 | + ls -la "$artifact_dir" || echo " (empty or inaccessible)" |
| 166 | + if [ -f "$artifact_dir/.coverage" ]; then |
| 167 | + artifact_name=$(basename "$artifact_dir") |
| 168 | + cp "$artifact_dir/.coverage" ".coverage.$artifact_name" |
| 169 | + echo " ✅ Copied .coverage file" |
| 170 | + else |
| 171 | + echo " ⚠️ No .coverage file found" |
| 172 | + fi |
160 | 173 | fi |
161 | 174 | done |
162 | 175 | |
| 176 | + echo "Available .coverage files for merging:" |
| 177 | + ls -la .coverage.* 2>/dev/null || echo "No .coverage.* files found" |
| 178 | + |
163 | 179 | # Combine all coverage data (ignore if no files found) |
164 | 180 | poetry run coverage combine .coverage.* 2>/dev/null || true |
165 | 181 | poetry run coverage xml 2>/dev/null || echo '<coverage lines-covered="0" lines-valid="1"></coverage>' > coverage.xml |
|
0 commit comments