328 lines
7.9 KiB
YAML
328 lines
7.9 KiB
YAML
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
|
|
|
|
- restore_cache:
|
|
name: Restore NPM cache
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
|
|
- run:
|
|
name: Install NPM modules
|
|
command: |
|
|
yarn
|
|
|
|
- run:
|
|
name: Lint
|
|
command: |
|
|
yarn lint
|
|
|
|
- run:
|
|
name: Test
|
|
command: |
|
|
yarn test
|
|
|
|
- run:
|
|
name: Codecov
|
|
command: |
|
|
yarn codecov
|
|
|
|
- save_cache:
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
name: Save NPM cache
|
|
paths:
|
|
- ./node_modules
|
|
|
|
e2e-test:
|
|
macos:
|
|
xcode: "10.2.1"
|
|
|
|
environment:
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
name: Restore NPM cache
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
|
|
- 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 wix/brew/applesimutils
|
|
|
|
- run:
|
|
name: Install NPM modules
|
|
command: |
|
|
yarn global add detox-cli
|
|
yarn
|
|
|
|
- run:
|
|
name: Build
|
|
command: |
|
|
detox build --configuration ios.sim.release
|
|
|
|
- run:
|
|
name: Test
|
|
command: |
|
|
detox test --configuration ios.sim.release --cleanup
|
|
|
|
- save_cache:
|
|
name: Save NPM cache
|
|
key: node-v1-mac-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- node_modules
|
|
|
|
- store_artifacts:
|
|
path: /tmp/screenshots
|
|
|
|
android-build:
|
|
<<: *defaults
|
|
docker:
|
|
- image: circleci/android:api-28-node
|
|
|
|
environment:
|
|
# GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"
|
|
# 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"'
|
|
TERM: dumb
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
name: Restore NPM cache
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
|
|
- run:
|
|
name: Install NPM modules
|
|
command: |
|
|
yarn
|
|
|
|
- restore_cache:
|
|
name: Restore gradle cache
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
|
|
- run:
|
|
name: Configure Gradle
|
|
command: |
|
|
cd android
|
|
|
|
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
|
|
|
|
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
|
|
|
|
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
|
|
|
|
- run:
|
|
name: Set Google Services
|
|
command: |
|
|
cd android/app
|
|
cp google-services.prod.json google-services.json
|
|
|
|
- run:
|
|
name: Build Android App
|
|
command: |
|
|
npx jetify
|
|
cd android
|
|
if [[ $KEYSTORE ]]; then
|
|
./gradlew bundleRelease
|
|
else
|
|
./gradlew assembleDebug
|
|
fi
|
|
|
|
mkdir -p /tmp/build
|
|
|
|
mv app/build/outputs /tmp/build/
|
|
|
|
- store_artifacts:
|
|
path: /tmp/build/outputs
|
|
|
|
- save_cache:
|
|
name: Save NPM cache
|
|
key: node-modules-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- ./node_modules
|
|
|
|
- save_cache:
|
|
name: Save gradle cache
|
|
key: android-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
|
|
paths:
|
|
- ~/.gradle
|
|
|
|
ios-build:
|
|
macos:
|
|
xcode: "10.2.1"
|
|
|
|
environment:
|
|
BASH_ENV: "~/.nvm/nvm.sh"
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- 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" }}
|
|
|
|
- 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 NPM modules
|
|
command: |
|
|
yarn
|
|
|
|
- run:
|
|
name: Update Fastlane
|
|
command: |
|
|
sudo bundle install
|
|
working_directory: ios
|
|
|
|
- run:
|
|
name: Set Google Services
|
|
command: |
|
|
cp GoogleService-Info.prod.plist GoogleService-Info.plist
|
|
working_directory: ios
|
|
|
|
- run:
|
|
name: Fastlane Build
|
|
no_output_timeout: 1200
|
|
command: |
|
|
agvtool new-version -all $CIRCLE_BUILD_NUM
|
|
|
|
if [[ $MATCH_KEYCHAIN_NAME ]]; then
|
|
bundle exec fastlane ios release
|
|
else
|
|
export MATCH_KEYCHAIN_NAME="temp"
|
|
export MATCH_KEYCHAIN_PASSWORD="temp"
|
|
bundle exec fastlane ios build
|
|
fi
|
|
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
|
|
|
|
- store_artifacts:
|
|
path: ios/RocketChatRN.ipa
|
|
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- ios/*.ipa
|
|
- ios/fastlane/report.xml
|
|
|
|
ios-testflight:
|
|
macos:
|
|
xcode: "10.2.1"
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
at: ios
|
|
|
|
- restore_cache:
|
|
name: Restore gems cache
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
|
|
- run:
|
|
name: Update Fastlane
|
|
command: |
|
|
sudo bundle install
|
|
working_directory: ios
|
|
|
|
- run:
|
|
name: Fastlane Tesflight Upload
|
|
command: |
|
|
bundle exec fastlane pilot upload --ipa ios/RocketChatRN.ipa --changelog "$(sh ../.circleci/changelog.sh)"
|
|
working_directory: ios
|
|
|
|
- save_cache:
|
|
name: Save gems cache
|
|
key: bundle-v1-{{ checksum "ios/Gemfile.lock" }}
|
|
paths:
|
|
- vendor/bundle
|
|
|
|
workflows:
|
|
version: 2
|
|
build-and-test:
|
|
jobs:
|
|
- lint-testunit
|
|
|
|
- e2e-hold:
|
|
type: approval
|
|
requires:
|
|
- lint-testunit
|
|
- e2e-test:
|
|
requires:
|
|
- e2e-hold
|
|
|
|
- ios-build:
|
|
requires:
|
|
- lint-testunit
|
|
- ios-hold-testflight:
|
|
type: approval
|
|
requires:
|
|
- ios-build
|
|
- ios-testflight:
|
|
requires:
|
|
- ios-hold-testflight
|
|
|
|
- android-build:
|
|
requires:
|
|
- lint-testunit
|