SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 149 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. version: 2
  2. references:
  3.   workspace: &workspace
  4.     ~/src
  5.  
  6.   android_config: &android_config
  7.     working_directory: *workspace
  8.     docker:
  9.       - image: circleci/android:api-28-alpha
  10.     environment:
  11.       TERM: dumb
  12.       _JAVA_OPTIONS: "-Xmx2048m -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
  13.       GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m"'
  14.  
  15.   gradle_key: &gradle_key
  16.     jars-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
  17.  
  18.   gem_key: &gems_key
  19.     gems-{{ checksum "Gemfile.lock" }}
  20.  
  21.   restore_gradle_cache: &restore_gradle_cache
  22.     restore_cache:
  23.       key: *gradle_key
  24.  
  25.   restore_gems_cache: &restore_gems_cache
  26.     restore_cache:
  27.       key: *gems_key
  28.  
  29.   save_gradle_cache: &save_gradle_cache
  30.     save_cache:
  31.       key: *gradle_key
  32.       paths:
  33.         - ~/.gradle
  34.         - ~/.m2
  35.  
  36.   save_gems_cache: &save_gems_cache
  37.     save_cache:
  38.       key: *gems_key
  39.       paths:
  40.         - vendor/bundle
  41.  
  42.   ruby_dependencies: &ruby_dependencies
  43.     run:
  44.       name: Download Ruby Dependencies
  45.       command: |
  46.         gem install bundler
  47.         bundle check || bundle install --path vendor/bundle
  48.  
  49.   android_dependencies: &android_dependencies
  50.     run:
  51.       name: Download Android Dependencies
  52.       command: ./gradlew androidDependencies
  53.  
  54.   decode_android_key: &decode_android_key
  55.     run:
  56.       name: Decode Android key store
  57.       command: echo $KEYSTORE | base64 -d | tee keystore app/keystore > /dev/null
  58.  
  59.   create_keystore_properties: &create_keystore_properties
  60.     run:
  61.       name: Create keystore.properties
  62.       command: printf 'releaseKeyAlias=%s\nreleaseKeyPassword=%s\nreleaseKeyStore=%s\nreleaseStorePassword=%s' \
  63.         $RELEASE_KEY_ALIAS $RELEASE_KEY_PASSWORD $RELEASE_KEYSTORE $RELEASE_STORE_PASSWORD > keystore.properties
  64.  
  65.   create_google_play_key: &create_google_play_key
  66.     run:
  67.       name: Create Google Play Key
  68.       command: echo $GOOGLE_PLAY_KEY > google-play-key.json
  69.  
  70. jobs:
  71.  
  72.   #Run Unit Test
  73.   test_unit:
  74.     <<: *android_config
  75.     steps:
  76.       - checkout
  77.       - *restore_gradle_cache
  78.       - *restore_gems_cache
  79.       - *ruby_dependencies
  80.       - *create_keystore_properties
  81.       - *decode_android_key
  82.       - *android_dependencies
  83.       - *save_gradle_cache
  84.       - *save_gems_cache
  85.  
  86.       - run:
  87.           name: Run Unit Tests
  88.           command: bundle exec fastlane assemble_build build_flavor:$BUILD_FLAVOR build_type:$BUILD_TYPE
  89.  
  90.       - store_artifacts:
  91.           path: app/build/reports
  92.           destination: /reports/
  93.  
  94.       - store_test_results:
  95.           path: app/build/test-results
  96.           destination: /test-results
  97.  
  98.   # Run UI Test
  99.   test_instrumentation:
  100.     <<: *android_config
  101.     steps:
  102.       - checkout
  103.       - *restore_gradle_cache
  104.       - *restore_gems_cache
  105.       - *ruby_dependencies
  106.       - *create_keystore_properties
  107.       - *decode_android_key
  108.       - *android_dependencies
  109.       - *save_gradle_cache
  110.       - *save_gems_cache
  111.  
  112.       - run:
  113.           name: Run instrumentation tests in Firebase Testlab
  114.           command: bundle exec fastlane instrumentation_tests_testlab build_flavor:$BUILD_FLAVOR
  115.  
  116.       - run:
  117.           name: Send Debug and Release Apk
  118.           command: |
  119.               bundle exec fastlane send_apk_to_slack build_flavor:"Dev" build_type:"Debug"
  120.               bundle exec fastlane send_apk_to_slack build_flavor:"Pro" build_type:"Release"    
  121.  
  122.       - store_artifacts:
  123.           path: app/build/outputs/apk
  124.           destination: /apk/  
  125.  
  126.       - store_artifacts:
  127.           path: firebase/
  128.           destination: /firebase/
  129.  
  130.   beta_deployment:
  131.     <<: *android_config
  132.     steps:
  133.       - checkout
  134.       - *restore_gradle_cache
  135.       - *restore_gems_cache
  136.       - *ruby_dependencies
  137.       - *create_keystore_properties
  138.       - *decode_android_key
  139.       - *android_dependencies
  140.       - *save_gradle_cache
  141.       - *save_gems_cache
  142.       - *create_google_play_key
  143.  
  144.       - run:
  145.           name: Deploy to Play Store
  146.           command: bundle exec fastlane beta
  147.  
  148.       - store_artifacts:
  149.           path: app/build/outputs/mapping/
  150.           destination: /mapping/
  151.  
  152.   # Deploy to google play store
  153.   release_deployment:
  154.     <<: *android_config
  155.     steps:
  156.       - checkout
  157.       - *restore_gradle_cache
  158.       - *restore_gems_cache
  159.       - *ruby_dependencies
  160.       - *create_keystore_properties
  161.       - *decode_android_key
  162.       - *android_dependencies
  163.       - *save_gradle_cache
  164.       - *save_gems_cache
  165.       - *create_google_play_key
  166.  
  167.  
  168.       - run:
  169.           name: Deploy to Play Store
  170.           command: bundle exec fastlane release
  171.  
  172.       - store_artifacts:
  173.           path: app/build/outputs/mapping/
  174.           destination: /mapping/
  175.  
  176. workflows:
  177.   version: 2
  178.   workflow:
  179.     jobs:
  180.       - test_unit
  181.      
  182.       - test_instrumentation:
  183.           requires:
  184.             - test_unit
  185.  
  186.       - beta_deployment:
  187.           filters:
  188.             branches:
  189.               only:
  190.                 - beta
  191.           requires:
  192.             - test_unit
  193.             - test_instrumentation
  194.  
  195.       - release_deployment:
  196.           filters:
  197.             branches:
  198.               only:
  199.                 - master
  200.           requires:
  201.             - test_unit
  202.             - test_instrumentation
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top