-
Notifications
You must be signed in to change notification settings - Fork 32
232 lines (201 loc) · 6.15 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
name: CI
on:
push:
branches:
- master
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- master
env:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md#xcode
DEVELOPER_DIR: "/Applications/Xcode_15.2.app/Contents/Developer"
IOS_DESTINATION: "platform=iOS Simulator,name=iPhone 15 Pro,OS=latest"
jobs:
env-details:
name: Environment details
runs-on: macos-14
steps:
- name: xcode version
run: xcodebuild -version -sdk
- name: list simulators
run: |
xcrun simctl delete unavailable
xcrun simctl list
build-test:
name: Build and Test
runs-on: macos-14
env:
WORKSPACE: Alicerce.xcworkspace
SCHEME: Alicerce
DERIVED_DATA_PATH: /tmp/DerivedData
SPM_CLONED_DEPENDENCIES_PATH: /tmp/spm-dependencies
ARTIFACTS_PATH: artifacts
RESULT_BUNDLE_PATH: $ARTIFACTS_PATH/build-test.xcresult
LOG_PATH: $ARTIFACTS_PATH/xcodebuild.log
steps:
- name: git checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: install xcbeautify
run: brew install xcbeautify
- name: cache SPM
uses: actions/cache@v2
with:
path: $SPM_CLONED_DEPENDENCIES_PATH
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: unit tests
run: |
set -o pipefail
xcodebuild clean build test \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-destination "$IOS_DESTINATION" \
-derivedDataPath "$DERIVED_DATA_PATH" \
-enableCodeCoverage YES \
-resultBundlePath "$RESULT_BUNDLE_PATH" \
-onlyUsePackageVersionsFromResolvedFile \
-skipPackagePluginValidation \
-skipMacroValidation \
-clonedSourcePackagesDirPath $SPM_CLONED_DEPENDENCIES_PATH \
| tee $LOG_PATH \
| xcbeautify
- name: codecov upload
uses: codecov/codecov-action@v4
with:
xcode: true
xcode_archive_path: ${{ env.RESULT_BUNDLE_PATH }}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts
path: $ARTIFACTS_PATH
swiftpm:
name: SwiftPM Build
runs-on: macos-14
env:
WORKSPACE: Alicerce.xcworkspace
SCHEME: "Alicerce (SPM)"
SPM_CLONED_DEPENDENCIES_PATH: /tmp/spm-dependencies
LOG_PATH: spm-xcodebuild.log
steps:
- name: git checkout
uses: actions/checkout@v3
- name: install xcbeautify
run: brew install xcbeautify
- name: cache SPM
uses: actions/cache@v2
with:
path: $SPM_CLONED_DEPENDENCIES_PATH
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: ${{ runner.os }}-spm-
- name: build
run: |
set -o pipefail
xcodebuild clean build \
-workspace "$WORKSPACE" \
-scheme "$SCHEME" \
-destination "$IOS_DESTINATION" \
-onlyUsePackageVersionsFromResolvedFile \
-skipPackagePluginValidation \
-skipMacroValidation \
-clonedSourcePackagesDirPath $SPM_CLONED_DEPENDENCIES_PATH \
| tee $LOG_PATH \
| xcbeautify
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: spm-xcodebuild.log
path: $LOG_PATH
cocoapods:
name: CocoaPods Verification
runs-on: macos-14
steps:
- name: git checkout
uses: actions/checkout@v3
- name: ruby versions
run: |
ruby --version
gem --version
bundler --version
- name: cache gems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: bundle install
run: |
gem install bundler --no-document
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: pod lint
run: bundle exec pod lib lint
carthage:
name: Carthage Verification
runs-on: macos-14
env:
DERIVED_DATA_PATH: /tmp/DerivedData
LOG_PATH: carthage.log
steps:
- name: git checkout
uses: actions/checkout@v3
- name: carthage build
run: |
./script/carthage.sh build \
--cache-builds \
--no-skip-current \
--derived-data $DERIVED_DATA_PATH \
--log-path $LOG_PATH
- name: Archive logs
uses: actions/upload-artifact@v4
with:
name: carthage.log
path: $LOG_PATH
release-github:
name: GitHub Release
runs-on: macos-14
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: git checkout
uses: actions/checkout@v3
- name: create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
# Changes
- <!-- Insert changes here -->
release-cocoapods:
name: CocoaPods Release
runs-on: macos-14
needs: [build-test, swiftpm, cocoapods, carthage]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: git checkout
uses: actions/checkout@v3
- name: ruby versions
run: |
ruby --version
gem --version
bundler --version
- name: cache gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: ${{ runner.os }}-gem-
- name: bundle install
run: |
gem install bundler --no-document
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: pod trunk push
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push --allow-warnings