Skip to content

Commit b5d757a

Browse files
authored
ci: run tests before enterprise releases (#1271)
1 parent 73b81f4 commit b5d757a

File tree

13 files changed

+231
-70
lines changed

13 files changed

+231
-70
lines changed

.circleci/config.yml

Lines changed: 125 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ 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+
2026
commands:
2127
install_node_modules:
2228
parameters:
@@ -36,15 +42,28 @@ commands:
3642
parameters:
3743
working_directory:
3844
type: string
45+
deployment:
46+
type: boolean
47+
default: false
3948
steps:
4049
- restore_cache:
4150
name: Restore Pods Cache
4251
keys:
4352
- v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
44-
- run:
45-
name: Install Pods
46-
working_directory: << parameters.working_directory >>
47-
command: pod install --deployment
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
4867
- save_cache:
4968
name: Save Pods Cache
5069
key: v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
@@ -120,6 +139,11 @@ commands:
120139
name: Remove unused features
121140
command: ./scripts/dream-11-delete-unused-features.sh
122141
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
123147

124148
notify_github:
125149
parameters:
@@ -158,20 +182,38 @@ jobs:
158182
command: yarn lint:ci
159183

160184
test_module:
185+
parameters:
186+
prepare_steps:
187+
type: steps
188+
default: []
189+
collect_coverage:
190+
type: boolean
191+
default: false
161192
executor:
162193
name: node/default
163194
steps:
164195
- advanced-checkout/shallow-checkout
196+
- steps: << parameters.prepare_steps >>
165197
- install_node_modules
166198
- run:
167199
name: Run Tests
168200
command: yarn test
169-
- persist_to_workspace:
170-
root: coverage
171-
paths:
172-
- lcov.info
201+
- when:
202+
condition: << parameters.collect_coverage >>
203+
steps:
204+
- persist_to_workspace:
205+
root: coverage
206+
paths:
207+
- lcov.info
173208

174209
test_android:
210+
parameters:
211+
prepare_steps:
212+
type: steps
213+
default: []
214+
collect_coverage:
215+
type: boolean
216+
default: false
175217
executor:
176218
name: android/android-machine
177219
tag: '2024.01.1'
@@ -180,15 +222,18 @@ jobs:
180222
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
181223
steps:
182224
- advanced-checkout/shallow-checkout
183-
# - node/install-yarn
225+
- steps: << parameters.prepare_steps >>
184226
- install_node_modules
185227
- android/run-tests:
186228
working-directory: android
187229
test-command: ./gradlew test
188-
- persist_to_workspace:
189-
root: ~/project/android/build/reports/jacoco/jacocoTestReport
190-
paths:
191-
- jacocoTestReport.xml
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
192237

193238
validate_shell_files:
194239
machine:
@@ -217,10 +262,18 @@ jobs:
217262
app-dir: examples/default
218263
- install_pods:
219264
working_directory: examples/default/ios
265+
deployment: true
220266
- run: git --no-pager diff
221267
- run: git diff-index HEAD --exit-code -p -I EXCLUDED_ARCHS # Ignore Arch Changes
222268

223269
test_ios:
270+
parameters:
271+
prepare_steps:
272+
type: steps
273+
default: []
274+
collect_coverage:
275+
type: boolean
276+
default: false
224277
macos:
225278
xcode: 13.4.1
226279
resource_class: macos.m1.medium.gen1
@@ -229,6 +282,7 @@ jobs:
229282
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
230283
steps:
231284
- advanced-checkout/shallow-checkout
285+
- steps: << parameters.prepare_steps >>
232286
- install_node_modules
233287
- install_pods:
234288
working_directory: ios
@@ -243,23 +297,31 @@ jobs:
243297
-sdk iphonesimulator \
244298
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
245299
test | xcpretty
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
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
254311

255312
e2e_ios:
313+
parameters:
314+
prepare_steps:
315+
type: steps
316+
default: []
256317
macos:
257318
xcode: 13.4.1
258319
resource_class: macos.m1.medium.gen1
259320
environment:
260321
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
261322
steps:
262323
- advanced-checkout/shallow-checkout
324+
- steps: << parameters.prepare_steps >>
263325
- install_node_modules
264326
- node/install-packages:
265327
pkg-manager: yarn
@@ -276,6 +338,11 @@ jobs:
276338
name: Rebuild Detox.framework Cache
277339
working_directory: examples/default
278340
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
279346
- run:
280347
name: Detox - Build Release App
281348
working_directory: examples/default
@@ -286,6 +353,10 @@ jobs:
286353
command: detox test --configuration ios.sim.release --cleanup
287354

288355
e2e_android:
356+
parameters:
357+
prepare_steps:
358+
type: steps
359+
default: []
289360
executor:
290361
name: android/android-machine
291362
tag: '2024.01.1'
@@ -294,7 +365,7 @@ jobs:
294365
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
295366
steps:
296367
- advanced-checkout/shallow-checkout
297-
# - node/install-yarn
368+
- steps: << parameters.prepare_steps >>
298369
- install_node_modules
299370
- node/install-packages:
300371
pkg-manager: yarn
@@ -439,11 +510,14 @@ workflows:
439510
- test_android
440511
- test_ios
441512
- lint
442-
- test_module
443-
- test_android
513+
- test_module:
514+
collect_coverage: true
515+
- test_android:
516+
collect_coverage: true
517+
- test_ios:
518+
collect_coverage: true
444519
- validate_shell_files
445520
- sync_generated_files
446-
- test_ios
447521
- e2e_ios
448522
- e2e_android
449523
- hold_generate_snapshot:
@@ -515,8 +589,33 @@ workflows:
515589
android_package: injazat
516590
api_endpoint: st001013mec1.instabug.com
517591

592+
# Dream11 tests
593+
- hold_test_dream11:
594+
type: approval
595+
- test_module:
596+
name: test_module_dream11
597+
<<: *dream11_prepare_config
598+
- test_android:
599+
name: test_android_dream11
600+
<<: *dream11_prepare_config
601+
- test_ios:
602+
name: test_ios_dream11
603+
<<: *dream11_prepare_config
604+
- e2e_android:
605+
name: e2e_android_dream11
606+
<<: *dream11_prepare_config
607+
- e2e_ios:
608+
name: e2e_ios_dream11
609+
<<: *dream11_prepare_config
610+
611+
# Dream11 release
518612
- hold_release_dream11:
519-
requires: *release_dependencies
613+
requires:
614+
- test_module_dream11
615+
- test_android_dream11
616+
- test_ios_dream11
617+
- e2e_android_dream11
618+
- e2e_ios_dream11
520619
type: approval
521620
filters:
522621
branches:

examples/default/android/app/src/main/java/com/instabug/react/example/RNInstabugExampleReactnativePackage.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
import com.facebook.react.bridge.NativeModule;
77
import com.facebook.react.bridge.ReactApplicationContext;
88
import com.facebook.react.uimanager.ViewManager;
9-
import com.instabug.reactlibrary.RNInstabugAPMModule;
10-
import com.instabug.reactlibrary.RNInstabugBugReportingModule;
11-
import com.instabug.reactlibrary.RNInstabugCrashReportingModule;
12-
import com.instabug.reactlibrary.RNInstabugFeatureRequestsModule;
13-
import com.instabug.reactlibrary.RNInstabugReactnativeModule;
14-
import com.instabug.reactlibrary.RNInstabugRepliesModule;
15-
import com.instabug.reactlibrary.RNInstabugSessionReplayModule;
16-
import com.instabug.reactlibrary.RNInstabugSurveysModule;
179

1810
import java.util.ArrayList;
1911
import java.util.Collections;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"instabug-domain": "api.instabug.com",
3+
"apm-domain": "api-apm.instabug.com"
4+
}

examples/default/android/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,13 @@ allprojects {
2727
maven {
2828
url("$rootDir/../node_modules/detox/Detox-android")
2929
}
30+
31+
maven {
32+
credentials {
33+
username System.getenv("DREAM11_MAVEN_USERNAME")
34+
password System.getenv("DREAM11_MAVEN_PASSWORD")
35+
}
36+
url "https://mvn.instabug.com/nexus/repository/dream-11"
37+
}
3038
}
3139
}

examples/default/ios/InstabugExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
CC3DF8932A1DFC9A003E9914 /* InstabugSurveysTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */; };
2222
CC3DF8942A1DFC9A003E9914 /* InstabugAPMTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */; };
2323
CC3DF8952A1DFC9A003E9914 /* IBGConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */; };
24+
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */ = {isa = PBXBuildFile; fileRef = CC487A9B2C71FCFC0021F680 /* Instabug.plist */; };
2425
CCF1E4092B022CF20024802D /* RNInstabugTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF1E4082B022CF20024802D /* RNInstabugTests.m */; };
2526
CD36F4707EA1F435D2CC7A15 /* libPods-InstabugExample-InstabugTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AF7A6E02D40E0CEEA833CC4 /* libPods-InstabugExample-InstabugTests.a */; };
2627
F7BF47401EF3A435254C97BB /* libPods-InstabugExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BAED0D0441A708AE2390E153 /* libPods-InstabugExample.a */; };
@@ -64,6 +65,7 @@
6465
CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugSurveysTests.m; sourceTree = "<group>"; };
6566
CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugAPMTests.m; sourceTree = "<group>"; };
6667
CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IBGConstants.m; sourceTree = "<group>"; };
68+
CC487A9B2C71FCFC0021F680 /* Instabug.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = Instabug.plist; path = InstabugExample/Instabug.plist; sourceTree = "<group>"; };
6769
CCF1E4082B022CF20024802D /* RNInstabugTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNInstabugTests.m; sourceTree = "<group>"; };
6870
DBCB1B1D023646D84146C91E /* Pods-InstabugExample-InstabugTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-InstabugExample-InstabugTests.release.xcconfig"; path = "Target Support Files/Pods-InstabugExample-InstabugTests/Pods-InstabugExample-InstabugTests.release.xcconfig"; sourceTree = "<group>"; };
6971
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
@@ -120,6 +122,7 @@
120122
13B07FAE1A68108700A75B9A /* InstabugExample */ = {
121123
isa = PBXGroup;
122124
children = (
125+
CC487A9B2C71FCFC0021F680 /* Instabug.plist */,
123126
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
124127
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
125128
13B07FB51A68108700A75B9A /* Images.xcassets */,
@@ -296,6 +299,7 @@
296299
buildActionMask = 2147483647;
297300
files = (
298301
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
302+
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */,
299303
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
300304
);
301305
runOnlyForDeploymentPostprocessing = 0;
157 Bytes
Binary file not shown.

examples/default/ios/InstabugTests/InstabugSampleTests.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#import <XCTest/XCTest.h>
99
#import "OCMock/OCMock.h"
1010
#import "Instabug/Instabug.h"
11-
#import "Instabug/IBGSurvey.h"
1211
#import "InstabugReactBridge.h"
1312
#import <Instabug/IBGTypes.h>
1413
#import "IBGConstants.h"

examples/default/ios/InstabugTests/RNInstabugTests.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#import <XCTest/XCTest.h>
22
#import "OCMock/OCMock.h"
33
#import "Instabug/Instabug.h"
4-
#import "Instabug/IBGSurvey.h"
54
#import <Instabug/IBGTypes.h>
65
#import "RNInstabug.h"
76
#import "RNInstabug/Instabug+CP.h"

ios/RNInstabug/InstabugReactBridge.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#import <Instabug/Instabug.h>
1313
#import <Instabug/IBGBugReporting.h>
1414
#import <Instabug/IBGCrashReporting.h>
15-
#import <Instabug/IBGSurveys.h>
1615
#import <Instabug/IBGLog.h>
1716
#import <Instabug/IBGTypes.h>
1817
#import "ArgsRegistry.h"

ios/RNInstabug/InstabugReactBridge.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#import <Instabug/Instabug.h>
99
#import <Instabug/IBGBugReporting.h>
1010
#import <Instabug/IBGCrashReporting.h>
11-
#import <Instabug/IBGSurveys.h>
1211
#import <Instabug/IBGLog.h>
1312
#import <Instabug/IBGAPM.h>
1413
#import <asl.h>

0 commit comments

Comments
 (0)