@@ -45,38 +45,60 @@ jobs:
4545 CODE_SIGN_IDENTITY="" \
4646 CODE_SIGNING_REQUIRED=NO
4747
48+ - name : Setup Python for coverage processing
49+ uses : actions/setup-python@v4
50+ with :
51+ python-version : ' 3.11'
52+
53+ - name : Install xccov-to-sonarqube-generic
54+ run : |
55+ pip install xccov-to-sonarqube-generic
56+
4857 - name : Generate Coverage Report
4958 run : |
5059 # Find the xcresult bundle
5160 XCRESULT_PATH=$(find ./DerivedData-${{ matrix.platform.name }}/Logs/Test -name '*.xcresult' | head -1)
5261
5362 if [ -z "$XCRESULT_PATH" ]; then
5463 echo "No .xcresult file found"
55- ls -la ./DerivedData-${{ matrix.platform.name }}/Logs/Test/
64+ find ./DerivedData-${{ matrix.platform.name }} -name "*.xcresult" || true
5665 exit 1
5766 fi
5867
5968 echo "Found xcresult at: $XCRESULT_PATH"
6069
61- # Generate coverage reports in different formats
62- xcrun xccov view --report --json "$XCRESULT_PATH" > coverage-${{ matrix.platform.name }}.json
63- xcrun xccov view --report "$XCRESULT_PATH" > coverage-${{ matrix.platform.name }}.txt
70+ # Create coverage directory
71+ mkdir -p coverage_reports
72+
73+ # Generate JSON coverage report
74+ xcrun xccov view --report --json "$XCRESULT_PATH" > ./coverage_reports/raw_coverage.json
75+
76+ # Convert to generic coverage format for codecov
77+ xccov-to-sonarqube-generic \
78+ --input ./coverage_reports/raw_coverage.json \
79+ --output ./coverage_reports/coverage.xml \
80+ --project-root .
81+
82+ # Also create a simplified format
83+ xcrun xccov view --report "$XCRESULT_PATH" > ./coverage_reports/coverage.txt
6484
65- # List generated files for debugging
66- ls -la coverage-*
85+ # Show what we generated
86+ echo "Coverage files generated:"
87+ ls -la ./coverage_reports/
88+ echo "Coverage XML preview:"
89+ head -30 ./coverage_reports/coverage.xml || true
6790
6891 - name : Upload Coverage to Codecov
6992 uses : codecov/codecov-action@v5
7093 with :
7194 token : ${{ secrets.CODECOV_TOKEN }}
72- files : ./coverage-${{ matrix.platform.name }}.json,./coverage-${{ matrix.platform.name }}.txt
95+ directory : ./coverage_reports
7396 flags : ${{ matrix.platform.name }}
7497 name : codecov-${{ matrix.platform.name }}
7598 fail_ci_if_error : false
7699 verbose : true
77- override_branch : main
78- override_commit : ${{ github.sha }}
79- override_pr : ${{ github.event.number }}
100+ root_dir : ./
101+ working-directory : ./
80102
81103 # Status Check
82104 status-check :
0 commit comments