Skip to content

Commit f056a6b

Browse files
a7medevahmedAlaaInstabug
authored andcommitted
ci: generalize enterprise releases (#1275)
1 parent 9f8eb4a commit f056a6b

File tree

1 file changed

+50
-136
lines changed

1 file changed

+50
-136
lines changed

.circleci/config.yml

Lines changed: 50 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ references:
1717
- e2e_ios
1818
- e2e_android
1919

20-
dream11_prepare_config: &dream11_prepare_config
21-
prepare_steps:
22-
- prepare_dream11
23-
requires:
24-
- hold_test_dream11
25-
2620
commands:
2721
install_node_modules:
2822
parameters:
@@ -42,28 +36,15 @@ commands:
4236
parameters:
4337
working_directory:
4438
type: string
45-
deployment:
46-
type: boolean
47-
default: false
4839
steps:
4940
- restore_cache:
5041
name: Restore Pods Cache
5142
keys:
5243
- v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
53-
- when:
54-
condition: << parameters.deployment >>
55-
steps:
56-
- run:
57-
name: Install Pods
58-
working_directory: << parameters.working_directory >>
59-
command: pod install --deployment
60-
- unless:
61-
condition: << parameters.deployment >>
62-
steps:
63-
- run:
64-
name: Install Pods
65-
working_directory: << parameters.working_directory >>
66-
command: pod install
44+
- run:
45+
name: Install Pods
46+
working_directory: << parameters.working_directory >>
47+
command: pod install --deployment
6748
- save_cache:
6849
name: Save Pods Cache
6950
key: v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
@@ -139,11 +120,6 @@ commands:
139120
name: Remove unused features
140121
command: ./scripts/dream-11-delete-unused-features.sh
141122
working_directory: << parameters.working_directory >>
142-
# Remove the NDK package to avoid dependency conflicts on Android.
143-
- run:
144-
name: Remove the NDK package
145-
command: yarn remove instabug-reactnative-ndk
146-
working_directory: << parameters.working_directory >>/examples/default
147123

148124
notify_github:
149125
parameters:
@@ -182,38 +158,20 @@ jobs:
182158
command: yarn lint:ci
183159

184160
test_module:
185-
parameters:
186-
prepare_steps:
187-
type: steps
188-
default: []
189-
collect_coverage:
190-
type: boolean
191-
default: false
192161
executor:
193162
name: node/default
194163
steps:
195164
- advanced-checkout/shallow-checkout
196-
- steps: << parameters.prepare_steps >>
197165
- install_node_modules
198166
- run:
199167
name: Run Tests
200168
command: yarn test
201-
- when:
202-
condition: << parameters.collect_coverage >>
203-
steps:
204-
- persist_to_workspace:
205-
root: coverage
206-
paths:
207-
- lcov.info
169+
- persist_to_workspace:
170+
root: coverage
171+
paths:
172+
- lcov.info
208173

209174
test_android:
210-
parameters:
211-
prepare_steps:
212-
type: steps
213-
default: []
214-
collect_coverage:
215-
type: boolean
216-
default: false
217175
executor:
218176
name: android/android-machine
219177
tag: '2024.01.1'
@@ -222,18 +180,15 @@ jobs:
222180
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
223181
steps:
224182
- advanced-checkout/shallow-checkout
225-
- steps: << parameters.prepare_steps >>
183+
# - node/install-yarn
226184
- install_node_modules
227185
- android/run-tests:
228186
working-directory: android
229187
test-command: ./gradlew test
230-
- when:
231-
condition: << parameters.collect_coverage >>
232-
steps:
233-
- persist_to_workspace:
234-
root: ~/project/android/build/reports/jacoco/jacocoTestReport
235-
paths:
236-
- jacocoTestReport.xml
188+
- persist_to_workspace:
189+
root: ~/project/android/build/reports/jacoco/jacocoTestReport
190+
paths:
191+
- jacocoTestReport.xml
237192

238193
validate_shell_files:
239194
machine:
@@ -262,18 +217,10 @@ jobs:
262217
app-dir: examples/default
263218
- install_pods:
264219
working_directory: examples/default/ios
265-
deployment: true
266220
- run: git --no-pager diff
267221
- run: git diff-index HEAD --exit-code -p -I EXCLUDED_ARCHS # Ignore Arch Changes
268222

269223
test_ios:
270-
parameters:
271-
prepare_steps:
272-
type: steps
273-
default: []
274-
collect_coverage:
275-
type: boolean
276-
default: false
277224
macos:
278225
xcode: 13.4.1
279226
resource_class: macos.m1.medium.gen1
@@ -282,7 +229,6 @@ jobs:
282229
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
283230
steps:
284231
- advanced-checkout/shallow-checkout
285-
- steps: << parameters.prepare_steps >>
286232
- install_node_modules
287233
- install_pods:
288234
working_directory: ios
@@ -297,31 +243,23 @@ jobs:
297243
-sdk iphonesimulator \
298244
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
299245
test | xcpretty
300-
- when:
301-
condition: << parameters.collect_coverage >>
302-
steps:
303-
- run:
304-
name: Convert xcresult into JSON report
305-
working_directory: ios/coverage
306-
command: xcrun xccov view --report --json result.xcresult > xcode.json
307-
- persist_to_workspace:
308-
root: ios/coverage
309-
paths:
310-
- xcode.json
246+
- run:
247+
name: Convert xcresult into JSON report
248+
working_directory: ios/coverage
249+
command: xcrun xccov view --report --json result.xcresult > xcode.json
250+
- persist_to_workspace:
251+
root: ios/coverage
252+
paths:
253+
- xcode.json
311254

312255
e2e_ios:
313-
parameters:
314-
prepare_steps:
315-
type: steps
316-
default: []
317256
macos:
318257
xcode: 13.4.1
319258
resource_class: macos.m1.medium.gen1
320259
environment:
321260
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
322261
steps:
323262
- advanced-checkout/shallow-checkout
324-
- steps: << parameters.prepare_steps >>
325263
- install_node_modules
326264
- node/install-packages:
327265
pkg-manager: yarn
@@ -338,11 +276,6 @@ jobs:
338276
name: Rebuild Detox.framework Cache
339277
working_directory: examples/default
340278
command: detox clean-framework-cache && detox build-framework-cache
341-
# This is a workaround until the iOS SDK is updated to prioritize the custom
342-
# Instabug.plist over the internal Config.plist.
343-
- run:
344-
name: Customize API Endpoints
345-
command: ./scripts/customize-ios-endpoints.sh
346279
- run:
347280
name: Detox - Build Release App
348281
working_directory: examples/default
@@ -353,10 +286,6 @@ jobs:
353286
command: detox test --configuration ios.sim.release --cleanup
354287

355288
e2e_android:
356-
parameters:
357-
prepare_steps:
358-
type: steps
359-
default: []
360289
executor:
361290
name: android/android-machine
362291
tag: '2024.01.1'
@@ -365,7 +294,7 @@ jobs:
365294
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
366295
steps:
367296
- advanced-checkout/shallow-checkout
368-
- steps: << parameters.prepare_steps >>
297+
# - node/install-yarn
369298
- install_node_modules
370299
- node/install-packages:
371300
pkg-manager: yarn
@@ -469,22 +398,35 @@ jobs:
469398
- run: yarn build
470399
- run: yarn remove @instabug/danger-plugin-coverage
471400
- run:
472-
name: Get snapshot version
401+
name: Remove build files from .gitignore
402+
command: sed -i '/dist/d' .gitignore && sed -i '/bin/d' .gitignore
403+
- run:
404+
name: Get snapshot branch name
473405
command: |
474-
source scripts/snapshot-version.sh
475-
echo "export SNAPSHOT_VERSION=$SNAPSHOT_VERSION" >> "$BASH_ENV"
406+
source scripts/snapshot-branch.sh
407+
echo "export SNAPSHOT_BRANCH=$SNAPSHOT_BRANCH" >> "$BASH_ENV"
476408
- run:
477-
name: Authorize with NPM
478-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
479-
- run: npm version $SNAPSHOT_VERSION --no-git-tag-version
480-
- run: npm publish --tag snapshot
409+
name: Setup Git
410+
command: |
411+
git config --global user.name "Instabug-CP-CI"
412+
git config --global user.email [email protected]
413+
- run:
414+
name: Create snapshot branch
415+
command: git checkout -b $SNAPSHOT_BRANCH
416+
- run:
417+
name: Commit changes
418+
command: |
419+
git add .
420+
git commit -m "chore: add generate files"
421+
- run:
422+
name: Push snapshot
423+
command: git push --force origin $SNAPSHOT_BRANCH
481424
- run:
482425
name: Install jq
483426
command: sudo apt-get update && sudo apt-get install -y jq
484-
- find_and_replace:
485-
files: scripts/snapshot-comment.md
486-
search: '{VERSION}'
487-
replace: $SNAPSHOT_VERSION
427+
- run:
428+
name: Replace snapshot branch in comment template
429+
command: sed -i "s|{BRANCH}|$SNAPSHOT_BRANCH|g" scripts/snapshot-comment.md
488430
- notify_github:
489431
data: "$(jq -Rcs '{ body: . }' scripts/snapshot-comment.md)"
490432

@@ -497,14 +439,11 @@ workflows:
497439
- test_android
498440
- test_ios
499441
- lint
500-
- test_module:
501-
collect_coverage: true
502-
- test_android:
503-
collect_coverage: true
504-
- test_ios:
505-
collect_coverage: true
442+
- test_module
443+
- test_android
506444
- validate_shell_files
507445
- sync_generated_files
446+
- test_ios
508447
- e2e_ios
509448
- e2e_android
510449
- hold_generate_snapshot:
@@ -576,33 +515,8 @@ workflows:
576515
android_package: injazat
577516
api_endpoint: st001013mec1.instabug.com
578517

579-
# Dream11 tests
580-
- hold_test_dream11:
581-
type: approval
582-
- test_module:
583-
name: test_module_dream11
584-
<<: *dream11_prepare_config
585-
- test_android:
586-
name: test_android_dream11
587-
<<: *dream11_prepare_config
588-
- test_ios:
589-
name: test_ios_dream11
590-
<<: *dream11_prepare_config
591-
- e2e_android:
592-
name: e2e_android_dream11
593-
<<: *dream11_prepare_config
594-
- e2e_ios:
595-
name: e2e_ios_dream11
596-
<<: *dream11_prepare_config
597-
598-
# Dream11 release
599518
- hold_release_dream11:
600-
requires:
601-
- test_module_dream11
602-
- test_android_dream11
603-
- test_ios_dream11
604-
- e2e_android_dream11
605-
- e2e_ios_dream11
519+
requires: *release_dependencies
606520
type: approval
607521
filters:
608522
branches:

0 commit comments

Comments
 (0)