-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (102 loc) · 3.35 KB
/
ios-ci.yml
File metadata and controls
119 lines (102 loc) · 3.35 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: iOS CI
on:
push:
branches: [ main, develop, master ]
pull_request:
branches: [ main, develop, master ]
jobs:
build:
name: Build and Test
runs-on: macos-26
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '26.2'
- name: Show Xcode version
run: xcodebuild -version
- name: Show available simulators
run: xcrun simctl list devicetypes
# TODO: Remove this once we have a way to install CocoaPods
# - name: Cache CocoaPods
# uses: actions/cache@v4
# with:
# path: Pods
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-pods-
# - name: Install CocoaPods
# run: |
# sudo gem install cocoapods
# pod --version
# - name: Install Pod Dependencies
# run: |
# pod install --repo-update
- name: Build for iOS Simulator
run: |
xcodebuild \
-workspace RemoteShutter.xcworkspace \
-scheme RemoteCam \
-destination 'platform=iOS Simulator,OS=26.2,name=iPhone 17' \
-configuration Debug \
clean build \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
- name: Run Tests
run: |
xcodebuild \
-workspace RemoteShutter.xcworkspace \
-scheme RemoteCam \
-destination 'platform=iOS Simulator,OS=26.2,name=iPhone 17' \
-configuration Debug \
test \
-enableCodeCoverage YES \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
- name: Code Coverage Report
if: success()
run: |
RESULT_PATH=$(find ~/Library/Developer/Xcode/DerivedData \
-name "*.xcresult" -type d 2>/dev/null | sort | tail -1)
if [ -z "$RESULT_PATH" ]; then
echo "No xcresult bundle found" >> $GITHUB_STEP_SUMMARY
exit 0
fi
echo "## Code Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| File | Functions | Coverage |" >> $GITHUB_STEP_SUMMARY
echo "|------|-----------|----------|" >> $GITHUB_STEP_SUMMARY
xcrun xccov view --report "$RESULT_PATH" \
--files-for-target RemoteShutter.app \
| tail -n +4 \
| awk 'NF >= 5 {
file = $2;
funcs = $(NF-2);
cov = $(NF-1) " " $NF;
n = split(file, parts, "/");
fname = parts[n];
if (length(fname) > 0) print "| `" fname "` | " funcs " | " cov " |";
}' >> $GITHUB_STEP_SUMMARY
- name: Archive for Release (if main branch)
if: github.ref == 'refs/heads/main'
run: |
xcodebuild \
-workspace RemoteShutter.xcworkspace \
-scheme RemoteCam \
-configuration Release \
-archivePath RemoteShutter.xcarchive \
archive \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
- name: Upload Build Artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs
path: |
~/Library/Developer/Xcode/DerivedData/**/Logs/**
retention-days: 5