-
Notifications
You must be signed in to change notification settings - Fork 40
59 lines (55 loc) · 2.39 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: CI
on:
pull_request:
push:
branches: [main]
env:
MIN_COVERAGE: 0.2
permissions:
checks: write
pull-requests: write
jobs:
test:
runs-on: macos-15
steps:
- uses: actions/checkout@v2
- name: Setup Xcode Version
shell: bash
run: |
sudo xcode-select --switch /Applications/Xcode_16.0.app
- uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Run tests on iOS Simulator
shell: bash
run: |
xcodebuild -scheme BuiltinRegistryGenerator -destination "platform=macOS"
xcodebuild test -scheme LiveViewNative-Package -destination "platform=iOS Simulator,name=iPhone 16 Pro" -enableCodeCoverage YES -resultBundlePath TestResults -skipMacroValidation -skipPackagePluginValidation
- uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
continue-on-error: true
if: success() || failure()
- name: Validate Coverage %
shell: bash
run: |
COVERAGE=$(xcrun xccov view --report --json TestResults.xcresult | jq '([.targets[] | select(.name == "LiveViewNative").files[] | select(.name != "_GeneratedModifiers.swift") | .coveredLines] | add) / ([.targets[] | select(.name == "LiveViewNative").files[] | select(.name != "_GeneratedModifiers.swift") | .executableLines] | add)')
if [ $(echo "$COVERAGE > $MIN_COVERAGE" | bc) -ne 1 ]; then
printf "Code coverage $COVERAGE does not meet minimum requirement $MIN_COVERAGE"
exit -1
else
printf "Code coverage $COVERAGE meets minimum requirement $MIN_COVERAGE"
fi
- name: Build for macOS
shell: bash
run: |
xcodebuild -scheme LiveViewNative-Package -destination "platform=macOS" -skipMacroValidation -skipPackagePluginValidation
- name: Build for watchOS
shell: bash
run: |
xcodebuild -scheme LiveViewNative-Package -destination "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)" -skipMacroValidation -skipPackagePluginValidation
- name: Build for tvOS
shell: bash
run: |
xcodebuild -scheme LiveViewNative-Package -destination "platform=tvOS Simulator,name=Apple TV" -skipMacroValidation -skipPackagePluginValidation