@@ -53,12 +53,26 @@ jobs:
5353 fail-fast : false
5454 matrix :
5555 include :
56- - name : sqlite
56+ - name : sqlite-1
5757 db : sqlite3
5858 pytest_par : 10
59- - name : postgres
59+ test_group : 1
60+ test_group_count : 2
61+ - name : sqlite-2
62+ db : sqlite3
63+ pytest_par : 10
64+ test_group : 2
65+ test_group_count : 2
66+ - name : postgres-1
6067 db : postgres
6168 pytest_par : 10
69+ test_group : 1
70+ test_group_count : 2
71+ - name : postgres-2
72+ db : postgres
73+ pytest_par : 10
74+ test_group : 2
75+ test_group_count : 2
6276
6377 steps :
6478 - name : Checkout
@@ -108,9 +122,12 @@ jobs:
108122 export CLN_COVERAGE_DIR="${{ github.workspace }}/coverage-raw"
109123 mkdir -p "$CLN_COVERAGE_DIR"
110124 echo "CLN_COVERAGE_DIR=$CLN_COVERAGE_DIR"
125+ echo "Running test group ${{ matrix.test_group }} of ${{ matrix.test_group_count }}"
111126 echo "Current directory: $(pwd)"
112127 ls -la
113- VALGRIND=0 uv run eatmydata pytest tests/ -n ${PYTEST_PAR} -vvv
128+ VALGRIND=0 uv run eatmydata pytest tests/ -n ${PYTEST_PAR} -vvv \
129+ --test-group-count ${{ matrix.test_group_count }} \
130+ --test-group ${{ matrix.test_group }}
114131
115132 - name : Check coverage files generated
116133 if : always()
@@ -127,12 +144,35 @@ jobs:
127144 echo " 3. LLVM_PROFILE_FILE environment variable not set correctly"
128145 fi
129146
147+ - name : Install LLVM tools for merging
148+ if : always()
149+ run : |
150+ wget https://apt.llvm.org/llvm.sh
151+ chmod +x llvm.sh
152+ sudo ./llvm.sh 18
153+ sudo ln -sf /usr/bin/llvm-profdata-18 /usr/bin/llvm-profdata
154+
155+ - name : Merge coverage data locally
156+ if : always()
157+ run : |
158+ chmod +x contrib/coverage/collect-coverage.sh
159+ mkdir -p coverage
160+ CLN_COVERAGE_DIR="${{ github.workspace }}/coverage-raw" \
161+ ./contrib/coverage/collect-coverage.sh \
162+ coverage-raw \
163+ coverage/${{ matrix.name }}.profdata
164+ echo "Merged profdata size:"
165+ ls -lh coverage/${{ matrix.name }}.profdata || echo "No profdata file created"
166+ # Clean up raw files to save disk space
167+ rm -rf coverage-raw/*.profraw
168+ echo "Cleaned up raw profraw files"
169+
130170 - name : Upload coverage data
131171 uses : actions/upload-artifact@v4
132172 if : always()
133173 with :
134- name : coverage-raw -${{ matrix.name }}
135- path : coverage-raw/*.profraw
174+ name : coverage-merged -${{ matrix.name }}
175+ path : coverage/${{ matrix.name }}.profdata
136176 if-no-files-found : warn
137177
138178 report :
@@ -164,21 +204,28 @@ jobs:
164204 - name : Download all coverage artifacts
165205 uses : actions/download-artifact@v4
166206 with :
167- pattern : coverage-raw -*
207+ pattern : coverage-merged -*
168208 path : coverage-artifacts
169209
170210 - name : Merge coverage data
171211 run : |
172- mkdir -p coverage-raw coverage
173- find coverage-artifacts -name "*.profraw" -exec cp {} coverage-raw/ \;
174- PROFRAW_COUNT=$(ls -1 coverage-raw/*.profraw 2>/dev/null | wc -l)
175- echo "Found $PROFRAW_COUNT profile files"
176- if [ "$PROFRAW_COUNT" -eq 0 ]; then
212+ mkdir -p coverage
213+ # Find all .profdata files from test jobs
214+ PROFDATA_FILES=($(find coverage-artifacts -name "*.profdata"))
215+ echo "Found ${#PROFDATA_FILES[@]} profdata files from test jobs:"
216+ printf '%s\n' "${PROFDATA_FILES[@]}"
217+
218+ if [ ${#PROFDATA_FILES[@]} -eq 0 ]; then
177219 echo "ERROR: No coverage data found"
178220 exit 1
179221 fi
180- chmod +x contrib/coverage/collect-coverage.sh
181- CLN_COVERAGE_DIR=coverage-raw ./contrib/coverage/collect-coverage.sh
222+
223+ # Merge all pre-aggregated profdata files into final merged.profdata
224+ echo "Merging ${#PROFDATA_FILES[@]} profdata files..."
225+ llvm-profdata merge -sparse "${PROFDATA_FILES[@]}" -o coverage/merged.profdata
226+
227+ echo "Final merged profdata size:"
228+ ls -lh coverage/merged.profdata
182229
183230 - name : Generate HTML report
184231 run : |
0 commit comments