-
Notifications
You must be signed in to change notification settings - Fork 1.5k
270 lines (228 loc) · 10.1 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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: "IGListKit CI"
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
macOS:
name: Unit Test macOS
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
WORKSPACE_NAME: IGListKit.xcworkspace
SCHEME_NAME: IGListKit-macOS
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Install pods.
run: pod install
- name: Run unit tests for macOS
run: |
set -o pipefail
xcodebuild build build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "platform=macOS" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
iOS:
name: Unit Test iOS
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
WORKSPACE_NAME: IGListKit.xcworkspace
SCHEME_NAME: IGListKit
strategy:
matrix:
destination: ["platform=iOS Simulator,name=iPhone 14 Pro"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Install pods.
run: pod install
- name: iOS - ${{ matrix.destination }}
run: |
set -o pipefail
xcodebuild build build-for-testing -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
xcodebuild analyze test-without-building -workspace "${{ env.WORKSPACE_NAME }}" -scheme "${{ env.SCHEME_NAME }}" -destination "${{ matrix.destination }}" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c
- name: Upload code coverage
run: bundle exec slather
env:
COVERAGE_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_PULL_REQUEST: ${{ github.event.number }}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
CocoaPods:
name: CocoaPods Lint
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run IGListDiffKit podspec lint
run: bundle exec pod lib lint IGListDiffKit.podspec --allow-warnings
- name: Run IGListKit podspec lint
run: bundle exec pod lib lint IGListKit.podspec --allow-warnings "--include-podspecs=IGListDiffKit.podspec"
- name: Run IGListSwiftKit podspec lint
run: bundle exec pod lib lint IGListSwiftKit.podspec --allow-warnings "--include-podspecs=*.podspec"
SPM-layout-generator:
name: Verify generate_spm_sources_layout.sh is not broken
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
WORKSPACE_NAME: IGListKit.xcworkspace
PROJECT_NAME: IGListKit.xcodeproj
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 14 Pro"
SPM_IG_LIST_DIFF_KIT_PUBLIC_HEADERS_PATH: "spm/Sources/IGListDiffKit/include"
SPM_IG_LIST_DIFF_KIT_SOURCES_PATH: "spm/Sources/IGListDiffKit"
SPM_IG_LIST_KIT_PUBLIC_HEADERS_PATH: "spm/Sources/IGListKit/include"
SPM_IG_LIST_KIT_SOURCES_PATH: "spm/Sources/IGListKit"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Manually clean SPM Sources folder
run: |
rm -rf "${{ env.SPM_IG_LIST_DIFF_KIT_PUBLIC_HEADERS_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_DIFF_KIT_SOURCES_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_KIT_PUBLIC_HEADERS_PATH }}/*.*"
rm -rf "${{ env.SPM_IG_LIST_KIT_SOURCES_PATH }}/*.*"
- name: Regenerate SPM layout
run: sh scripts/generate_spm_sources_layout.sh
- name: Clean project's ${{ env.PROJECT_NAME }} and ${{ env.WORKSPACE_NAME }}
run: |
rm -rf "${{ env.WORKSPACE_NAME }}"
rm -rf "${{ env.PROJECT_NAME }}"
- name: Verify IGListKit can be build using Package.swift which was generated by 'scripts/generate_spm_sources_layout.sh'
run: xcodebuild -scheme "IGListKit" build -destination "${{ env.IOS_DESTINATION }}" | xcpretty
SPM-build-from-Package:
name: Verify SPM build by invoking `xcodebuild` on Package.swift
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
WORKSPACE_NAME: IGListKit.xcworkspace
PROJECT_NAME: IGListKit.xcodeproj
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 14 Pro"
strategy:
matrix:
schemeName: ["IGListDiffKit",
"IGListKit",
"IGListSwiftKit"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Clean project's ${{ env.PROJECT_NAME }} and ${{ env.WORKSPACE_NAME }}
run: |
rm -rf "${{ env.WORKSPACE_NAME }}"
rm -rf "${{ env.PROJECT_NAME }}"
- name: Run ${{ matrix.schemeName}} using Package.swift
run: xcodebuild -scheme "${{ matrix.schemeName}}" build -destination "${{ env.IOS_DESTINATION }}" | xcpretty
Carthage-XCFramework:
name: Verify Carthage build XCFramework
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Carthage build framework
run: carthage build --no-skip-current --use-xcframeworks
Build-Examples:
name: Build Examples and UI tests.
runs-on: macos-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app
IOS_EXAMPLE_XCODEPROJ: Examples/Examples-iOS/IGListKitExamples.xcodeproj
TVOS_EXAMPLE_XCODEPROJ: Examples/Examples-tvOS/IGListKitExamples.xcodeproj
MACOS_EXAMPLE_XCODEPROJ: Examples/Examples-macOS/IGListKitExamples.xcodeproj
EXAMPLE_SCHEME: IGListKitExamples
strategy:
matrix:
iosDestination: ["platform=iOS Simulator,name=iPhone 14 Pro,OS=16.4"]
tvOSDestination: ["platform=tvOS Simulator,name=Apple TV 4K (3rd generation)"]
macOSDestination: ["platform=macOS"]
macCatalystDestination: ["platform=macOS,variant=Mac Catalyst"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Preboot iOS Simulator
uses: futureware-tech/simulator-action@v2
with:
model: 'iPhone 14 Pro'
os_version: '=16.4'
- name: Build iOS Example - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build build-for-testing -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Run iOS Example's UI Tests - ${{ matrix.iosDestination }}
run: |
set -o pipefail
xcodebuild build test -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.iosDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build tvOS Example - ${{ matrix.tvOSDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.TVOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.tvOSDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build macOS Example - ${{ matrix.macOSDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.MACOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macOSDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
- name: Build Mac Catalyst Example - ${{ matrix.macCatalystDestination }}
run: |
set -o pipefail
xcodebuild build -project "${{ env.IOS_EXAMPLE_XCODEPROJ }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macCatalystDestination }}" -configuration Debug ONLY_ACTIVE_ARCH=YES CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
Danger:
name: Run Danger
if: github.event_name == 'pull_request'
runs-on: macos-13
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache RubyGems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run Danger
run: bundle exec danger --verbose