2017-11-06 23:45:48 +00:00
|
|
|
defaults: &defaults
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
orbs:
|
|
|
|
android: circleci/android@2.1.2
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
macos: &macos
|
|
|
|
macos:
|
2023-01-20 16:55:53 +00:00
|
|
|
xcode: "14.2.0"
|
2021-07-28 20:36:06 +00:00
|
|
|
resource_class: large
|
2020-05-20 16:33:40 +00:00
|
|
|
|
|
|
|
bash-env: &bash-env
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
android-env: &android-env
|
|
|
|
JAVA_OPTS: '-Xms512m -Xmx2g'
|
|
|
|
GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"'
|
|
|
|
TERM: dumb
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
install-npm-modules: &install-npm-modules
|
|
|
|
name: Install NPM modules
|
|
|
|
command: yarn
|
|
|
|
|
|
|
|
restore-npm-cache-linux: &restore-npm-cache-linux
|
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
|
|
|
|
|
|
save-npm-cache-linux: &save-npm-cache-linux
|
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
|
|
name: Save NPM cache
|
|
|
|
paths:
|
|
|
|
- ./node_modules
|
|
|
|
|
|
|
|
restore-npm-cache-mac: &restore-npm-cache-mac
|
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
|
|
|
|
save-npm-cache-mac: &save-npm-cache-mac
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
name: Save NPM cache
|
|
|
|
paths:
|
|
|
|
- ./node_modules
|
|
|
|
|
|
|
|
restore-gems-cache: &restore-gems-cache
|
|
|
|
name: Restore gems cache
|
2023-03-30 20:10:40 +00:00
|
|
|
key: *gems_cache_key
|
2020-05-20 16:33:40 +00:00
|
|
|
|
|
|
|
save-gems-cache: &save-gems-cache
|
|
|
|
name: Save gems cache
|
2023-03-30 20:10:40 +00:00
|
|
|
key: *gems_cache_key
|
2020-05-20 16:33:40 +00:00
|
|
|
paths:
|
|
|
|
- vendor/bundle
|
|
|
|
|
2020-06-16 13:31:07 +00:00
|
|
|
update-fastlane-ios: &update-fastlane-ios
|
2020-05-20 16:33:40 +00:00
|
|
|
name: Update Fastlane
|
|
|
|
command: |
|
|
|
|
bundle install
|
|
|
|
working_directory: ios
|
|
|
|
|
2020-06-16 13:31:07 +00:00
|
|
|
update-fastlane-android: &update-fastlane-android
|
|
|
|
name: Update Fastlane
|
|
|
|
command: |
|
|
|
|
bundle install
|
|
|
|
working_directory: android
|
|
|
|
|
|
|
|
save-gradle-cache: &save-gradle-cache
|
|
|
|
name: Save gradle cache
|
|
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
|
|
|
|
restore_cache: &restore-gradle-cache
|
|
|
|
name: Restore gradle cache
|
|
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
|
|
|
2023-03-30 20:13:40 +00:00
|
|
|
references:
|
|
|
|
cache_keys:
|
|
|
|
gems_cache_key: &gems_cache_key v1-gems-{{ checksum "Gemfile.lock" }}
|
|
|
|
rbenv_cache_key: &rbenv_cache_key v1-rbenv-{{ checksum "/tmp/required_ruby" }}
|
2023-03-30 20:10:40 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
# COMMANDS
|
|
|
|
commands:
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2021-07-21 15:50:39 +00:00
|
|
|
manage-pods:
|
|
|
|
description: "Restore/Get/Save cache of pods libs"
|
|
|
|
steps:
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore pods
|
2022-08-08 21:02:08 +00:00
|
|
|
key: pods-v1-{{ checksum "ios/Podfile.lock" }}
|
2021-07-21 15:50:39 +00:00
|
|
|
- run:
|
|
|
|
name: Install pods libs
|
|
|
|
command: |
|
2022-08-08 21:02:08 +00:00
|
|
|
bundle exec pod install --deployment
|
2021-07-21 15:50:39 +00:00
|
|
|
working_directory: ios
|
|
|
|
- save_cache:
|
|
|
|
name: Save pods specs and pods cache
|
2022-08-08 21:02:08 +00:00
|
|
|
key: pods-v1-{{ checksum "ios/Podfile.lock" }}
|
2021-07-21 15:50:39 +00:00
|
|
|
paths:
|
|
|
|
- ~/.pods
|
|
|
|
- ios/Pods
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
android-build:
|
|
|
|
description: "Build Android app"
|
2017-11-06 23:45:48 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
- restore_cache: *restore-npm-cache-linux
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2020-05-20 16:33:40 +00:00
|
|
|
- run: *install-npm-modules
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2020-06-16 13:31:07 +00:00
|
|
|
- restore_cache: *restore-gradle-cache
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
2017-11-07 17:29:32 +00:00
|
|
|
name: Configure Gradle
|
2017-11-06 23:45:48 +00:00
|
|
|
command: |
|
2018-01-10 02:35:31 +00:00
|
|
|
echo -e "" > ./gradle.properties
|
2019-08-07 13:51:34 +00:00
|
|
|
# echo -e "android.enableAapt2=false" >> ./gradle.properties
|
|
|
|
echo -e "android.useAndroidX=true" >> ./gradle.properties
|
|
|
|
echo -e "android.enableJetifier=true" >> ./gradle.properties
|
2022-08-08 21:02:08 +00:00
|
|
|
echo -e "newArchEnabled=false" >> ./gradle.properties
|
|
|
|
echo -e "FLIPPER_VERSION=0.125.0" >> ./gradle.properties
|
2020-12-04 16:17:29 +00:00
|
|
|
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
|
2018-01-10 02:35:31 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
|
|
|
|
echo -e "APPLICATION_ID=chat.rocket.android" >> ./gradle.properties
|
|
|
|
echo -e "BugsnagAPIKey=$BUGSNAG_KEY_OFFICIAL" >> ./gradle.properties
|
2023-01-18 22:15:22 +00:00
|
|
|
echo $KEYSTORE_OFFICIAL_BASE64 | base64 --decode > ./app/$KEYSTORE_OFFICIAL
|
2020-12-14 16:20:32 +00:00
|
|
|
echo -e "KEYSTORE=$KEYSTORE_OFFICIAL" >> ./gradle.properties
|
2023-01-18 22:15:22 +00:00
|
|
|
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_OFFICIAL_PASSWORD" >> ./gradle.properties
|
|
|
|
echo -e "KEY_ALIAS=$KEYSTORE_OFFICIAL_ALIAS" >> ./gradle.properties
|
|
|
|
echo -e "KEY_PASSWORD=$KEYSTORE_OFFICIAL_PASSWORD" >> ./gradle.properties
|
2020-12-14 16:20:32 +00:00
|
|
|
else
|
|
|
|
echo -e "APPLICATION_ID=chat.rocket.reactnative" >> ./gradle.properties
|
|
|
|
echo -e "BugsnagAPIKey=$BUGSNAG_KEY" >> ./gradle.properties
|
2023-01-18 22:15:22 +00:00
|
|
|
echo $KEYSTORE_EXPERIMENTAL_BASE64 | base64 --decode > ./app/$KEYSTORE_EXPERIMENTAL
|
|
|
|
echo -e "KEYSTORE=$KEYSTORE_EXPERIMENTAL" >> ./gradle.properties
|
|
|
|
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_EXPERIMENTAL_PASSWORD" >> ./gradle.properties
|
|
|
|
echo -e "KEY_ALIAS=$KEYSTORE_EXPERIMENTAL_ALIAS" >> ./gradle.properties
|
|
|
|
echo -e "KEY_PASSWORD=$KEYSTORE_EXPERIMENTAL_PASSWORD" >> ./gradle.properties
|
2018-01-10 02:35:31 +00:00
|
|
|
fi
|
2020-02-05 16:44:31 +00:00
|
|
|
working_directory: android
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2019-05-31 12:41:37 +00:00
|
|
|
- run:
|
|
|
|
name: Set Google Services
|
|
|
|
command: |
|
2023-01-18 22:15:22 +00:00
|
|
|
if [[ $GOOGLE_SERVICES_ANDROID ]]; then
|
2020-08-17 17:36:23 +00:00
|
|
|
echo $GOOGLE_SERVICES_ANDROID | base64 --decode > google-services.json
|
|
|
|
fi
|
2020-12-14 16:20:32 +00:00
|
|
|
working_directory: android/app
|
2019-08-23 13:18:47 +00:00
|
|
|
|
2017-11-07 17:29:32 +00:00
|
|
|
- run:
|
2020-12-14 16:20:32 +00:00
|
|
|
name: Build App
|
2017-11-07 17:29:32 +00:00
|
|
|
command: |
|
2020-12-14 16:20:32 +00:00
|
|
|
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
|
|
|
|
./gradlew bundleOfficialPlayRelease
|
|
|
|
fi
|
2022-05-11 02:42:35 +00:00
|
|
|
if [[ $CIRCLE_JOB == "android-build-experimental" || "android-automatic-build-experimental" ]]; then
|
2020-12-14 16:20:32 +00:00
|
|
|
./gradlew bundleExperimentalPlayRelease
|
|
|
|
fi
|
2023-01-18 22:15:22 +00:00
|
|
|
if [[ ! $GOOGLE_SERVICES_ANDROID ]]; then
|
2020-12-14 16:20:32 +00:00
|
|
|
./gradlew assembleExperimentalPlayDebug
|
2018-01-10 02:35:31 +00:00
|
|
|
fi
|
2020-02-05 16:44:31 +00:00
|
|
|
working_directory: android
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2020-02-14 19:12:06 +00:00
|
|
|
- run:
|
|
|
|
name: Upload sourcemaps to Bugsnag
|
|
|
|
command: |
|
2020-12-14 16:20:32 +00:00
|
|
|
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
|
2021-07-28 20:36:06 +00:00
|
|
|
npx bugsnag-source-maps upload-react-native \
|
2020-12-14 16:20:32 +00:00
|
|
|
--api-key=$BUGSNAG_KEY_OFFICIAL \
|
2021-07-28 20:36:06 +00:00
|
|
|
--app-version-code=$CIRCLE_BUILD_NUM \
|
|
|
|
--platform android \
|
2020-12-14 16:20:32 +00:00
|
|
|
--source-map=android/app/build/generated/sourcemaps/react/officialPlay/release/app.bundle.map \
|
2021-07-28 20:36:06 +00:00
|
|
|
--bundle android/app/build/generated/assets/react/officialPlay/release/app.bundle
|
2020-02-14 19:12:06 +00:00
|
|
|
fi
|
2022-05-11 02:42:35 +00:00
|
|
|
if [[ $CIRCLE_JOB == "android-build-experimental" || "android-automatic-build-experimental" ]]; then
|
2021-07-28 20:36:06 +00:00
|
|
|
npx bugsnag-source-maps upload-react-native \
|
2020-12-14 16:20:32 +00:00
|
|
|
--api-key=$BUGSNAG_KEY \
|
2021-07-28 20:36:06 +00:00
|
|
|
--app-version-code=$CIRCLE_BUILD_NUM \
|
|
|
|
--platform android \
|
2020-12-14 16:20:32 +00:00
|
|
|
--source-map=android/app/build/generated/sourcemaps/react/experimentalPlay/release/app.bundle.map \
|
2021-07-28 20:36:06 +00:00
|
|
|
--bundle android/app/build/generated/assets/react/experimentalPlay/release/app.bundle
|
2020-08-24 12:24:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: android/app/build/outputs
|
|
|
|
|
|
|
|
- save_cache: *save-npm-cache-linux
|
|
|
|
|
|
|
|
- save_cache: *save-gradle-cache
|
|
|
|
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- android/app/build/outputs
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
ios-build:
|
2020-12-14 16:20:32 +00:00
|
|
|
description: "Build iOS app"
|
2017-11-06 23:45:48 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-05-20 16:33:40 +00:00
|
|
|
- restore_cache: *restore-gems-cache
|
|
|
|
- restore_cache: *restore-npm-cache-mac
|
2023-03-30 20:10:40 +00:00
|
|
|
- setup_ruby:
|
|
|
|
ruby_version: 2.7.5
|
2020-05-20 16:33:40 +00:00
|
|
|
- run: *install-npm-modules
|
2020-06-16 13:31:07 +00:00
|
|
|
- run: *update-fastlane-ios
|
2021-07-21 15:50:39 +00:00
|
|
|
- manage-pods
|
2019-05-31 12:41:37 +00:00
|
|
|
- run:
|
|
|
|
name: Set Google Services
|
|
|
|
command: |
|
2023-01-18 22:15:22 +00:00
|
|
|
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
|
|
|
|
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
|
|
|
|
echo $GOOGLE_SERVICES_IOS | base64 --decode > GoogleService-Info.plist
|
|
|
|
else
|
|
|
|
echo $GOOGLE_SERVICES_IOS_EXPERIMENTAL | base64 --decode > GoogleService-Info.plist
|
|
|
|
fi
|
2020-08-17 17:36:23 +00:00
|
|
|
fi
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Fastlane Build
|
2021-07-21 15:50:39 +00:00
|
|
|
no_output_timeout: 40m
|
2017-11-06 23:45:48 +00:00
|
|
|
command: |
|
2017-11-07 16:58:33 +00:00
|
|
|
agvtool new-version -all $CIRCLE_BUILD_NUM
|
2020-12-14 16:20:32 +00:00
|
|
|
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
|
2021-07-28 20:36:06 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./RocketChatRN/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY_OFFICIAL" ./ShareRocketChatRN/Info.plist
|
2020-12-14 16:20:32 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./RocketChatRN/Info.plist
|
2021-03-05 13:42:04 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./ShareRocketChatRN/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./NotificationService/Info.plist
|
2020-12-14 16:20:32 +00:00
|
|
|
else
|
2021-07-28 20:36:06 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./RocketChatRN/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./ShareRocketChatRN/Info.plist
|
2020-12-14 16:20:32 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./RocketChatRN/Info.plist
|
2021-03-05 13:42:04 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./ShareRocketChatRN/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./NotificationService/Info.plist
|
2020-12-14 16:20:32 +00:00
|
|
|
fi
|
2018-01-10 02:35:31 +00:00
|
|
|
|
2023-01-18 22:15:22 +00:00
|
|
|
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
|
|
|
|
echo $APP_STORE_CONNECT_API_KEY_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
|
2020-12-14 16:20:32 +00:00
|
|
|
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
|
|
|
|
bundle exec fastlane ios build_official
|
|
|
|
else
|
2023-01-18 22:15:22 +00:00
|
|
|
if [[ $APP_STORE_CONNECT_API_KEY_BASE64 ]]; then
|
2020-12-17 12:55:48 +00:00
|
|
|
bundle exec fastlane ios build_experimental
|
2020-12-14 16:20:32 +00:00
|
|
|
else
|
|
|
|
bundle exec fastlane ios build_fork
|
|
|
|
fi
|
|
|
|
fi
|
2018-01-10 02:35:31 +00:00
|
|
|
fi
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2020-05-20 16:33:40 +00:00
|
|
|
- save_cache: *save-npm-cache-mac
|
|
|
|
- save_cache: *save-gems-cache
|
2017-11-06 23:45:48 +00:00
|
|
|
- store_artifacts:
|
2020-12-14 16:20:32 +00:00
|
|
|
path: ios/Rocket.Chat.ipa
|
|
|
|
- store_artifacts:
|
|
|
|
path: ios/Rocket.Chat.app.dSYM.zip
|
2017-11-06 23:45:48 +00:00
|
|
|
- persist_to_workspace:
|
2018-01-10 21:06:19 +00:00
|
|
|
root: .
|
2017-11-06 23:45:48 +00:00
|
|
|
paths:
|
2018-01-10 21:06:19 +00:00
|
|
|
- ios/*.ipa
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios/*.zip
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
upload-to-google-play-beta:
|
|
|
|
description: "Upload to Google Play beta"
|
|
|
|
parameters:
|
|
|
|
official:
|
|
|
|
type: boolean
|
2017-11-06 23:45:48 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2020-12-14 16:20:32 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: android
|
|
|
|
- run:
|
|
|
|
name: Store the google service account key
|
|
|
|
command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json
|
|
|
|
working_directory: android
|
|
|
|
- run: *update-fastlane-android
|
|
|
|
- run:
|
|
|
|
name: Fastlane Play Store Upload
|
|
|
|
command: bundle exec fastlane android beta official:<< parameters.official >>
|
|
|
|
working_directory: android
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2021-07-19 21:04:45 +00:00
|
|
|
# EXPERIMENTAL ONLY
|
|
|
|
upload-to-internal-app-sharing:
|
|
|
|
description: "Upload to Internal App Sharing"
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: android
|
|
|
|
- run:
|
|
|
|
name: Store the google service account key
|
|
|
|
command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json
|
|
|
|
working_directory: android
|
|
|
|
- run: *update-fastlane-android
|
|
|
|
- run:
|
|
|
|
name: Fastlane Play Store Upload
|
|
|
|
command: bundle exec fastlane android internal_app_sharing
|
|
|
|
working_directory: android
|
|
|
|
|
2021-04-13 18:41:55 +00:00
|
|
|
# EXPERIMENTAL ONLY
|
|
|
|
# No plans to do it for Official
|
|
|
|
upload-to-google-play-production:
|
|
|
|
description: "Upload to Google Play production"
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: android
|
|
|
|
- run:
|
|
|
|
name: Store the google service account key
|
|
|
|
command: echo "$FASTLANE_GOOGLE_SERVICE_ACCOUNT" | base64 --decode > service_account.json
|
|
|
|
working_directory: android
|
|
|
|
- run: *update-fastlane-android
|
|
|
|
- run:
|
|
|
|
name: Fastlane Play Store Upload
|
|
|
|
command: bundle exec fastlane android production
|
|
|
|
working_directory: android
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
upload-to-testflight:
|
|
|
|
description: "Upload to TestFlight"
|
|
|
|
parameters:
|
|
|
|
official:
|
|
|
|
type: boolean
|
|
|
|
steps:
|
|
|
|
- checkout
|
2017-11-06 23:45:48 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: ios
|
2020-05-20 16:33:40 +00:00
|
|
|
- restore_cache: *restore-gems-cache
|
2021-07-21 15:50:39 +00:00
|
|
|
- restore_cache: *restore-npm-cache-mac
|
2020-06-16 13:31:07 +00:00
|
|
|
- run: *update-fastlane-ios
|
2021-07-21 15:50:39 +00:00
|
|
|
- manage-pods
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Fastlane Tesflight Upload
|
|
|
|
command: |
|
2023-01-18 22:15:22 +00:00
|
|
|
echo $APP_STORE_CONNECT_API_KEY_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
|
2020-12-14 16:20:32 +00:00
|
|
|
bundle exec fastlane ios beta official:<< parameters.official >>
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2020-05-20 16:33:40 +00:00
|
|
|
- save_cache: *save-gems-cache
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
create-e2e-account-file:
|
|
|
|
description: "Create e2e account file"
|
|
|
|
steps:
|
|
|
|
- run:
|
|
|
|
command: |
|
|
|
|
echo $E2E_ACCOUNT | base64 --decode > ./e2e_account.ts
|
|
|
|
working_directory: e2e
|
|
|
|
|
2023-03-30 20:10:40 +00:00
|
|
|
# https://github.com/facebook/react-native/blob/367faa22823ed081576f2fd59733f5680c849426/.circleci/config.yml#L160
|
|
|
|
setup_ruby:
|
|
|
|
parameters:
|
|
|
|
ruby_version:
|
|
|
|
default: "2.6.10"
|
|
|
|
type: string
|
|
|
|
steps:
|
|
|
|
- restore_cache:
|
|
|
|
key: *gems_cache_key
|
|
|
|
- run:
|
|
|
|
name: Set Required Ruby
|
|
|
|
command: echo << parameters.ruby_version >> > /tmp/required_ruby
|
|
|
|
- restore_cache:
|
|
|
|
key: *rbenv_cache_key
|
|
|
|
- run:
|
|
|
|
name: Bundle Install
|
|
|
|
command: |
|
|
|
|
# Check if rbenv is installed. CircleCI is migrating to rbenv so we may not need to always install it.
|
|
|
|
if [[ -z "$(command -v rbenv)" ]]; then
|
|
|
|
brew install rbenv ruby-build
|
|
|
|
# Load and init rbenv
|
|
|
|
(rbenv init 2> /dev/null) || true
|
|
|
|
echo '' >> ~/.bash_profile
|
|
|
|
echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile
|
|
|
|
source ~/.bash_profile
|
|
|
|
else
|
|
|
|
echo "rbenv found; Skipping installation"
|
|
|
|
fi
|
|
|
|
brew reinstall libyaml
|
|
|
|
gem install psych -- --with-libyaml-dir=$(brew --prefix libyaml)
|
|
|
|
export RUBY_CONFIGURE_OPTS=--with-libyaml-dir=$(brew --prefix libyaml)
|
|
|
|
# Install the right version of ruby
|
|
|
|
if [[ -z "$(rbenv versions | grep << parameters.ruby_version >>)" ]]; then
|
|
|
|
# ensure that `ruby-build` can see all the available versions of Ruby
|
|
|
|
# some PRs received machines in a weird state, this should make the pipelines
|
|
|
|
# more robust.
|
|
|
|
brew update && brew upgrade ruby-build
|
|
|
|
rbenv install << parameters.ruby_version >>
|
|
|
|
fi
|
|
|
|
# Set ruby dependencies
|
|
|
|
rbenv global << parameters.ruby_version >>
|
|
|
|
gem install bundler
|
|
|
|
bundle check || bundle install --path vendor/bundle --clean
|
|
|
|
- save_cache:
|
|
|
|
key: *rbenv_cache_key
|
|
|
|
paths:
|
|
|
|
- ~/.rbenv
|
|
|
|
- save_cache:
|
|
|
|
key: *gems_cache_key
|
|
|
|
paths:
|
|
|
|
- vendor/bundle
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
version: 2.1
|
|
|
|
|
|
|
|
# EXECUTORS
|
|
|
|
executors:
|
|
|
|
mac-env:
|
|
|
|
<<: *macos
|
|
|
|
environment:
|
|
|
|
<<: *bash-env
|
|
|
|
|
|
|
|
# JOBS
|
|
|
|
jobs:
|
|
|
|
lint-testunit:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/node:16.14
|
2021-09-13 20:41:05 +00:00
|
|
|
resource_class: large
|
2020-12-14 16:20:32 +00:00
|
|
|
environment:
|
|
|
|
CODECOV_TOKEN: caa771ab-3d45-4756-8e2a-e1f25996fef6
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- restore_cache: *restore-npm-cache-linux
|
|
|
|
|
|
|
|
- run: *install-npm-modules
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Lint
|
|
|
|
command: |
|
|
|
|
yarn lint
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: |
|
2022-02-01 13:29:16 +00:00
|
|
|
yarn test -w 8
|
2020-12-14 16:20:32 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Codecov
|
|
|
|
command: |
|
|
|
|
yarn codecov
|
|
|
|
|
|
|
|
- save_cache: *save-npm-cache-linux
|
|
|
|
|
|
|
|
# Android builds
|
|
|
|
android-build-experimental:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2020-12-14 16:20:32 +00:00
|
|
|
environment:
|
|
|
|
<<: *android-env
|
|
|
|
<<: *bash-env
|
2021-09-13 20:41:05 +00:00
|
|
|
resource_class: large
|
2020-12-14 16:20:32 +00:00
|
|
|
steps:
|
|
|
|
- android-build
|
2022-05-11 02:42:35 +00:00
|
|
|
|
|
|
|
# Android automatic builds
|
|
|
|
android-automatic-build-experimental:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/android:api-29-node
|
|
|
|
environment:
|
|
|
|
<<: *android-env
|
|
|
|
<<: *bash-env
|
|
|
|
resource_class: large
|
|
|
|
steps:
|
|
|
|
- android-build
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
android-build-official:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2020-12-14 16:20:32 +00:00
|
|
|
environment:
|
|
|
|
<<: *android-env
|
|
|
|
<<: *bash-env
|
2021-09-13 20:41:05 +00:00
|
|
|
resource_class: large
|
2020-12-14 16:20:32 +00:00
|
|
|
steps:
|
|
|
|
- android-build
|
|
|
|
|
2021-07-19 21:04:45 +00:00
|
|
|
android-internal-app-sharing-experimental:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2021-07-19 21:04:45 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- upload-to-internal-app-sharing
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
android-google-play-beta-experimental:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2020-12-14 16:20:32 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- upload-to-google-play-beta:
|
|
|
|
official: false
|
|
|
|
|
2021-04-13 18:41:55 +00:00
|
|
|
android-google-play-production-experimental:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2021-04-13 18:41:55 +00:00
|
|
|
steps:
|
|
|
|
- upload-to-google-play-production
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
android-google-play-beta-official:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2022-04-20 21:22:59 +00:00
|
|
|
- image: cimg/android:2022.03.1-node
|
2020-12-14 16:20:32 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- upload-to-google-play-beta:
|
|
|
|
official: true
|
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
e2e-build-android:
|
|
|
|
<<: *defaults
|
|
|
|
executor:
|
|
|
|
name: android/android-machine
|
|
|
|
resource-class: xlarge
|
|
|
|
tag: 2022.12.1
|
|
|
|
environment:
|
|
|
|
<<: *android-env
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache: *restore-npm-cache-linux
|
|
|
|
- run: *install-npm-modules
|
|
|
|
- save_cache: *save-npm-cache-linux
|
|
|
|
- restore_cache: *restore-gradle-cache
|
|
|
|
- run:
|
|
|
|
name: Configure Gradle
|
|
|
|
command: |
|
|
|
|
echo -e "" > ./gradle.properties
|
|
|
|
# echo -e "android.enableAapt2=false" >> ./gradle.properties
|
|
|
|
echo -e "android.useAndroidX=true" >> ./gradle.properties
|
|
|
|
echo -e "android.enableJetifier=true" >> ./gradle.properties
|
|
|
|
echo -e "newArchEnabled=false" >> ./gradle.properties
|
|
|
|
echo -e "FLIPPER_VERSION=0.125.0" >> ./gradle.properties
|
|
|
|
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
|
|
|
|
echo -e "APPLICATION_ID=chat.rocket.reactnative" >> ./gradle.properties
|
|
|
|
echo -e "BugsnagAPIKey=$BUGSNAG_KEY" >> ./gradle.properties
|
|
|
|
echo $KEYSTORE_EXPERIMENTAL_BASE64 | base64 --decode > ./app/$KEYSTORE_EXPERIMENTAL
|
|
|
|
echo -e "KEYSTORE=$KEYSTORE_EXPERIMENTAL" >> ./gradle.properties
|
|
|
|
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_EXPERIMENTAL_PASSWORD" >> ./gradle.properties
|
|
|
|
echo -e "KEY_ALIAS=$KEYSTORE_EXPERIMENTAL_ALIAS" >> ./gradle.properties
|
|
|
|
echo -e "KEY_PASSWORD=$KEYSTORE_EXPERIMENTAL_PASSWORD" >> ./gradle.properties
|
|
|
|
working_directory: android
|
|
|
|
- run:
|
|
|
|
name: Build Android
|
|
|
|
command: |
|
|
|
|
echo "RUNNING_E2E_TESTS=true" > ./.env
|
|
|
|
yarn e2e:android-build
|
|
|
|
- save_cache: *save-gradle-cache
|
|
|
|
- store_artifacts:
|
|
|
|
path: android/app/build/outputs/apk/experimentalPlay/release/app-experimental-play-release.apk
|
|
|
|
- store_artifacts:
|
|
|
|
path: android/app/build/outputs/apk/androidTest/experimentalPlay/release/app-experimental-play-release-androidTest.apk
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /home/circleci/repo
|
|
|
|
paths:
|
|
|
|
- android/app/build/outputs/apk/
|
|
|
|
|
|
|
|
e2e-test-android:
|
|
|
|
<<: *defaults
|
|
|
|
executor:
|
|
|
|
name: android/android-machine
|
|
|
|
resource-class: xlarge
|
|
|
|
tag: 2022.12.1
|
|
|
|
parallelism: 4
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: /home/circleci/repo
|
|
|
|
- restore_cache: *restore-npm-cache-linux
|
|
|
|
- run: *install-npm-modules
|
|
|
|
- save_cache: *save-npm-cache-linux
|
|
|
|
- run: mkdir ~/junit
|
|
|
|
- create-e2e-account-file
|
|
|
|
- android/create-avd:
|
|
|
|
avd-name: Pixel_API_31_AOSP
|
|
|
|
install: true
|
|
|
|
system-image: system-images;android-31;default;x86_64
|
|
|
|
- run:
|
|
|
|
name: Setup emulator
|
|
|
|
command: |
|
|
|
|
echo "hw.lcd.density = 440" >> ~/.android/avd/Pixel_API_31_AOSP.avd/config.ini
|
|
|
|
echo "hw.lcd.height = 2280" >> ~/.android/avd/Pixel_API_31_AOSP.avd/config.ini
|
|
|
|
echo "hw.lcd.width = 1080" >> ~/.android/avd/Pixel_API_31_AOSP.avd/config.ini
|
|
|
|
- run:
|
|
|
|
name: Run Detox Tests
|
|
|
|
command: |
|
|
|
|
TEST=$(circleci tests glob "e2e/tests/**/*.ts" | circleci tests split --split-by=timings)
|
|
|
|
yarn e2e:android-test $TEST
|
|
|
|
- store_artifacts:
|
|
|
|
path: artifacts
|
|
|
|
- run:
|
|
|
|
command: cp junit.xml ~/junit/
|
|
|
|
when: always
|
|
|
|
- store_test_results:
|
|
|
|
path: ~/junit
|
|
|
|
- store_artifacts:
|
|
|
|
path: ~/junit
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
# iOS builds
|
|
|
|
ios-build-experimental:
|
|
|
|
executor: mac-env
|
|
|
|
steps:
|
|
|
|
- ios-build
|
|
|
|
|
|
|
|
ios-build-official:
|
|
|
|
executor: mac-env
|
|
|
|
steps:
|
|
|
|
- ios-build
|
|
|
|
|
|
|
|
ios-testflight-experimental:
|
|
|
|
executor: mac-env
|
|
|
|
steps:
|
|
|
|
- upload-to-testflight:
|
|
|
|
official: false
|
|
|
|
|
|
|
|
ios-testflight-official:
|
|
|
|
executor: mac-env
|
|
|
|
steps:
|
|
|
|
- upload-to-testflight:
|
|
|
|
official: true
|
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
e2e-build-ios:
|
|
|
|
executor: mac-env
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache: *restore-gems-cache
|
|
|
|
- restore_cache: *restore-npm-cache-mac
|
2023-03-30 20:10:40 +00:00
|
|
|
- setup_ruby:
|
|
|
|
ruby_version: 2.7.5
|
2023-03-07 12:28:51 +00:00
|
|
|
- run: *install-npm-modules
|
|
|
|
- run: *update-fastlane-ios
|
|
|
|
- save_cache: *save-npm-cache-mac
|
|
|
|
- save_cache: *save-gems-cache
|
|
|
|
- manage-pods
|
|
|
|
- run:
|
|
|
|
name: Configure Detox
|
|
|
|
command: |
|
|
|
|
brew tap wix/brew
|
|
|
|
brew install applesimutils
|
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: |
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./ios/RocketChatRN/Info.plist
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./ios/ShareRocketChatRN/Info.plist
|
|
|
|
yarn detox clean-framework-cache && yarn detox build-framework-cache
|
|
|
|
echo "RUNNING_E2E_TESTS=true" > ./.env
|
|
|
|
yarn e2e:ios-build
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /Users/distiller/project
|
|
|
|
paths:
|
|
|
|
- ios/build/Build/Products/Release-iphonesimulator/Rocket.Chat Experimental.app
|
|
|
|
|
|
|
|
e2e-test-ios:
|
|
|
|
executor: mac-env
|
|
|
|
parallelism: 5
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: /Users/distiller/project
|
|
|
|
- restore_cache: *restore-npm-cache-mac
|
|
|
|
- run: *install-npm-modules
|
|
|
|
- save_cache: *save-npm-cache-mac
|
|
|
|
- run: mkdir ~/junit
|
|
|
|
- run:
|
|
|
|
name: Configure Detox
|
|
|
|
command: |
|
|
|
|
brew tap wix/brew
|
|
|
|
brew install applesimutils
|
|
|
|
yarn detox clean-framework-cache && yarn detox build-framework-cache
|
|
|
|
- create-e2e-account-file
|
|
|
|
- run:
|
|
|
|
name: Run tests
|
|
|
|
command: |
|
|
|
|
TEST=$(circleci tests glob "e2e/tests/**/*.ts" | circleci tests split --split-by=timings)
|
|
|
|
yarn e2e:ios-test $TEST
|
|
|
|
- store_artifacts:
|
|
|
|
path: artifacts
|
|
|
|
- run:
|
|
|
|
command: cp junit.xml ~/junit/
|
|
|
|
when: always
|
|
|
|
- store_test_results:
|
|
|
|
path: ~/junit
|
|
|
|
- store_artifacts:
|
|
|
|
path: ~/junit
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
workflows:
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
|
|
|
- lint-testunit
|
2019-06-03 19:20:36 +00:00
|
|
|
|
2023-03-07 12:28:51 +00:00
|
|
|
# E2E tests
|
|
|
|
- e2e-hold:
|
|
|
|
type: approval
|
|
|
|
- e2e-build-ios:
|
|
|
|
requires:
|
|
|
|
- e2e-hold
|
|
|
|
- e2e-test-ios:
|
|
|
|
requires:
|
|
|
|
- e2e-build-ios
|
|
|
|
- e2e-build-android:
|
|
|
|
requires:
|
|
|
|
- e2e-hold
|
|
|
|
- e2e-test-android:
|
|
|
|
requires:
|
|
|
|
- e2e-build-android
|
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
# iOS Experimental
|
2021-02-26 12:28:12 +00:00
|
|
|
- ios-hold-build-experimental:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios-build-experimental:
|
2017-11-06 23:45:48 +00:00
|
|
|
requires:
|
2021-02-26 12:28:12 +00:00
|
|
|
- ios-hold-build-experimental
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios-testflight-experimental:
|
2018-12-18 13:03:36 +00:00
|
|
|
requires:
|
2021-07-19 21:04:45 +00:00
|
|
|
- ios-build-experimental
|
2018-02-19 21:15:31 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
# iOS Official
|
|
|
|
- ios-hold-build-official:
|
|
|
|
type: approval
|
2017-11-06 23:45:48 +00:00
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios-build-official:
|
|
|
|
requires:
|
|
|
|
- ios-hold-build-official
|
|
|
|
- ios-hold-testflight-official:
|
2020-06-16 13:31:07 +00:00
|
|
|
type: approval
|
|
|
|
requires:
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios-build-official
|
|
|
|
- ios-testflight-official:
|
2020-06-16 13:31:07 +00:00
|
|
|
requires:
|
2020-12-14 16:20:32 +00:00
|
|
|
- ios-hold-testflight-official
|
|
|
|
|
|
|
|
# Android Experimental
|
2021-02-26 12:28:12 +00:00
|
|
|
- android-hold-build-experimental:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2022-05-11 02:42:35 +00:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore:
|
|
|
|
- develop
|
2020-12-14 16:20:32 +00:00
|
|
|
- android-build-experimental:
|
|
|
|
requires:
|
2021-02-26 12:28:12 +00:00
|
|
|
- android-hold-build-experimental
|
2021-07-19 21:04:45 +00:00
|
|
|
- android-internal-app-sharing-experimental:
|
|
|
|
requires:
|
|
|
|
- android-build-experimental
|
2020-12-14 16:20:32 +00:00
|
|
|
- android-hold-google-play-beta-experimental:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- android-build-experimental
|
|
|
|
- android-google-play-beta-experimental:
|
|
|
|
requires:
|
|
|
|
- android-hold-google-play-beta-experimental
|
2021-04-13 18:41:55 +00:00
|
|
|
- android-hold-google-play-production-experimental:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- android-build-experimental
|
|
|
|
- android-google-play-production-experimental:
|
|
|
|
requires:
|
|
|
|
- android-hold-google-play-production-experimental
|
2022-05-11 02:42:35 +00:00
|
|
|
|
2020-12-14 16:20:32 +00:00
|
|
|
# Android Official
|
|
|
|
- android-hold-build-official:
|
2020-08-24 12:24:10 +00:00
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2020-12-14 16:20:32 +00:00
|
|
|
- android-build-official:
|
|
|
|
requires:
|
|
|
|
- android-hold-build-official
|
|
|
|
- android-hold-google-play-beta-official:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- android-build-official
|
|
|
|
- android-google-play-beta-official:
|
2020-08-24 12:24:10 +00:00
|
|
|
requires:
|
2020-12-14 16:20:32 +00:00
|
|
|
- android-hold-google-play-beta-official
|
2022-05-11 02:42:35 +00:00
|
|
|
|
|
|
|
# Android Automatic Experimental
|
|
|
|
- android-automatic-build-experimental:
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- develop
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
|
|
|
- android-google-play-production-experimental:
|
|
|
|
requires:
|
|
|
|
- android-automatic-build-experimental
|