@@ -12,6 +12,7 @@ parameters:
12
12
13
13
orbs :
14
14
aws-cli :
circleci/[email protected]
15
+
15
16
# Using inline orb for now
16
17
getting-started-smoke-test :
17
18
orbs :
@@ -96,34 +97,31 @@ orbs:
96
97
defaults : &defaults
97
98
macos :
98
99
xcode : ' 14.0.0'
99
- working_directory : ~/amplify-swift
100
100
environment :
101
- BUNDLE_PATH : vendor/bundle
102
-
103
- references :
104
- repo_cache_key : &repo_cache_key v2-repo-{{ .Branch }}-{{ .Revision }}
105
-
106
- restore_repo : &restore_repo
107
- restore_cache :
108
- keys :
109
- - *repo_cache_key
110
- - v2-repo-{{ .Branch }}
111
- - v2-repo
101
+ BUNDLE_JOBS : 4
102
+ BUNDLE_RETRY : 3
112
103
113
104
commands :
114
-
115
- restore_gems :
116
- steps :
117
- - restore_cache :
118
- keys :
119
- - v2-gems-{{ checksum "~/amplify-swift/Gemfile.lock" }}
120
- - v2-gems-
121
-
122
- check_bundle :
105
+ shallow_checkout :
123
106
steps :
124
107
- run :
125
- name : Check bundle
126
- command : bundle check --path $BUNDLE_PATH || bundle install --path $BUNDLE_PATH
108
+ name : Checkout code shallow and change to working directory
109
+ command : |
110
+ git clone --depth 1 "$CIRCLE_REPOSITORY_URL" --branch "$CIRCLE_BRANCH" $CIRCLE_WORKING_DIRECTORY
111
+ cd $CIRCLE_WORKING_DIRECTORY
112
+
113
+ if [ -n "$CIRCLE_TAG" ]; then
114
+ echo 'Fetch tag'
115
+ git fetch --depth 1 --force origin "+refs/tags/${CIRCLE_TAG}:refs/tags/${CIRCLE_TAG}"
116
+ elif [[ $(echo $CIRCLE_PULL_REQUEST | grep -E "${CIRCLE_BRANCH}$") ]]; then
117
+ echo 'Fetch pull request'
118
+ git fetch --depth 1 --force origin "$CIRCLE_BRANCH/head:remotes/origin/$CIRCLE_BRANCH"
119
+ else
120
+ echo 'Fetch branch'
121
+ git fetch --depth 1 --force origin "$CIRCLE_BRANCH:remotes/origin/$CIRCLE_BRANCH"
122
+ fi
123
+ echo "Checking out the CI HEAD"
124
+ git reset --hard "$CIRCLE_SHA1"
127
125
128
126
make_artifacts_directory :
129
127
steps :
@@ -137,44 +135,18 @@ commands:
137
135
path : artifacts
138
136
139
137
jobs :
140
- checkout_code :
141
- << : *defaults
142
- steps :
143
- - *restore_repo
144
- - checkout
145
- - save_cache :
146
- key : *repo_cache_key
147
- paths :
148
- - ~/amplify-swift
149
-
150
- install_gems :
151
- << : *defaults
152
- steps :
153
- - *restore_repo
154
- - restore_gems
155
- - run :
156
- name : Bundle install
157
- command : bundle check --path $BUNDLE_PATH || bundle install --path $BUNDLE_PATH
158
- environment :
159
- BUNDLE_JOBS : 4
160
- BUNDLE_RETRY : 3
161
- - save_cache :
162
- key : v2-gems-{{ checksum "~/amplify-swift/Gemfile.lock" }}
163
- paths :
164
- - vendor/bundle
165
-
166
138
build_amplify_ios_spm :
167
139
<< : *defaults
168
140
steps :
169
- - *restore_repo
141
+ - shallow_checkout
170
142
- make_artifacts_directory
171
143
- run :
172
144
name : Build amplify for ios SPM
173
145
command : xcodebuild build -scheme Amplify-Package -sdk iphonesimulator -destination "<< pipeline.parameters.ios-destination >>" | tee "artifacts/build-Ampify-for-ios-SPM.log" | xcpretty
174
146
build_amplify_macos_spm :
175
147
<< : *defaults
176
148
steps :
177
- - *restore_repo
149
+ - shallow_checkout
178
150
- make_artifacts_directory
179
151
- run :
180
152
name : Build amplify for macos SPM
@@ -194,7 +166,7 @@ jobs:
194
166
type : string
195
167
description : << parameters.scheme >> unit test
196
168
steps :
197
- - *restore_repo
169
+ - shallow_checkout
198
170
- make_artifacts_directory
199
171
- run :
200
172
name : Build << parameters.scheme >>
@@ -204,20 +176,19 @@ jobs:
204
176
command : xcodebuild test -scheme <<parameters.scheme>> -sdk << parameters.sdk >> -destination "<<parameters.destination>>" | tee "artifacts/test-<< parameters.scheme >>-<< parameters.sdk >>.log" | xcpretty --simple --color --report junit
205
177
- run :
206
178
name : Upload << parameters.scheme >> coverage report to Codecov
207
- command : bash ~/amplify-swift /build-support/codecov.sh -F << parameters.scheme >>_unit_test -J '^<< parameters.scheme >>$'
179
+ command : bash $CIRCLE_WORKING_DIRECTORY /build-support/codecov.sh -F << parameters.scheme >>_unit_test -J '^<< parameters.scheme >>$'
208
180
- store_test_results :
209
181
path : build/reports
210
182
- upload_artifacts
211
183
212
184
generate_api_docs :
213
185
<< : *defaults
214
186
steps :
215
- - *restore_repo
216
- - restore_gems
217
- - check_bundle
187
+ - shallow_checkout
188
+ - ruby/install-deps
218
189
- run :
219
190
name : Jazzy API doc generation
220
- command : bash ~/amplify-swift /CircleciScripts/jazzy_doc_gen.sh
191
+ command : bash $CIRCLE_WORKING_DIRECTORY /CircleciScripts/jazzy_doc_gen.sh
221
192
222
193
deploy :
223
194
<< : *defaults
@@ -230,18 +201,17 @@ jobs:
230
201
- add_ssh_keys :
231
202
fingerprints :
232
203
- ' 3f:b4:9f:aa:0b:d7:c5:16:fb:44:44:35:cb:a7:70:e0'
233
- - *restore_repo
234
- - restore_gems
235
- - check_bundle
204
+ - shallow_checkout
205
+ - ruby/install-deps
236
206
- run :
237
207
name : Release Amplify for Swift
238
208
command : bundle exec fastlane << parameters.lane >>
239
209
no_output_timeout : 60m
240
-
210
+
241
211
fortify_scan :
242
212
<< : *defaults
243
213
steps :
244
- - *restore_repo
214
+ - shallow_checkout
245
215
- run :
246
216
name : Make source directory
247
217
command : |
@@ -269,8 +239,8 @@ jobs:
269
239
name : Run Installer
270
240
command : |
271
241
Fortify_SCA_and_Apps_22.1.1_osx_x64.app/Contents/MacOS/installbuilder.sh --mode unattended --installdir Fortify --InstallSamples 0 --fortify_license_path fortify.license --MigrateSCA 0
272
- export PATH=~/amplify-swift /Fortify/bin:$PATH
273
- echo "export PATH=~/amplify-swift /Fortify/bin:\$PATH" >> "$BASH_ENV"
242
+ export PATH=$CIRCLE_WORKING_DIRECTORY /Fortify/bin:$PATH
243
+ echo "export PATH=$CIRCLE_WORKING_DIRECTORY /Fortify/bin:\$PATH" >> "$BASH_ENV"
274
244
fortifyupdate -acceptKey
275
245
sourceanalyzer -version
276
246
- run :
@@ -309,21 +279,15 @@ workflows:
309
279
not :
310
280
equal : [ scheduled_pipeline, << pipeline.trigger_source >> ]
311
281
jobs :
312
- - checkout_code
313
- - install_gems :
314
- requires :
315
- - checkout_code
316
282
- fortify_scan :
317
283
context :
318
284
- amplify-swift-aws-s3-download
319
- requires :
320
- - install_gems
321
285
- build_amplify_ios_spm :
322
286
requires :
323
287
- fortify_scan
324
288
- build_amplify_macos_spm :
325
289
requires :
326
- - fortify_scan
290
+ - fortify_scan
327
291
- unit_test :
328
292
name : ios_unit_test_amplify
329
293
scheme : Amplify
@@ -456,7 +420,7 @@ workflows:
456
420
filters :
457
421
branches :
458
422
only :
459
- - main
423
+ - main
460
424
- deploy :
461
425
name : deploy stable
462
426
lane : release
@@ -489,4 +453,4 @@ workflows:
489
453
- getting-started-smoke-test/ios :
490
454
xcode-version : " 13.4.1"
491
455
simulator-os-version : " 15.5"
492
- simulator-device : " iPhone 13 Pro"
456
+ simulator-device : " iPhone 13 Pro"
0 commit comments