-
Notifications
You must be signed in to change notification settings - Fork 1
205 lines (166 loc) · 7.34 KB
/
xcodebuild.yml
File metadata and controls
205 lines (166 loc) · 7.34 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Xcode Project
on:
workflow_dispatch:
push:
branches:
- '**'
tags-ignore:
- '**'
paths-ignore:
- '.github/**' # Ignore all files under '.github'
- '!.github/workflows/xcodebuild.yml' # Except for this workflow
- '.gitignore'
- '.remarkrc'
- 'KeyValueObservation.podspec'
- 'LICENSE'
- 'README.md'
- 'Tests/**'
jobs:
ios:
name: iOS
runs-on: macOS-11
env:
LOGSDIR: /tmp/.keyvalueobservation.xcodebuild/iOS/Logs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build iOS
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation" -destination "generic/platform=iOS" -configuration Debug 2>&1 | tee "$LOGSDIR/build-ios.log"
- name: Build iOS Simulator
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation" -destination "generic/platform=iOS Simulator" -configuration Debug 2>&1 | tee "$LOGSDIR/build-iossimulator.log"
- name: Test
run: |
IOS_SIM="$(xcrun simctl list devices available | grep "iPhone [0-9]" | sort -rV | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')"
if [ "${#IOS_SIM}" == "0" ]; then
IOS_SIM="iPhone 12 Pro" # Fallback Simulator
fi
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation" -testPlan "KeyValueObservationTests" -destination "platform=iOS Simulator,name=$IOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test 2>&1 | tee "$LOGSDIR/test-ios.log"
- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: iOSBuildLogs
path: ${{ env.LOGSDIR }}/*.log
maccatalyst:
name: Mac Catalyst
runs-on: macOS-11
env:
LOGSDIR: /tmp/.keyvalueobservation.xcodebuild/macCatalyst/Logs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation" -destination "generic/platform=macOS,variant=Mac Catalyst" -configuration Debug 2>&1 | tee "$LOGSDIR/build-maccatalyst.log"
- name: Test
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation" -testPlan "KeyValueObservationTests" -destination "platform=macOS,variant=Mac Catalyst" -configuration Debug ONLY_ACTIVE_ARCH=YES test 2>&1 | tee "$LOGSDIR/test-maccatalyst.log"
- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: MacCatalystBuildLogs
path: ${{ env.LOGSDIR }}/*.log
macos:
name: macOS
runs-on: macOS-11
env:
LOGSDIR: /tmp/.keyvalueobservation.xcodebuild/macOS/Logs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation macOS" -destination "generic/platform=macOS" -configuration Debug 2>&1 | tee "$LOGSDIR/build-macos.log"
- name: Test
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation macOS" -testPlan "KeyValueObservation macOS Tests" -derivedDataPath ".xcodebuild" -enableCodeCoverage YES -configuration Debug ONLY_ACTIVE_ARCH=YES test 2>&1 | tee "$LOGSDIR/test-macos.log"
- name: Generate Code Coverage File
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
PROFDATA_FILE="$(find .xcodebuild -name "*.profdata")"
xcrun llvm-cov export --format=lcov --instr-profile="$PROFDATA_FILE" ".xcodebuild/Build/Products/Debug/KeyValueObservationTests.xctest/Contents/MacOS/KeyValueObservationTests" > "./codecov.lcov"
- name: Upload Code Coverage
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./codecov.lcov
verbose: true
- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: macOSBuildLogs
path: ${{ env.LOGSDIR }}/*.log
tvos:
name: tvOS
runs-on: macOS-11
env:
LOGSDIR: /tmp/.keyvalueobservation.xcodebuild/tvOS/Logs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build tvOS
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation tvOS" -destination "generic/platform=tvOS" -configuration Debug 2>&1 | tee "$LOGSDIR/build-tvos.log"
- name: Build tvOS Simulator
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation tvOS" -destination "generic/platform=tvOS Simulator" -configuration Debug 2>&1 | tee "$LOGSDIR/build-tvossimulator.log"
- name: Test
run: |
TVOS_SIM="$(xcrun simctl list devices available | grep "Apple TV" | sort -V | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')"
if [ "${#TVOS_SIM}" == "0" ]; then
TVOS_SIM="Apple TV" # Fallback Simulator
fi
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation tvOS" -testPlan "KeyValueObservation tvOS Tests" -destination "platform=tvOS Simulator,name=$TVOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test 2>&1 | tee "$LOGSDIR/test-tvos.log"
- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: tvOSBuildLogs
path: ${{ env.LOGSDIR }}/*.log
watchos:
name: watchOS
runs-on: macOS-11
env:
LOGSDIR: /tmp/.keyvalueobservation.xcodebuild/watchOS/Logs
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Environment
run: |
mkdir -p "$LOGSDIR"
- name: Build watchOS
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation watchOS" -destination "generic/platform=watchOS" -configuration Debug 2>&1 | tee "$LOGSDIR/build-watchos.log"
- name: Build watchOS Simulator
run: |
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation watchOS" -destination "generic/platform=watchOS Simulator" -configuration Debug 2>&1 | tee "$LOGSDIR/build-watchossimulator.log"
- name: Test
run: |
WATCHOS_SIM="$(xcrun simctl list devices available | grep "Apple Watch" | sort -rV | head -n 1 | sed -E 's/(.+)[ ]*\([^)]*\)[ ]*\([^)]*\)/\1/' | awk '{$1=$1};1')"
if [ "${#WATCHOS_SIM}" == "0" ]; then
WATCHOS_SIM="Apple Watch Series 6 - 44mm" # Fallback Simulator
fi
xcodebuild -project "KeyValueObservation.xcodeproj" -scheme "KeyValueObservation watchOS" -testPlan "KeyValueObservation watchOS Tests" -destination "platform=watchOS Simulator,name=$WATCHOS_SIM" -configuration Debug ONLY_ACTIVE_ARCH=YES test 2>&1 | tee "$LOGSDIR/test-watchos.log"
- name: Upload Logs
uses: actions/upload-artifact@v2
if: always()
with:
name: watchOSBuildLogs
path: ${{ env.LOGSDIR }}/*.log