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
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
|
|
|
npm install
|
2018-01-10 00:42:43 +00:00
|
|
|
# npm install codecov
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Lint
|
|
|
|
command: |
|
|
|
|
npm run lint
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Test
|
|
|
|
command: |
|
2018-04-24 19:34:03 +00:00
|
|
|
npm run test
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Codecov
|
|
|
|
command: |
|
|
|
|
npx codecov
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
e2e-test:
|
|
|
|
macos:
|
2018-09-25 19:28:42 +00:00
|
|
|
xcode: "10.0.0"
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
environment:
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- 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
|
|
|
|
brew install applesimutils
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
|
|
|
rm -rf node_modules
|
|
|
|
npm install
|
|
|
|
npm install -g detox-cli
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/screenshots
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
android-build:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2018-09-04 14:29:20 +00:00
|
|
|
- image: circleci/android:api-27-node8-alpha
|
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"
|
|
|
|
GRADLE_OPTS: -Xmx2048m -Dorg.gradle.daemon=false
|
2018-02-19 21:19:39 +00:00
|
|
|
JVM_OPTS: -Xmx4096m
|
2017-11-06 23:45:48 +00:00
|
|
|
TERM: dumb
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2018-09-04 14:29:20 +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
|
|
|
|
# nvm install 8
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- restore_cache:
|
|
|
|
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
|
|
|
npm install
|
|
|
|
|
|
|
|
- restore_cache:
|
|
|
|
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
|
|
|
|
|
|
- run:
|
2017-11-07 17:29:32 +00:00
|
|
|
name: Configure Gradle
|
2017-11-06 23:45:48 +00:00
|
|
|
command: |
|
|
|
|
cd android
|
|
|
|
|
2018-01-10 02:35:31 +00:00
|
|
|
echo -e "" > ./gradle.properties
|
2018-06-20 13:40:33 +00:00
|
|
|
echo -e "android.enableAapt2=false" >> ./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
|
2017-11-06 23:45:48 +00:00
|
|
|
|
2018-04-03 16:24:59 +00:00
|
|
|
echo -e "" > ./app/fabric.properties
|
|
|
|
echo -e "apiKey=$FABRIC_KEY" >> ./app/fabric.properties
|
|
|
|
echo -e "apiSecret=$FABRIC_SECRET" >> ./app/fabric.properties
|
|
|
|
|
2017-11-07 17:29:32 +00:00
|
|
|
- run:
|
|
|
|
name: Install Android Depedencies
|
|
|
|
command: |
|
|
|
|
cd android
|
|
|
|
./gradlew androidDependencies
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Build Android App
|
|
|
|
command: |
|
|
|
|
cd android
|
2018-01-10 02:35:31 +00:00
|
|
|
if [[ $KEYSTORE ]]; then
|
|
|
|
./gradlew assembleRelease
|
|
|
|
else
|
|
|
|
./gradlew assembleDebug
|
|
|
|
fi
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
mkdir -p /tmp/build
|
|
|
|
|
|
|
|
mv app/build/outputs /tmp/build/
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: /tmp/build/outputs
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
|
|
|
|
paths:
|
|
|
|
- ./node_modules
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
|
|
paths:
|
|
|
|
- ~/.gradle
|
|
|
|
|
|
|
|
ios-build:
|
|
|
|
macos:
|
2018-09-25 19:28:42 +00:00
|
|
|
xcode: "10.0.0"
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
environment:
|
|
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- 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: Update Fastlane
|
|
|
|
command: |
|
|
|
|
brew update
|
|
|
|
brew install ruby
|
|
|
|
sudo gem install fastlane
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Install NPM modules
|
|
|
|
command: |
|
2017-12-02 21:28:38 +00:00
|
|
|
rm -rf node_modules
|
2017-11-06 23:45:48 +00:00
|
|
|
npm install
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Fix known build error
|
|
|
|
command: |
|
|
|
|
# Fix error https://github.com/facebook/react-native/issues/14382
|
|
|
|
cd node_modules/react-native/scripts/
|
|
|
|
curl https://raw.githubusercontent.com/facebook/react-native/5c53f89dd86160301feee024bce4ce0c89e8c187/scripts/ios-configure-glog.sh > ios-configure-glog.sh
|
|
|
|
chmod +x ios-configure-glog.sh
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Fastlane Build
|
|
|
|
no_output_timeout: 1200
|
|
|
|
command: |
|
|
|
|
cd ios
|
2017-11-07 16:58:33 +00:00
|
|
|
agvtool new-version -all $CIRCLE_BUILD_NUM
|
2018-04-03 16:24:59 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set Fabric:APIKey $FABRIC_KEY" ./RocketChatRN/Info.plist
|
2018-04-03 18:30:09 +00:00
|
|
|
echo -e "./Fabric.framework/run $FABRIC_KEY $FABRIC_SECRET" > ./RocketChatRN/Fabric.sh
|
2018-01-10 02:35:31 +00:00
|
|
|
|
|
|
|
if [[ $MATCH_KEYCHAIN_NAME ]]; then
|
|
|
|
fastlane ios release
|
|
|
|
else
|
|
|
|
export MATCH_KEYCHAIN_NAME="temp"
|
|
|
|
export MATCH_KEYCHAIN_PASSWORD="temp"
|
|
|
|
fastlane ios build
|
|
|
|
fi
|
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:
|
2018-09-25 19:28:42 +00:00
|
|
|
xcode: "10.0.0"
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- attach_workspace:
|
|
|
|
at: ios
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Update Fastlane
|
|
|
|
command: |
|
|
|
|
brew update
|
|
|
|
brew install ruby
|
|
|
|
sudo gem install fastlane
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: Fastlane Tesflight Upload
|
|
|
|
command: |
|
|
|
|
cd ios
|
2018-01-30 19:49:22 +00:00
|
|
|
fastlane pilot upload --ipa ios/RocketChatRN.ipa --changelog "$(sh ../.circleci/changelog.sh)"
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
|
|
|
- lint-testunit
|
2018-05-23 13:39:18 +00:00
|
|
|
- e2e-test:
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2017-11-06 23:45:48 +00:00
|
|
|
|
|
|
|
- ios-build:
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|
2018-02-16 21:35:16 +00:00
|
|
|
- ios-testflight:
|
2017-11-06 23:45:48 +00:00
|
|
|
requires:
|
|
|
|
- ios-build
|
2017-11-07 12:54:13 +00:00
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
2018-04-24 19:34:03 +00:00
|
|
|
- beta
|
2017-11-07 12:54:13 +00:00
|
|
|
- develop
|
|
|
|
- master
|
2018-02-19 21:15:31 +00:00
|
|
|
# - ios-testflight:
|
|
|
|
# requires:
|
|
|
|
# - ios-hold-testflight
|
|
|
|
|
2017-11-06 23:45:48 +00:00
|
|
|
- android-build:
|
|
|
|
requires:
|
|
|
|
- lint-testunit
|