Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
201 changes: 126 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ defaults: &defaults

macos: &macos
macos:
xcode: "12.1.0"
xcode: "12.5.0"
resource_class: large

bash-env: &bash-env
BASH_ENV: "~/.nvm/nvm.sh"
Expand Down Expand Up @@ -37,15 +38,6 @@ save-npm-cache-mac: &save-npm-cache-mac
paths:
- ./node_modules

install-node: &install-node
name: Install Node
command: |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.nvm/nvm.sh
INSTALLED_NODE=`nvm which current`
echo "export PATH=\"${INSTALLED_NODE%%/node}:\$PATH\"" >> ~/.bash_profile
source ~/.bash_profile

restore-gems-cache: &restore-gems-cache
name: Restore gems cache
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
Expand Down Expand Up @@ -83,13 +75,32 @@ restore_cache: &restore-gradle-cache
# COMMANDS
commands:

manage-pods:
description: "Restore/Get/Save cache of pods libs"
steps:
- restore_cache:
name: Restore pods
# TODO: CircleCI isn't caching Podfile.lock correctly, because checksum changes after install
# key: pods-v1-{{ checksum "ios/Podfile.lock" }}
key: pods-v1-{{ checksum "ios/Podfile" }}
- run:
name: Install pods libs
command: |
bundle exec pod install
working_directory: ios
- save_cache:
name: Save pods specs and pods cache
# key: pods-v1-{{ checksum "ios/Podfile.lock" }}
key: pods-v1-{{ checksum "ios/Podfile" }}
paths:
- ~/.pods
- ios/Pods

android-build:
description: "Build Android app"
steps:
- checkout

- run: *install-node

- restore_cache: *restore-npm-cache-linux

- run: *install-npm-modules
Expand Down Expand Up @@ -133,15 +144,6 @@ commands:
fi
working_directory: android/app

- run:
name: Config variables
command: |
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
echo -e "export default { BUGSNAG_API_KEY: '$BUGSNAG_KEY_OFFICIAL' };" > ./config.js
else
echo -e "export default { BUGSNAG_API_KEY: '$BUGSNAG_KEY' };" > ./config.js
fi

- run:
name: Build App
command: |
Expand All @@ -160,22 +162,20 @@ commands:
name: Upload sourcemaps to Bugsnag
command: |
if [[ $CIRCLE_JOB == "android-build-official" ]]; then
yarn generate-source-maps-android upload \
npx bugsnag-source-maps upload-react-native \
--api-key=$BUGSNAG_KEY_OFFICIAL \
--app-version=$CIRCLE_BUILD_NUM \
--minifiedFile=android/app/build/generated/assets/react/officialPlay/release/app.bundle \
--app-version-code=$CIRCLE_BUILD_NUM \
--platform android \
--source-map=android/app/build/generated/sourcemaps/react/officialPlay/release/app.bundle.map \
--minified-url=app.bundle \
--upload-sources
--bundle android/app/build/generated/assets/react/officialPlay/release/app.bundle
fi
if [[ $CIRCLE_JOB == "android-build-experimental" ]]; then
yarn generate-source-maps-android upload \
npx bugsnag-source-maps upload-react-native \
--api-key=$BUGSNAG_KEY \
--app-version=$CIRCLE_BUILD_NUM \
--minifiedFile=android/app/build/generated/assets/react/experimentalPlay/release/app.bundle \
--app-version-code=$CIRCLE_BUILD_NUM \
--platform android \
--source-map=android/app/build/generated/sourcemaps/react/experimentalPlay/release/app.bundle.map \
--minified-url=app.bundle \
--upload-sources
--bundle android/app/build/generated/assets/react/experimentalPlay/release/app.bundle
fi

- store_artifacts:
Expand All @@ -196,54 +196,37 @@ commands:
- checkout
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- run: *install-node
- run: *install-npm-modules
- run: *update-fastlane-ios
- manage-pods
- run:
name: Set Google Services
command: |
if [[ $KEYSTORE ]]; then
echo $GOOGLE_SERVICES_IOS | base64 --decode > GoogleService-Info.plist
fi
working_directory: ios
- run:
name: Upload sourcemaps to Bugsnag
command: |
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
yarn generate-source-maps-ios
curl https://upload.bugsnag.com/react-native-source-map \
-F apiKey=$BUGSNAG_KEY_OFFICIAL \
-F appBundleVersion=$CIRCLE_BUILD_NUM \
-F dev=false \
-F platform=ios \
-F sourceMap=@ios-release.bundle.map \
-F bundle=@ios-release.bundle
fi
if [[ $CIRCLE_JOB == "ios-build-experimental" ]]; then
yarn generate-source-maps-ios
curl https://upload.bugsnag.com/react-native-source-map \
-F apiKey=$BUGSNAG_KEY \
-F appBundleVersion=$CIRCLE_BUILD_NUM \
-F dev=false \
-F platform=ios \
-F sourceMap=@ios-release.bundle.map \
-F bundle=@ios-release.bundle
fi
- run:
name: Fastlane Build
no_output_timeout: 1200
no_output_timeout: 40m
command: |
agvtool new-version -all $CIRCLE_BUILD_NUM
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
/usr/libexec/PlistBuddy -c "Set BugsnagAPIKey $BUGSNAG_KEY_OFFICIAL" ./RocketChatRN/Info.plist
/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
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./ShareRocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL YES" ./NotificationService/Info.plist
else
/usr/libexec/PlistBuddy -c "Set BugsnagAPIKey $BUGSNAG_KEY" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set :bugsnag:apiKey $BUGSNAG_KEY" ./ShareRocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./RocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./ShareRocketChatRN/Info.plist
/usr/libexec/PlistBuddy -c "Set IS_OFFICIAL NO" ./NotificationService/Info.plist
fi

if [[ $APP_STORE_CONNECT_API_KEY ]]; then
echo $APP_STORE_CONNECT_API_KEY | base64 --decode > ./fastlane/app_store_connect_api_key.p8
if [[ $APP_STORE_CONNECT_API_BASE64 ]]; then
echo $APP_STORE_CONNECT_API_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
if [[ $CIRCLE_JOB == "ios-build-official" ]]; then
bundle exec fastlane ios build_official
else
Expand Down Expand Up @@ -286,6 +269,41 @@ commands:
command: bundle exec fastlane android beta official:<< parameters.official >>
working_directory: android

# 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

# 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

upload-to-testflight:
description: "Upload to TestFlight"
parameters:
Expand All @@ -296,11 +314,13 @@ commands:
- attach_workspace:
at: ios
- restore_cache: *restore-gems-cache
- restore_cache: *restore-npm-cache-mac
- run: *update-fastlane-ios
- manage-pods
- run:
name: Fastlane Tesflight Upload
command: |
echo $APP_STORE_CONNECT_API_KEY | base64 --decode > ./fastlane/app_store_connect_api_key.p8
echo $APP_STORE_CONNECT_API_BASE64 | base64 --decode > ./fastlane/app_store_connect_api_key.p8
bundle exec fastlane ios beta official:<< parameters.official >>
working_directory: ios
- save_cache: *save-gems-cache
Expand All @@ -319,8 +339,8 @@ jobs:
lint-testunit:
<<: *defaults
docker:
- image: circleci/node:10

- image: circleci/node:15
resource_class: large
environment:
CODECOV_TOKEN: caa771ab-3d45-4756-8e2a-e1f25996fef6

Expand All @@ -339,7 +359,7 @@ jobs:
- run:
name: Test
command: |
yarn test
yarn test -w 8

- run:
name: Codecov
Expand All @@ -352,36 +372,53 @@ jobs:
android-build-experimental:
<<: *defaults
docker:
- image: circleci/android:api-28-node
- image: circleci/android:api-29-node
environment:
<<: *android-env
<<: *bash-env
resource_class: large
steps:
- android-build

android-build-official:
<<: *defaults
docker:
- image: circleci/android:api-28-node
- image: circleci/android:api-29-node
environment:
<<: *android-env
<<: *bash-env
resource_class: large
steps:
- android-build

android-google-play-beta-experimental:
android-internal-app-sharing-experimental:
<<: *defaults
docker:
- image: circleci/android:api-28-node

steps:
- upload-to-internal-app-sharing

android-google-play-beta-experimental:
<<: *defaults
docker:
- image: circleci/android:api-29-node

steps:
- upload-to-google-play-beta:
official: false

android-google-play-production-experimental:
<<: *defaults
docker:
- image: circleci/android:api-29-node
steps:
- upload-to-google-play-production

android-google-play-beta-official:
<<: *defaults
docker:
- image: circleci/android:api-28-node
- image: circleci/android:api-29-node

steps:
- upload-to-google-play-beta:
Expand Down Expand Up @@ -416,16 +453,16 @@ workflows:
- lint-testunit

# iOS Experimental
- ios-build-experimental:
requires:
- lint-testunit
- ios-hold-testflight-experimental:
- ios-hold-build-experimental:
type: approval
requires:
- ios-build-experimental
- lint-testunit
- ios-build-experimental:
requires:
- ios-hold-build-experimental
- ios-testflight-experimental:
requires:
- ios-hold-testflight-experimental
- ios-build-experimental

# iOS Official
- ios-hold-build-official:
Expand All @@ -444,16 +481,30 @@ workflows:
- ios-hold-testflight-official

# Android Experimental
- android-hold-build-experimental:
type: approval
requires:
- lint-testunit
- android-build-experimental:
requires:
- lint-testunit
- android-hold-build-experimental
- android-internal-app-sharing-experimental:
requires:
- android-build-experimental
- android-hold-google-play-beta-experimental:
type: approval
requires:
- android-build-experimental
- android-google-play-beta-experimental:
requires:
- android-hold-google-play-beta-experimental
- android-hold-google-play-production-experimental:
type: approval
requires:
- android-build-experimental
- android-google-play-production-experimental:
requires:
- android-hold-google-play-production-experimental

# Android Official
- android-hold-build-official:
Expand Down
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__tests__
node_modules
coverage
e2e
e2e/docker
android
ios
ios
.eslintrc.js
Loading