diff --git a/.circleci/config.yml b/.circleci/config.yml index efca5acab3..aa906f25f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -154,6 +154,22 @@ commands: - run: name: Post comment on GitHub command: ./scripts/notify-github.sh "<< parameters.data >>" + build_and_pack_sdk: + parameters: + working_directory: + type: string + default: ~/project + steps: + - install_node_modules + - run: + command: yarn build + working_directory: ~/project + - run: + command: yarn pack --filename InstabugSDK.tgz + working_directory: ~/project + - run: + command: yarn add file:../../InstabugSDK.tgz + working_directory: <> jobs: danger: @@ -295,7 +311,7 @@ jobs: -scheme InstabugExample \ -resultBundlePath coverage/result.xcresult \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \ + -destination "platform=iOS Simulator,OS=15.5,name=iPhone 11 Pro Max" \ test | xcpretty - when: condition: << parameters.collect_coverage >> @@ -487,6 +503,50 @@ jobs: replace: $SNAPSHOT_VERSION - notify_github: data: "$(jq -Rcs '{ body: . }' scripts/snapshot-comment.md)" + build_check_android: + parameters: + working_directory: + type: string + executor: + name: android/android-machine + tag: '2024.01.1' + steps: + - advanced-checkout/shallow-checkout + - build_and_pack_sdk: + working_directory: << parameters.working_directory >> + - run: + name: Build Android + working_directory: <>/android + command: ./gradlew assembleRelease + + build_check_ios: + parameters: + working_directory: + type: string + scheme: + type: string + workspace_path: + type: string + macos: + xcode: 13.4.1 + resource_class: macos.m1.medium.gen1 + steps: + - advanced-checkout/shallow-checkout + - build_and_pack_sdk: + working_directory: << parameters.working_directory >> + - install_pods: + working_directory: <>/ios + - run: + name: Build iOS + working_directory: <>/ios + command: | + yarn react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle --assets-dest ios + rm -rf ~/Library/Developer/Xcode/DerivedData/* + xcodebuild -workspace <>.xcworkspace \ + -scheme <> \ + -configuration Release \ + -sdk iphonesimulator \ + -destination "platform=iOS Simulator,OS=15.5,name=iPhone 11 Pro Max" workflows: publish: @@ -607,9 +667,37 @@ workflows: filters: branches: only: dream11 + - hold_build_check: + type: approval + - build_check_android: + name: build_check_android_default + working_directory: ~/project/examples/default + requires: + - hold_build_check + - build_check_ios: + name: build_check_ios_default + working_directory: ~/project/examples/default + scheme: InstabugExample + workspace_path: InstabugExample + requires: + - hold_build_check + - build_check_android: + name: build_check_android_hybrid + working_directory: ~/project/examples/hybrid + requires: + - hold_build_check + - build_check_ios: + name: build_check_ios_hybrid + working_directory: ~/project/examples/hybrid + scheme: HybridSampleApp + workspace_path: HybridSampleApp + requires: + - hold_build_check - release_custom_package: name: release_dream11 requires: + - build_check_android_hybrid + - build_check_ios_hybrid - hold_release_dream11 filters: branches: diff --git a/.gitignore b/.gitignore index 4033aaa3b6..16572b4817 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ yarn-debug.log yarn-error.log coverage/ .jest/cache/ +.yarn # OSX .DS_Store @@ -62,7 +63,8 @@ android/keystores/debug.keystore # Bundle artifact *.jsbundle -/examples/default/ios/main.jsbundle.map +*.bundle +main.jsbundle.map # Vscode local history .history/ diff --git a/examples/hybrid/.eslintrc.js b/examples/hybrid/.eslintrc.js new file mode 100644 index 0000000000..40c6dcd05f --- /dev/null +++ b/examples/hybrid/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native-community', +}; diff --git a/examples/hybrid/.watchmanconfig b/examples/hybrid/.watchmanconfig new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/examples/hybrid/.watchmanconfig @@ -0,0 +1 @@ +{} diff --git a/examples/hybrid/App.tsx b/examples/hybrid/App.tsx new file mode 100644 index 0000000000..24e24357cf --- /dev/null +++ b/examples/hybrid/App.tsx @@ -0,0 +1,100 @@ +/* eslint-disable react-native/no-inline-styles */ +import { ReactNode, useEffect } from 'react'; +import React from 'react'; +import CodePush from 'react-native-code-push'; +import axios from 'axios'; +import { Button, Image, Platform, SafeAreaView, Text } from 'react-native'; +import Instabug, { + CrashReporting, + InvocationEvent, + LogLevel, + NetworkInterceptionMode, + ReproStepsMode, +} from 'instabug-reactnative'; + +const throwHandled = () => { + try { + throw Error('This is a handled JS Crash'); + } catch (err) { + if (err instanceof Error) { + CrashReporting.reportError(err); + } + } +}; + +const throwUnhandled = () => { + throw Error('This is an unhandled JS Crash'); +}; + +const sendGraphQLRequest = async () => { + try { + const response = await axios.post( + 'https://countries.trevorblades.com/graphql', + { + query: ` + query GetCountry { + country(code: "EG") { + emoji + name + } + } + `, + }, + { + headers: { + 'Content-Type': 'application/json', + 'ibg-graphql-header': 'GetCountry', + }, + }, + ); + console.log('Response:', response.data.data); + } catch (error) { + console.error('Error:', error); + } +}; + +const App: () => ReactNode = () => { + useEffect(() => { + Instabug.init({ + token: '0fcc87b8bf731164828cc411eccc802a', + invocationEvents: [InvocationEvent.floatingButton], + networkInterceptionMode: + Platform.OS === 'ios' ? NetworkInterceptionMode.native : NetworkInterceptionMode.javascript, + debugLogsLevel: LogLevel.verbose, + }); + CodePush.getUpdateMetadata().then((metadata) => { + if (metadata) { + Instabug.setCodePushVersion(metadata.label); + } + }); + CrashReporting.setNDKCrashesEnabled(true); + Instabug.setReproStepsConfig({ + all: ReproStepsMode.enabled, + }); + }, []); + + return ( + + + React Native App +