react-native-firebase/.circleci/config.yml

206 lines
5.5 KiB
YAML
Raw Normal View History

2018-09-03 17:28:55 +00:00
# -------------------------
# ALIASES
# -------------------------
aliases:
# -------------------------
# CACHE
# -------------------------
- &restore-yarn-cache
keys:
2018-09-03 20:51:52 +00:00
- yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "tests/package.json" }}
- yarn-cache-{{ arch }}
2018-09-03 19:07:05 +00:00
2018-09-03 17:28:55 +00:00
- &save-yarn-cache
paths:
- ~/.cache/yarn
- ~/Library/Detox/ios
2018-09-03 20:51:52 +00:00
key: yarn-cache-{{ arch }}-{{ checksum "package.json" }}-{{ checksum "tests/package.json" }}
2018-09-03 17:28:55 +00:00
- &save-pods-cache
paths:
- ~/react-native-firebase/tests/ios/Pods
2018-09-03 20:08:55 +00:00
key: pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- &restore-pods-cache
keys:
- pods-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- &save-ios-build-cache
paths:
- ~/react-native-firebase/tests/ios/build
2018-09-03 20:08:55 +00:00
key: ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
- &restore-ios-build-cache
keys:
- ios-build-cache-{{ arch }}-{{ checksum "ios/RNFirebase.podspec" }}-{{ checksum "tests/ios/Podfile" }}-{{ checksum "tests/ios/Podfile.lock" }}
2018-09-03 20:50:18 +00:00
- &save-brew-cache
paths:
- /usr/local/Homebrew
key: brew-cache-{{ arch }}
- &restore-brew-cache
keys:
- brew-cache-{{ arch }}
2018-09-03 19:07:05 +00:00
- &configure-jet-detox-environment
name: Configure Jet + Detox Environment
command: |
brew install node@8
brew link node@8
brew tap wix/brew
brew install applesimutils
brew install watchman
touch .watchmanconfig
node -v
- &packager-jet
name: Start React Native Pacakager (background)
background: true
command: cd tests && yarn run packager-jet || true
2018-09-03 17:28:55 +00:00
# -------------------------
# INSTALLATION
# -------------------------
- &yarn
name: Run Yarn
command: |
yarn install --non-interactive --cache-folder ~/.cache/yarn
cd tests && yarn install --non-interactive --cache-folder ~/.cache/yarn
# -------------------------
# ANALYSE
# -------------------------
# eslint
- &eslint
name: Lint Code
command: yarn run lint
# flow
- &validate-flow-declarations
name: Validate Flow Declarations
command: yarn run validate-flow-declarations
# typescript
- &validate-ts-declarations
name: Validate TypeScript Declarations
command: yarn run validate-ts-declarations
2018-09-03 17:28:55 +00:00
# -------------------------
# DEFAULTS
# -------------------------
defaults: &defaults
working_directory: ~/react-native-firebase
environment:
- GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1
# JAVASCRIPT
js_defaults: &js_defaults
<<: *defaults
docker:
- image: circleci/node:8
environment:
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# ANDROID
android_defaults: &android_defaults
<<: *defaults
docker:
- image: circleci/android:api-27-node8-alpha
resource_class: "large"
environment:
- TERM: "dumb"
- ADB_INSTALL_TIMEOUT: 10
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
- GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"'
- BUILD_THREADS: 2
# IOS
macos_defaults: &macos_defaults
<<: *defaults
2018-09-03 18:52:04 +00:00
resource_class: "large"
2018-09-03 17:28:55 +00:00
macos:
xcode: "9.4.0"
# -------------------------
# JOBS
# -------------------------
version: 2
jobs:
# Set up a Node environment for downstream jobs
2018-09-03 18:38:49 +00:00
checkout-code:
2018-09-03 17:28:55 +00:00
<<: *js_defaults
steps:
- checkout
- restore-cache: *restore-yarn-cache
- run: *yarn
- save-cache: *save-yarn-cache
- persist_to_workspace:
root: .
paths: .
analyse:
<<: *js_defaults
steps:
- attach_workspace:
at: ~/react-native-firebase
- run: *eslint
- run: *validate-flow-declarations
- run: *validate-ts-declarations
2018-09-03 18:38:49 +00:00
jet-test-ios:
<<: *macos_defaults
steps:
- attach_workspace:
at: ~/react-native-firebase
2018-09-03 19:07:05 +00:00
- run:
name: Start iPhone 7 Plus simulator (background)
background: true
command: xcrun simctl boot "iPhone 7 Plus" || true
2018-09-03 18:38:49 +00:00
- run:
name: Configure Environment Variables
command: |
echo 'export PATH=/usr/local/opt/node@8/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
2018-09-03 20:50:18 +00:00
- run: *restore-brew-cache
2018-09-03 19:07:05 +00:00
- run: *configure-jet-detox-environment
2018-09-03 20:50:18 +00:00
- run: *save-brew-cache
- restore-cache: *restore-pods-cache
2018-09-03 18:38:49 +00:00
- run:
2018-09-03 19:07:05 +00:00
name: Install CocoaPods + Pod Install
2018-09-03 18:38:49 +00:00
command: |
cd tests/ios
curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
pod install
- save-cache: *save-pods-cache
- restore-cache: *restore-ios-build-cache
2018-09-03 18:38:49 +00:00
- run:
name: Build iOS Testing App
command: cd tests && yarn run build-ios
2018-09-03 20:50:18 +00:00
- run: *packager-jet
- save-cache: *save-ios-build-cache
2018-09-03 18:52:04 +00:00
- run:
name: Run Jet Tests
command: cd tests && yarn run test-ios-cover
2018-09-03 18:38:49 +00:00
2018-09-03 17:28:55 +00:00
# -------------------------
# WORK FLOWS
# -------------------------
workflows:
version: 2
2018-09-03 18:38:49 +00:00
Test:
2018-09-03 17:28:55 +00:00
jobs:
2018-09-03 17:30:38 +00:00
# Checkout repo and run Yarn install at root and in tests
2018-09-03 18:38:49 +00:00
- checkout-code
# Run lint, flow, and typescript checks
- analyse:
requires:
2018-09-03 18:38:49 +00:00
- checkout-code
- jet-test-ios:
requires:
- checkout-code