version: 2 jobs: build: docker: - image: circleci/android:api-27-alpha environment: JAVA_OPTS: -Xmx1536m GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx1536m -XX:+HeapDumpOnOutOfMemoryError"' steps: - checkout - run: echo "source $(git rev-parse --show-toplevel)/.circleci/bash.source" >> $BASH_ENV - restore_cache: key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }} - restore_cache: key: bundle-{{ checksum "Gemfile.lock" }} - run: name: Bundle install command: bundle install --path vendor/bundle - save_cache: paths: - vendor/bundle key: bundle-{{ checksum "Gemfile.lock" }} - run: name: Download Dependencies command: ./gradlew androidDependencies - save_cache: key: jars-{{ checksum "build.gradle.kts" }}-{{ checksum "app/build.gradle.kts" }} paths: - ~/.gradle - run: name: decrypt keystore command: | if should_be_release; then openssl aes-256-cbc -k $KEYSTORE_DECRYPT_PASSWORD -d -in encrypted-droidkaigi-key -out release.keystore -md sha256 fi - run: name: decrypt json command: | if should_be_release; then openssl aes-256-cbc -k $JSON_DECRYPT_PASSWORD -d -in encrypted-google-services.json -out app/google-services.json -md sha256 fi - run: name: Test command: | if should_be_release; then ./gradlew --stacktrace testRelease else ./gradlew --stacktrace test${APP_BUILD_TYPE^} fi - run: name: Build command: | if should_be_release; then ./gradlew --offline --stacktrace assembleRelease else ./gradlew --offline --stacktrace assemble${APP_BUILD_TYPE^} fi - run: name: Check command: | if ! is_on_master_or_release && ! deploy_to_google_play; then ./gradlew --stacktrace lint${APP_BUILD_TYPE^} ./gradlew --stacktrace ktlint${APP_BUILD_TYPE^}Check bundle exec danger fi - run: name: Deploy command: | if deploy_to_deploygate; then ./gradlew :app:uploadDeployGateRelease elif deploy_to_google_play; then echo "Deploy to Google Play" openssl aes-256-cbc -k $PUBLISHER_KEYS_JSON_DECRYPT_PASSWORD -d -in encrypted-publisher-keys.json -out app/publisher-keys.json -md md5 ./gradlew publishApkRelease fi - store_artifacts: path: app/build/reports destination: reports - store_artifacts: path: app/build/outputs/apk destination: apk # workaround for tag trigger # because workflow git tag trigger does not work well deployment: fake_for_deploy: tag: /.*/ commands: - echo "make tags run in 2.0"