Skip to content

Commit

Permalink
ci: run tests before enterprise releases (#1271)
Browse files Browse the repository at this point in the history
Signed-off-by: YoussefFouadd <yfouad@instabug.com>
  • Loading branch information
a7medev authored and YoussefFouadd committed Oct 16, 2024
1 parent 04aecbf commit 0d175e7
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 70 deletions.
151 changes: 125 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ references:
- e2e_ios
- e2e_android

dream11_prepare_config: &dream11_prepare_config
prepare_steps:
- prepare_dream11
requires:
- hold_test_dream11

commands:
install_node_modules:
parameters:
Expand All @@ -36,15 +42,28 @@ commands:
parameters:
working_directory:
type: string
deployment:
type: boolean
default: false
steps:
- restore_cache:
name: Restore Pods Cache
keys:
- v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
- run:
name: Install Pods
working_directory: << parameters.working_directory >>
command: pod install --deployment
- when:
condition: << parameters.deployment >>
steps:
- run:
name: Install Pods
working_directory: << parameters.working_directory >>
command: pod install --deployment
- unless:
condition: << parameters.deployment >>
steps:
- run:
name: Install Pods
working_directory: << parameters.working_directory >>
command: pod install
- save_cache:
name: Save Pods Cache
key: v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
Expand Down Expand Up @@ -120,6 +139,11 @@ commands:
name: Remove unused features
command: ./scripts/dream-11-delete-unused-features.sh
working_directory: << parameters.working_directory >>
# Remove the NDK package to avoid dependency conflicts on Android.
- run:
name: Remove the NDK package
command: yarn remove instabug-reactnative-ndk
working_directory: << parameters.working_directory >>/examples/default

notify_github:
parameters:
Expand Down Expand Up @@ -158,20 +182,38 @@ jobs:
command: yarn lint:ci

test_module:
parameters:
prepare_steps:
type: steps
default: []
collect_coverage:
type: boolean
default: false
executor:
name: node/default
steps:
- advanced-checkout/shallow-checkout
- steps: << parameters.prepare_steps >>
- install_node_modules
- run:
name: Run Tests
command: yarn test
- persist_to_workspace:
root: coverage
paths:
- lcov.info
- when:
condition: << parameters.collect_coverage >>
steps:
- persist_to_workspace:
root: coverage
paths:
- lcov.info

test_android:
parameters:
prepare_steps:
type: steps
default: []
collect_coverage:
type: boolean
default: false
executor:
name: android/android-machine
tag: '2024.01.1'
Expand All @@ -180,15 +222,18 @@ jobs:
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- advanced-checkout/shallow-checkout
# - node/install-yarn
- steps: << parameters.prepare_steps >>
- install_node_modules
- android/run-tests:
working-directory: android
test-command: ./gradlew test
- persist_to_workspace:
root: ~/project/android/build/reports/jacoco/jacocoTestReport
paths:
- jacocoTestReport.xml
- when:
condition: << parameters.collect_coverage >>
steps:
- persist_to_workspace:
root: ~/project/android/build/reports/jacoco/jacocoTestReport
paths:
- jacocoTestReport.xml

validate_shell_files:
machine:
Expand Down Expand Up @@ -217,10 +262,18 @@ jobs:
app-dir: examples/default
- install_pods:
working_directory: examples/default/ios
deployment: true
- run: git --no-pager diff
- run: git diff-index HEAD --exit-code -p -I EXCLUDED_ARCHS # Ignore Arch Changes

test_ios:
parameters:
prepare_steps:
type: steps
default: []
collect_coverage:
type: boolean
default: false
macos:
xcode: 13.4.1
resource_class: macos.m1.medium.gen1
Expand All @@ -229,6 +282,7 @@ jobs:
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- advanced-checkout/shallow-checkout
- steps: << parameters.prepare_steps >>
- install_node_modules
- install_pods:
working_directory: ios
Expand All @@ -243,23 +297,31 @@ jobs:
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
test | xcpretty
- run:
name: Convert xcresult into JSON report
working_directory: ios/coverage
command: xcrun xccov view --report --json result.xcresult > xcode.json
- persist_to_workspace:
root: ios/coverage
paths:
- xcode.json
- when:
condition: << parameters.collect_coverage >>
steps:
- run:
name: Convert xcresult into JSON report
working_directory: ios/coverage
command: xcrun xccov view --report --json result.xcresult > xcode.json
- persist_to_workspace:
root: ios/coverage
paths:
- xcode.json

e2e_ios:
parameters:
prepare_steps:
type: steps
default: []
macos:
xcode: 13.4.1
resource_class: macos.m1.medium.gen1
environment:
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- advanced-checkout/shallow-checkout
- steps: << parameters.prepare_steps >>
- install_node_modules
- node/install-packages:
pkg-manager: yarn
Expand All @@ -276,6 +338,11 @@ jobs:
name: Rebuild Detox.framework Cache
working_directory: examples/default
command: detox clean-framework-cache && detox build-framework-cache
# This is a workaround until the iOS SDK is updated to prioritize the custom
# Instabug.plist over the internal Config.plist.
- run:
name: Customize API Endpoints
command: ./scripts/customize-ios-endpoints.sh
- run:
name: Detox - Build Release App
working_directory: examples/default
Expand All @@ -286,6 +353,10 @@ jobs:
command: detox test --configuration ios.sim.release --cleanup

e2e_android:
parameters:
prepare_steps:
type: steps
default: []
executor:
name: android/android-machine
tag: '2024.01.1'
Expand All @@ -294,7 +365,7 @@ jobs:
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- advanced-checkout/shallow-checkout
# - node/install-yarn
- steps: << parameters.prepare_steps >>
- install_node_modules
- node/install-packages:
pkg-manager: yarn
Expand Down Expand Up @@ -439,11 +510,14 @@ workflows:
- test_android
- test_ios
- lint
- test_module
- test_android
- test_module:
collect_coverage: true
- test_android:
collect_coverage: true
- test_ios:
collect_coverage: true
- validate_shell_files
- sync_generated_files
- test_ios
- e2e_ios
- e2e_android
- hold_generate_snapshot:
Expand Down Expand Up @@ -515,8 +589,33 @@ workflows:
android_package: injazat
api_endpoint: st001013mec1.instabug.com

# Dream11 tests
- hold_test_dream11:
type: approval
- test_module:
name: test_module_dream11
<<: *dream11_prepare_config
- test_android:
name: test_android_dream11
<<: *dream11_prepare_config
- test_ios:
name: test_ios_dream11
<<: *dream11_prepare_config
- e2e_android:
name: e2e_android_dream11
<<: *dream11_prepare_config
- e2e_ios:
name: e2e_ios_dream11
<<: *dream11_prepare_config

# Dream11 release
- hold_release_dream11:
requires: *release_dependencies
requires:
- test_module_dream11
- test_android_dream11
- test_ios_dream11
- e2e_android_dream11
- e2e_ios_dream11
type: approval
filters:
branches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import com.instabug.reactlibrary.RNInstabugAPMModule;
import com.instabug.reactlibrary.RNInstabugBugReportingModule;
import com.instabug.reactlibrary.RNInstabugCrashReportingModule;
import com.instabug.reactlibrary.RNInstabugFeatureRequestsModule;
import com.instabug.reactlibrary.RNInstabugReactnativeModule;
import com.instabug.reactlibrary.RNInstabugRepliesModule;
import com.instabug.reactlibrary.RNInstabugSessionReplayModule;
import com.instabug.reactlibrary.RNInstabugSurveysModule;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"instabug-domain": "api.instabug.com",
"apm-domain": "api-apm.instabug.com"
}
8 changes: 8 additions & 0 deletions examples/default/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@ allprojects {
maven {
url("$rootDir/../node_modules/detox/Detox-android")
}

maven {
credentials {
username System.getenv("DREAM11_MAVEN_USERNAME")
password System.getenv("DREAM11_MAVEN_PASSWORD")
}
url "https://mvn.instabug.com/nexus/repository/dream-11"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
CC3DF8932A1DFC9A003E9914 /* InstabugSurveysTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */; };
CC3DF8942A1DFC9A003E9914 /* InstabugAPMTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */; };
CC3DF8952A1DFC9A003E9914 /* IBGConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */; };
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */ = {isa = PBXBuildFile; fileRef = CC487A9B2C71FCFC0021F680 /* Instabug.plist */; };
CCF1E4092B022CF20024802D /* RNInstabugTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF1E4082B022CF20024802D /* RNInstabugTests.m */; };
CD36F4707EA1F435D2CC7A15 /* libPods-InstabugExample-InstabugTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AF7A6E02D40E0CEEA833CC4 /* libPods-InstabugExample-InstabugTests.a */; };
F7BF47401EF3A435254C97BB /* libPods-InstabugExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BAED0D0441A708AE2390E153 /* libPods-InstabugExample.a */; };
Expand Down Expand Up @@ -64,6 +65,7 @@
CC3DF88B2A1DFC99003E9914 /* InstabugSurveysTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugSurveysTests.m; sourceTree = "<group>"; };
CC3DF88C2A1DFC99003E9914 /* InstabugAPMTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstabugAPMTests.m; sourceTree = "<group>"; };
CC3DF88D2A1DFC9A003E9914 /* IBGConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IBGConstants.m; sourceTree = "<group>"; };
CC487A9B2C71FCFC0021F680 /* Instabug.plist */ = {isa = PBXFileReference; lastKnownFileType = file.bplist; name = Instabug.plist; path = InstabugExample/Instabug.plist; sourceTree = "<group>"; };
CCF1E4082B022CF20024802D /* RNInstabugTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNInstabugTests.m; sourceTree = "<group>"; };
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>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -120,6 +122,7 @@
13B07FAE1A68108700A75B9A /* InstabugExample */ = {
isa = PBXGroup;
children = (
CC487A9B2C71FCFC0021F680 /* Instabug.plist */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
Expand Down Expand Up @@ -296,6 +299,7 @@
buildActionMask = 2147483647;
files = (
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
CC487A9C2C71FCFC0021F680 /* Instabug.plist in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file added examples/default/ios/InstabugExample/Instabug.plist
Binary file not shown.
1 change: 0 additions & 1 deletion examples/default/ios/InstabugTests/InstabugSampleTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "Instabug/Instabug.h"
#import "Instabug/IBGSurvey.h"
#import "InstabugReactBridge.h"
#import <Instabug/IBGTypes.h>
#import "IBGConstants.h"
Expand Down
1 change: 0 additions & 1 deletion examples/default/ios/InstabugTests/RNInstabugTests.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#import <XCTest/XCTest.h>
#import "OCMock/OCMock.h"
#import "Instabug/Instabug.h"
#import "Instabug/IBGSurvey.h"
#import <Instabug/IBGTypes.h>
#import "RNInstabug.h"
#import "RNInstabug/Instabug+CP.h"
Expand Down
1 change: 0 additions & 1 deletion ios/RNInstabug/InstabugReactBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#import <Instabug/Instabug.h>
#import <Instabug/IBGBugReporting.h>
#import <Instabug/IBGCrashReporting.h>
#import <Instabug/IBGSurveys.h>
#import <Instabug/IBGLog.h>
#import <Instabug/IBGTypes.h>
#import "ArgsRegistry.h"
Expand Down
1 change: 0 additions & 1 deletion ios/RNInstabug/InstabugReactBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <Instabug/Instabug.h>
#import <Instabug/IBGBugReporting.h>
#import <Instabug/IBGCrashReporting.h>
#import <Instabug/IBGSurveys.h>
#import <Instabug/IBGLog.h>
#import <Instabug/IBGAPM.h>
#import <asl.h>
Expand Down
Loading

0 comments on commit 0d175e7

Please sign in to comment.