version: 2 jobs: build: working_directory: ~/code docker: - image: circleci/android:api-28 environment: JVM_OPTS: -XX\:MaxHeapSize\=2048m -Xmx1536m LIBS: NoFree BUILD_TYPE: Release APPCENTER_OWNER: nicidienase APPCENTER_GROUP: "Collaborators" RELEASENOTES_FILE: "release_notes.txt" branches: only: - master - develop - /feature\/.*/ steps: - checkout - restore_cache: key: jars-{{ checksum "build.gradle" }}-{{ checksum "touch/build.gradle" }}-{{ checksum "leanback/build.gradle" }}-{{ checksum "common/build.gradle" }} - run: name: Setup env command: | .circleci/setup_env.sh >> $BASH_ENV echo "VERSION_CODE_TOUCH=$(.circleci/getVersionCode.sh -t)" >> $BASH_ENV echo "VERSION_CODE_LEANBACK=$(.circleci/getVersionCode.sh -l)" >> $BASH_ENV # . $BASH_ENV # echo "STAGE=${STAGE}" # echo "VERSION_NAME=${VERSION_NAME}" # echo "VersionCode: $(.circleci/getVersionCode.sh -t)" # echo "BUILD_TYPE_LOWER=${BUILD_TYPE_LOWER}" # echo "STAGE_LOWER=${STAGE_LOWER}" # echo "LIBS_LOWER=${LIBS_LOWER}" - run: name: Download Dependencies command: ./gradlew $SIGN_CONFIG androidDependencies - run: name: ktlint command: | ./gradlew $SIGN_CONFIG --continue \ common:ktlint${STAGE}${LIBS}${BUILD_TYPE}Check \ touch:ktlint${STAGE}${LIBS}${BUILD_TYPE}Check \ leanback:ktlint${STAGE}${LIBS}${BUILD_TYPE}Check - run: name: Build Touch command: | ./gradlew $SIGN_CONFIG \ -PversionCode=$VERSION_CODE_TOUCH \ -PversionName=${VERSION_NAME} \ touch:assemble${STAGE_LOWER}${LIBS}${BUILD_TYPE} - run: name: Build Leanback command: | ./gradlew $SIGN_CONFIG \ -PversionCode=$VERSION_CODE_LEANBACK \ -PversionName=${VERSION_NAME} \ leanback:assemble${STAGE_LOWER}${LIBS}${BUILD_TYPE} - run: name: Test command: | ./gradlew $SIGN_CONFIG --continue \ common:test${STAGE}${LIBS}${BUILD_TYPE}UnitTest \ common:lint${STAGE}${LIBS}${BUILD_TYPE} \ touch:test${STAGE}${LIBS}${BUILD_TYPE}UnitTest \ touch:lint${STAGE}${LIBS}${BUILD_TYPE} \ leanback:test${STAGE}${LIBS}${BUILD_TYPE}UnitTest \ leanback:lint${STAGE}${LIBS}${BUILD_TYPE} - store_artifacts: path: common/build/outputs destination: common-reports - store_artifacts: path: touch/build/outputs destination: touch - store_artifacts: path: touch/build/outputs destination: touch-reports - store_artifacts: path: leanback/build/outputs destination: leanback - store_artifacts: path: leanback/build/reports destination: leanback-reports - store_artifacts: path: common/build/reports/ktlint/ destination: ktlint-reports - store_test_results: path: common/build/test-results - store_test_results: path: touch/build/test-results - store_test_results: path: leanback/build/test-results - run: name: Appcenter Upload command: | git log --format="%h %s" master..HEAD > $RELEASENOTES_FILE .circleci/appCenterUpload.sh \ $APPCENTER_OWNER \ $APPCENTER_TOKEN \ "touch/build/outputs/apk/${STAGE_LOWER}${LIBS}/${BUILD_TYPE_LOWER}/touch-${STAGE_LOWER}-${LIBS_LOWER}-${BUILD_TYPE_LOWER}.apk" \ $RELEASENOTES_FILE \ $APPCENTER_GROUP \ "touch/build/outputs/mapping/${STAGE_LOWER}${LIBS}/${BUILD_TYPE_LOWER}/mapping.txt" \ "$VERSION_CODE_TOUCH" \ "$VERSION_NAME" - save_cache: paths: - ~/.gradle key: jars-{{ checksum "build.gradle" }}-{{ checksum "touch/build.gradle" }}-{{ checksum "leanback/build.gradle" }}-{{ checksum "common/build.gradle" }}