Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUM-6769 migrate CI to Gitlab #736

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
include:
- 'https://gitlab-templates.ddbuild.io/slack-notifier/v1/template.yml'

# SETUP

variables:
GIT_DEPTH: 5

ANDROID_SDK_VERSION: "commandlinetools-mac-11076708_latest"
EMULATOR_NAME: "android_emulator"
ANDROID_ARCH: "arm64-v8a"
ANDROID_API: "35"
ANDROID_EMULATOR_IMAGE: "system-images;android-$ANDROID_API;google_apis;${ANDROID_ARCH}"
ANDROID_PLATFORM: "platforms;android-$ANDROID_API"
ANDROID_BUILD_TOOLS: "build-tools;$ANDROID_API.0.0"
# KUBERNETES_MEMORY_REQUEST: "8Gi"
# KUBERNETES_MEMORY_LIMIT: "13Gi"


stages:
- test
- notify


.snippets:
install-jdk-17:
- brew install openjdk@17
install-android-sdk:
- curl -sSL -o commandlinetools.zip https://dl.google.com/android/repository/$ANDROID_SDK_VERSION.zip
- rm -rf ~/android_sdk
- rm -rf ~/cmdline-tools
- unzip -q commandlinetools -d ~/
- mkdir -p ~/android_sdk/cmdline-tools/latest
- mv ~/cmdline-tools/* ~/android_sdk/cmdline-tools/latest
- rm ./commandlinetools.zip
- export ANDROID_HOME="$HOME/android_sdk/"
- export ANDROID_SDK_ROOT="$HOME/android_sdk/"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "emulator"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_PLATFORM"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_BUILD_TOOLS"
- echo y | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --install "$ANDROID_EMULATOR_IMAGE"
- yes | ~/android_sdk/cmdline-tools/latest/bin/sdkmanager --licenses || true
- echo "no" | ~/android_sdk/cmdline-tools/latest/bin/avdmanager --verbose create avd --force --name "$EMULATOR_NAME" --package "$ANDROID_EMULATOR_IMAGE"

# TESTS

test:lint:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- yarn
- yarn run lint

test:js:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- yarn
- cp jestSetup.js.override node_modules/react-native-gesture-handler/jestSetup.js
- NODE_OPTIONS='-r dd-trace/ci/init' DD_ENV=ci DD_SERVICE=dd-sdk-reactnative yarn test

test:build:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- yarn
- yarn prepare

test:native-android:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- !reference [.snippets, install-android-sdk]
- !reference [.snippets, install-jdk-17]
- /opt/homebrew/opt/openjdk@17/bin/java --version
- echo "org.gradle.java.home=/opt/homebrew/opt/openjdk@17" >> packages/core/android/gradle.properties
- echo "org.gradle.java.home=/opt/homebrew/opt/openjdk@17" >> packages/react-native-session-replay/android/gradle.properties
- echo "org.gradle.java.home=/opt/homebrew/opt/openjdk@17" >> packages/internal-testing-tools/android/gradle.properties
- yarn
- (cd packages/core/android && ./gradlew build)
- (cd packages/react-native-session-replay/android && ./gradlew build)
- (cd packages/internal-testing-tools/android && ./gradlew build)

test:native-ios:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- yarn
- (cd example/ios && pod install --no-repo-update)
- set -o pipefail && xcodebuild -workspace example/ios/DdSdkReactNativeExample.xcworkspace -scheme DatadogSDKReactNative test -destination "platform=iOS Simulator,OS=16.0,name=iPhone 14 Pro Max"

test:native-ios-sr:
tags: [ "macos:sonoma" ]
stage: test
timeout: 1h
script:
- yarn
- (cd example/ios && pod install --no-repo-update)
- set -o pipefail && xcodebuild -workspace example/ios/DdSdkReactNativeExample.xcworkspace -scheme DatadogSDKReactNativeSessionReplay test -destination "platform=iOS Simulator,OS=16.0,name=iPhone 14 Pro Max"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 14 additions & 0 deletions jestSetup.js.override
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { NativeModules as RNNativeModules } from "react-native";

RNNativeModules.RNGestureHandlerModule = RNNativeModules.RNGestureHandlerModule || {
State: { BEGAN: "BEGAN", FAILED: "FAILED", ACTIVE: "ACTIVE", END: "END" },
attachGestureHandler: jest.fn(),
createGestureHandler: jest.fn(),
dropGestureHandler: jest.fn(),
updateGestureHandler: jest.fn(),

};

RNNativeModules.PlatformConstants = RNNativeModules.PlatformConstants || {
forceTouchAvailable: false
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion packages/core/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Uncomment here and in build.gradle for getting rid of IDE errors for new architecture:
//includeBuild('../../../node_modules/react-native-gradle-plugin')
//includeBuild('../../../node_modules/react-native-gradle-plugin')
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading