diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3ddfeaef..6f1398f6 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -72,14 +72,19 @@ jobs: run: make test-coverage - name: Merge and generate coverage report run: | + find . -type f -path "*.build/*" -name "*.o" mkdir -p coverage - find . -name "*.profraw" -exec llvm-profdata merge -sparse {} -o coverage/coverage.profdata \; - find .build/debug -type f -name "*.xctest" -exec file {} \; | grep -i 'executable' | cut -d: -f1 | while read executable; do - if [ -f "$executable" ]; then - echo "Generating coverage for $executable" - llvm-cov export -format=lcov -instr-profile=coverage/coverage.profdata "$executable" >> coverage/coverage.lcov - fi + profdata_file="coverage/coverage.profdata" + echo "Merging .profraw files..." + llvm-profdata merge -sparse $(find . -name "*.profraw") -o "$profdata_file" + find . -type f -path "*.build/debug/*" -name "*.o" | while read object_file; do + if file "$object_file" | grep -iq 'ELF'; then + echo "Processing $object_file" + llvm-cov export -format=lcov -instr-profile=coverage/coverage.profdata "$object_file" >> coverage/coverage.lcov + fi done + echo "Coverage report generated at coverage/coverage.lcov" + - name: List Coverage Files run: | echo "Checking coverage files..."