@@ -11,18 +11,67 @@ permissions:
1111
1212jobs :
1313 test-and-coverage :
14- name : Test and Coverage
14+ name : Test and Coverage (${{ matrix.platform }})
1515 runs-on : macos-latest
16+
17+ strategy :
18+ fail-fast : false
19+ matrix :
20+ include :
21+ - platform : " macOS"
22+ destination : " platform=macOS,arch=arm64"
23+ - platform : " iOS"
24+ destination : " platform=iOS Simulator"
25+ - platform : " tvOS"
26+ destination : " platform=tvOS Simulator"
27+ - platform : " watchOS"
28+ destination : " platform=watchOS Simulator"
29+ - platform : " visionOS"
30+ destination : " platform=visionOS Simulator"
31+ - platform : " macCatalyst"
32+ destination : " platform=macOS,variant=Mac Catalyst"
33+
1634 steps :
1735 - uses : actions/checkout@v5
18- - uses : maxim-lobanov/setup-xcode@v1
19- with :
20- xcode-version : ' 26.0-beta'
21- - name : Run tests
22- run : swift test -v --enable-code-coverage
36+
37+ - name : Run tests on ${{ matrix.platform }}
38+ run : |
39+ # Determine full destination specifier
40+ DEST="${{ matrix.destination }}"
41+ if [[ "${{ matrix.platform }}" != "macOS" && "${{ matrix.platform }}" != "macCatalyst" ]]; then
42+ DEVICE_ID=$(xcrun simctl list devices available \
43+ | grep "${{ matrix.platform }} Simulator" \
44+ | head -1 \
45+ | awk -F'[()]' '{print $(NF-3)}')
46+ DEST="${DEST},id=${DEVICE_ID}"
47+ fi
48+
49+ echo "Testing on: $DEST"
50+ xcodebuild test \
51+ -scheme ShitLib \
52+ -destination "$DEST" \
53+ -derivedDataPath DerivedData \
54+ -enableCodeCoverage YES
55+
2356 - name : Export coverage report as Lcov
24- run : xcrun llvm-cov export -format="lcov" -instr-profile=.build/arm64-apple-macosx/debug/codecov/default.profdata .build/arm64-apple-macosx/debug/ShitLibPackageTests.xctest/Contents/MacOS/ShitLibPackageTests > lcov.info
25- - uses : codecov/codecov-action@v5
57+ run : |
58+ # Locate profdata and test bundle under DerivedData
59+ PROFILE=$(find DerivedData/Build/ProfileData -name "*.profdata" | head -1)
60+ TEST_BUNDLE=$(find DerivedData/Build/Products -name "*ShitLibPackageTests.xctest" | head -1)
61+ TEST_BINARY="${TEST_BUNDLE}/$(basename "$TEST_BUNDLE" .xctest)"
62+
63+ if [[ -f "$PROFILE" && -f "$TEST_BINARY" ]]; then
64+ echo "Exporting coverage for ${{ matrix.platform }}"
65+ xcrun llvm-cov export -format="lcov" \
66+ -instr-profile="$PROFILE" \
67+ "$TEST_BINARY" > lcov_${{ matrix.platform }}.info
68+ else
69+ echo "Coverage data not found for ${{ matrix.platform }}"
70+ fi
71+
72+ - name : Upload coverage to Codecov
73+ uses : codecov/codecov-action@v5
2674 with :
2775 token : ${{ secrets.CODECOV_TOKEN }}
28- files : lcov.info
76+ files : lcov_${{ matrix.platform }}.info
77+ flags : ${{ matrix.platform }}
0 commit comments