2017-11-06 23:45:48 +00:00
|
|
|
defaults: &defaults
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
lint-testunit:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:8
|
|
|
|
|
|
|
|
environment:
|
|
|
|
CODECOV_TOKEN: caa771ab-3d45-4756-8e2a-e1f25996fef6
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2019-02-07 15:48:10 +00:00
|
|
|
- restore_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
2019-02-07 15:48:10 +00:00
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Lint
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn lint
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn test
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Codecov
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn codecov
|
|
|
|
|
|
|
|
- save_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
|
|
name: Save NPM cache
|
2019-02-07 15:48:10 +00:00
|
|
|
paths:
|
|
|
|
- ./node_modules
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
e2e-test:
|
|
|
|
macos:
|
2019-12-02 14:08:11 +00:00
|
|
|
xcode: "11.2.1"
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
environment:
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2019-07-04 11:23:31 +00:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
- run:
|
|
|
|
name: Install Node 8
|
|
|
|
command: |
|
|
|
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
|
|
|
|
source ~/.nvm/nvm.sh
|
|
|
|
# https://github.com/creationix/nvm/issues/1394
|
|
|
|
set +e
|
|
|
|
nvm install 8
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install appleSimUtils
|
|
|
|
command: |
|
|
|
|
brew update
|
|
|
|
brew tap wix/brew
|
2018-09-28 18:57:29 +00:00
|
|
|
brew install wix/brew/applesimutils
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn global add detox-cli
|
|
|
|
yarn
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build
|
|
|
|
command: |
|
2018-08-10 17:26:36 +00:00
|
|
|
detox build --configuration ios.sim.release
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: |
|
2018-08-10 17:26:36 +00:00
|
|
|
detox test --configuration ios.sim.release --cleanup
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2019-07-04 11:23:31 +00:00
|
|
|
- save_cache:
|
|
|
|
name: Save NPM cache
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/screenshots
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
android-build:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-05-22 20:15:35 +00:00
|
|
|
- image: circleci/android:api-28-node
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
environment:
|
2018-09-25 19:28:42 +00:00
|
|
|
# GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"
|
2019-08-07 13:51:34 +00:00
|
|
|
# GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false
|
|
|
|
# JVM_OPTS: -Xmx4096m
|
|
|
|
JAVA_OPTS: '-Xms512m -Xmx2g'
|
|
|
|
GRADLE_OPTS: '-Xmx3g -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx2g -XX:+HeapDumpOnOutOfMemoryError"'
|
2017-11-06 23:45:48 +00:00
|
|
|
TERM: dumb
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2019-08-23 13:18:47 +00:00
|
|
|
- run:
|
|
|
|
name: Install Node 8
|
|
|
|
command: |
|
|
|
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
|
|
|
|
source ~/.nvm/nvm.sh
|
|
|
|
# https://github.com/creationix/nvm/issues/1394
|
|
|
|
set +e
|
|
|
|
nvm install 8
|
|
|
|
echo 'export PATH="/home/circleci/.nvm/versions/node/v8.16.0/bin:$PATH"' >> ~/.bash_profile
|
|
|
|
source ~/.bash_profile
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- restore_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2019-08-23 13:18:47 +00:00
|
|
|
- run:
|
|
|
|
name: Install React Native CLI
|
|
|
|
command: |
|
|
|
|
npm i -g react-native-cli
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
2019-02-07 15:48:10 +00:00
|
|
|
yarn
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- restore_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Restore gradle cache
|
|
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
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
|
2018-01-10 02:35:31 +00:00
|
|
|
|
|
|
|
if [[ $KEYSTORE ]]; then
|
|
|
|
echo $KEYSTORE_BASE64 | base64 --decode > ./app/$KEYSTORE
|
|
|
|
echo -e "KEYSTORE=$KEYSTORE" >> ./gradle.properties
|
|
|
|
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
|
|
|
|
echo -e "KEY_ALIAS=$KEY_ALIAS" >> ./gradle.properties
|
|
|
|
echo -e "KEY_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
|
|
|
|
fi
|
|
|
|
|
2017-11-07 16:58:33 +00:00
|
|
|
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
|
2019-08-23 13:18:47 +00:00
|
|
|
echo -e "BugsnagAPIKey=$BUGSNAG_KEY" >> ./gradle.properties
|
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: |
|
|
|
|
cp google-services.prod.json google-services.json
|
2019-08-23 13:18:47 +00:00
|
|
|
working_directory: android/app
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Upload sourcemaps to Bugsnag
|
|
|
|
command: |
|
|
|
|
if [[ $BUGSNAG_KEY ]]; then
|
|
|
|
yarn generate-source-maps-android
|
|
|
|
curl https://upload.bugsnag.com/react-native-source-map \
|
|
|
|
-F apiKey=$BUGSNAG_KEY \
|
|
|
|
-F appVersionCode=$CIRCLE_BUILD_NUM \
|
|
|
|
-F dev=false \
|
|
|
|
-F platform=android \
|
|
|
|
-F sourceMap=@android-release.bundle.map \
|
|
|
|
-F bundle=@android-release.bundle
|
|
|
|
fi
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Config variables
|
|
|
|
command: |
|
|
|
|
echo -e "export default { BUGSNAG_API_KEY: '$BUGSNAG_KEY' };" > ./config.js
|
2019-05-31 12:41:37 +00:00
|
|
|
|
2017-11-07 17:29:32 +00:00
|
|
|
- run:
|
|
|
|
name: Build Android App
|
|
|
|
command: |
|
2018-01-10 02:35:31 +00:00
|
|
|
if [[ $KEYSTORE ]]; then
|
2019-12-11 19:23:16 +00:00
|
|
|
# TODO: enable app bundle again
|
|
|
|
./gradlew assembleRelease
|
2018-01-10 02:35:31 +00:00
|
|
|
else
|
|
|
|
./gradlew assembleDebug
|
|
|
|
fi
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
mkdir -p /tmp/build
|
|
|
|
|
|
|
|
mv app/build/outputs /tmp/build/
|
2020-02-05 16:44:31 +00:00
|
|
|
working_directory: android
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/build/outputs
|
|
|
|
|
|
|
|
- save_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Save NPM cache
|
|
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
2017-11-06 23:45:48 +00:00
|
|
|
paths:
|
|
|
|
- ./node_modules
|
|
|
|
|
|
|
|
- save_cache:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Save gradle cache
|
|
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
2017-11-06 23:45:48 +00:00
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
|
|
|
|
ios-build:
|
|
|
|
macos:
|
2019-12-02 14:08:11 +00:00
|
|
|
xcode: "11.2.1"
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
environment:
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2019-07-04 11:23:31 +00:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore gems cache
|
|
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
|
|
|
|
|
|
- restore_cache:
|
|
|
|
name: Restore NPM cache
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Install Node 8
|
|
|
|
command: |
|
|
|
|
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
|
|
|
|
source ~/.nvm/nvm.sh
|
|
|
|
# https://github.com/creationix/nvm/issues/1394
|
|
|
|
set +e
|
|
|
|
nvm install 8
|
|
|
|
|
|
|
|
- run:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Install NPM modules
|
2017-11-06 23:45:48 +00:00
|
|
|
command: |
|
2019-08-23 13:18:47 +00:00
|
|
|
yarn global add react-native react-native-cli
|
2019-07-04 11:23:31 +00:00
|
|
|
yarn
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
2019-07-04 11:23:31 +00:00
|
|
|
name: Update Fastlane
|
2017-11-06 23:45:48 +00:00
|
|
|
command: |
|
2019-12-02 14:08:11 +00:00
|
|
|
echo "ruby-2.6.4" > ~/.ruby-version
|
2019-11-04 19:29:15 +00:00
|
|
|
bundle install
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2019-05-31 12:41:37 +00:00
|
|
|
- run:
|
|
|
|
name: Set Google Services
|
|
|
|
command: |
|
|
|
|
cp GoogleService-Info.prod.plist GoogleService-Info.plist
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2019-05-31 12:41:37 +00:00
|
|
|
|
2019-08-23 13:18:47 +00:00
|
|
|
- run:
|
|
|
|
name: Upload sourcemaps to Bugsnag
|
|
|
|
command: |
|
|
|
|
if [[ $BUGSNAG_KEY ]]; 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
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Fastlane Build
|
|
|
|
no_output_timeout: 1200
|
|
|
|
command: |
|
2017-11-07 16:58:33 +00:00
|
|
|
agvtool new-version -all $CIRCLE_BUILD_NUM
|
2019-08-23 13:18:47 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set BugsnagAPIKey $BUGSNAG_KEY" ./RocketChatRN/Info.plist
|
2018-01-10 02:35:31 +00:00
|
|
|
|
|
|
|
if [[ $MATCH_KEYCHAIN_NAME ]]; then
|
2019-07-04 11:23:31 +00:00
|
|
|
bundle exec fastlane ios release
|
2018-01-10 02:35:31 +00:00
|
|
|
else
|
|
|
|
export MATCH_KEYCHAIN_NAME="temp"
|
|
|
|
export MATCH_KEYCHAIN_PASSWORD="temp"
|
2019-07-04 11:23:31 +00:00
|
|
|
bundle exec fastlane ios build
|
2018-01-10 02:35:31 +00:00
|
|
|
fi
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
name: Save NPM cache
|
|
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
name: Save gems cache
|
|
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
|
|
paths:
|
|
|
|
- vendor/bundle
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: ios/RocketChatRN.ipa
|
|
|
|
|
|
|
|
- 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
|
|
|
|
- ios/fastlane/report.xml
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
ios-testflight:
|
|
|
|
macos:
|
2019-12-02 14:08:11 +00:00
|
|
|
xcode: "11.2.1"
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- attach_workspace:
|
|
|
|
at: ios
|
|
|
|
|
2019-07-04 11:23:31 +00:00
|
|
|
- restore_cache:
|
|
|
|
name: Restore gems cache
|
|
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- run:
|
|
|
|
name: Update Fastlane
|
|
|
|
command: |
|
2019-11-05 20:05:59 +00:00
|
|
|
echo "ruby-2.4" > ~/.ruby-version
|
2019-11-04 19:29:15 +00:00
|
|
|
bundle install
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Fastlane Tesflight Upload
|
|
|
|
command: |
|
2019-08-23 13:18:47 +00:00
|
|
|
bundle exec fastlane ios beta
|
2019-07-04 11:23:31 +00:00
|
|
|
working_directory: ios
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
name: Save gems cache
|
|
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
|
|
paths:
|
|
|
|
- vendor/bundle
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
|
|
|
- lint-testunit
|
2019-06-03 19:20:36 +00:00
|
|
|
|
|
|
|
- e2e-hold:
|
|
|
|
type: approval
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
|
|
|
- e2e-test:
|
|
|
|
requires:
|
|
|
|
- e2e-hold
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- ios-build:
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2018-12-18 13:03:36 +00:00
|
|
|
- ios-hold-testflight:
|
|
|
|
type: approval
|
2017-11-06 23:45:48 +00:00
|
|
|
requires:
|
|
|
|
- ios-build
|
2018-12-18 13:03:36 +00:00
|
|
|
- ios-testflight:
|
|
|
|
requires:
|
|
|
|
- ios-hold-testflight
|
2018-02-19 21:15:31 +00:00
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- android-build:
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|