Skip to content

Commit 3ca4e81

Browse files
Merge pull request #1305 from Instabug/chore/validate-release-post-check-job
ci: validate release post check job
2 parents 300780c + f066ba8 commit 3ca4e81

File tree

11 files changed

+376
-155
lines changed

11 files changed

+376
-155
lines changed

.circleci/config.yml

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,22 @@ commands:
154154
- run:
155155
name: Post comment on GitHub
156156
command: ./scripts/notify-github.sh "<< parameters.data >>"
157+
build_and_pack_sdk:
158+
parameters:
159+
working_directory:
160+
type: string
161+
default: ~/project
162+
steps:
163+
- install_node_modules
164+
- run:
165+
command: yarn build
166+
working_directory: ~/project
167+
- run:
168+
command: yarn pack --filename InstabugSDK.tgz
169+
working_directory: ~/project
170+
- run:
171+
command: yarn add file:../../InstabugSDK.tgz
172+
working_directory: <<parameters.working_directory>>
157173

158174
jobs:
159175
danger:
@@ -295,7 +311,7 @@ jobs:
295311
-scheme InstabugExample \
296312
-resultBundlePath coverage/result.xcresult \
297313
-sdk iphonesimulator \
298-
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
314+
-destination "platform=iOS Simulator,OS=15.5,name=iPhone 11 Pro Max" \
299315
test | xcpretty
300316
- when:
301317
condition: << parameters.collect_coverage >>
@@ -487,6 +503,50 @@ jobs:
487503
replace: $SNAPSHOT_VERSION
488504
- notify_github:
489505
data: "$(jq -Rcs '{ body: . }' scripts/snapshot-comment.md)"
506+
build_check_android:
507+
parameters:
508+
working_directory:
509+
type: string
510+
executor:
511+
name: android/android-machine
512+
tag: '2024.01.1'
513+
steps:
514+
- advanced-checkout/shallow-checkout
515+
- build_and_pack_sdk:
516+
working_directory: << parameters.working_directory >>
517+
- run:
518+
name: Build Android
519+
working_directory: <<parameters.working_directory>>/android
520+
command: ./gradlew assembleRelease
521+
522+
build_check_ios:
523+
parameters:
524+
working_directory:
525+
type: string
526+
scheme:
527+
type: string
528+
workspace_path:
529+
type: string
530+
macos:
531+
xcode: 13.4.1
532+
resource_class: macos.m1.medium.gen1
533+
steps:
534+
- advanced-checkout/shallow-checkout
535+
- build_and_pack_sdk:
536+
working_directory: << parameters.working_directory >>
537+
- install_pods:
538+
working_directory: <<parameters.working_directory>>/ios
539+
- run:
540+
name: Build iOS
541+
working_directory: <<parameters.working_directory>>/ios
542+
command: |
543+
yarn react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios
544+
rm -rf ~/Library/Developer/Xcode/DerivedData/*
545+
xcodebuild -workspace <<parameters.workspace_path>>.xcworkspace \
546+
-scheme <<parameters.scheme>> \
547+
-configuration Release \
548+
-sdk iphonesimulator \
549+
-destination "platform=iOS Simulator,OS=15.5,name=iPhone 11 Pro Max"
490550
491551
workflows:
492552
publish:
@@ -607,9 +667,37 @@ workflows:
607667
filters:
608668
branches:
609669
only: dream11
670+
- hold_build_check:
671+
type: approval
672+
- build_check_android:
673+
name: build_check_android_default
674+
working_directory: ~/project/examples/default
675+
requires:
676+
- hold_build_check
677+
- build_check_ios:
678+
name: build_check_ios_default
679+
working_directory: ~/project/examples/default
680+
scheme: InstabugExample
681+
workspace_path: InstabugExample
682+
requires:
683+
- hold_build_check
684+
- build_check_android:
685+
name: build_check_android_hybrid
686+
working_directory: ~/project/examples/hybrid
687+
requires:
688+
- hold_build_check
689+
- build_check_ios:
690+
name: build_check_ios_hybrid
691+
working_directory: ~/project/examples/hybrid
692+
scheme: HybridSampleApp
693+
workspace_path: HybridSampleApp
694+
requires:
695+
- hold_build_check
610696
- release_custom_package:
611697
name: release_dream11
612698
requires:
699+
- build_check_android_hybrid
700+
- build_check_ios_hybrid
613701
- hold_release_dream11
614702
filters:
615703
branches:

examples/hybrid/ios/HybridSampleApp.xcodeproj/project.pbxproj

Lines changed: 76 additions & 31 deletions
Large diffs are not rendered by default.

examples/hybrid/ios/HybridSampleApp.xcodeproj/xcshareddata/xcschemes/HybridSampleApp.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
</Testables>
5656
</TestAction>
5757
<LaunchAction
58-
buildConfiguration = "Debug"
58+
buildConfiguration = "Release"
5959
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
6060
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
6161
launchStyle = "0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#import <UIKit/UIKit.h>
22

33
@interface AppDelegate : UIResponder <UIApplicationDelegate>
4-
4+
@property (nonatomic, strong) UIWindow *window; // Add this property
55
@end

examples/hybrid/ios/HybridSampleApp/MainViewController.m

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,39 @@
22
#import <React/RCTRootView.h>
33
#import <Instabug/Instabug.h>
44
#import <Instabug/IBGCrashReporting.h>
5-
@interface MainViewController ()
6-
5+
#import <React/RCTBundleURLProvider.h>
6+
#import <React/RCTBridge.h>
7+
@interface MainViewController () <RCTBridgeDelegate>
8+
@property (nonatomic, strong) RCTBridge *bridge;
79
@end
810

911
@implementation MainViewController
1012

1113
- (void)viewDidLoad {
1214
[super viewDidLoad];
13-
// Do any additional setup after loading the view.
15+
self.bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
1416
}
15-
- (IBAction)startReactNative:(UIButton *)sender {
16-
NSURL *jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.bundle?platform=ios"];
1717

18-
RCTRootView *rootView =
19-
[[RCTRootView alloc] initWithBundleURL: jsCodeLocation
20-
moduleName: @"HybridSampleApp"
21-
initialProperties:nil
22-
launchOptions: nil];
23-
UIViewController *vc = [[UIViewController alloc] init];
24-
vc.view = rootView;
25-
[self presentViewController:vc animated:YES completion:nil];
18+
- (IBAction)startReactNative:(UIButton *)sender {
19+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:self.bridge
20+
moduleName:@"HybridSampleApp"
21+
initialProperties:nil];
22+
23+
UIViewController *vc = [[UIViewController alloc] init];
24+
vc.view = rootView;
25+
[self presentViewController:vc animated:YES completion:nil];
2626
}
2727

28+
// This will now be called by the bridge
29+
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
30+
{
31+
NSLog(@"sourceURLForBridge called!"); // This will now print
32+
#if DEBUG
33+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
34+
#else
35+
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
36+
#endif
37+
}
2838
- (IBAction)throwHandled:(UIButton *)sender {
2939
NSException *exception = [NSException exceptionWithName:@"Objective-C Handled Exception"
3040
reason:@"no reason"

examples/hybrid/ios/Podfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,27 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
55
platform :ios, '13.4'
66
prepare_react_native_project!
77

8+
linkage = ENV['USE_FRAMEWORKS']
9+
if linkage != nil
10+
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
11+
use_frameworks! :linkage => linkage.to_sym
12+
end
813

914
target 'HybridSampleApp' do
1015
config = use_native_modules!
16+
# Flags change depending on the env values.
17+
flags = get_default_flags()
1118

1219
use_react_native!(
1320
:path => config[:reactNativePath],
14-
:hermes_enabled => false,
1521
# Hermes is now enabled by default. Disable by setting this flag to false.
1622
# Upcoming versions of React Native may rely on get_default_flags(), but
1723
# we make it explicit here to aid in the React Native upgrade process.
24+
:hermes_enabled => flags[:hermes_enabled],
25+
:fabric_enabled => flags[:fabric_enabled],
1826
# An absolute path to your application root.
1927
:app_path => "#{Pod::Config.instance.installation_root}/.."
2028
)
21-
pod 'Instabug', '~> 13.4.2'
2229

2330
post_install do |installer|
2431
react_native_post_install(

0 commit comments

Comments
 (0)