Skip to content

Instantly share code, notes, and snippets.

@alouanemed
Created August 2, 2018 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alouanemed/2b8ce7a154663ffd8b422f1b75748b4f to your computer and use it in GitHub Desktop.
Save alouanemed/2b8ce7a154663ffd8b422f1b75748b4f to your computer and use it in GitHub Desktop.
config.yml
version: 2.0
references:
cache_key: &cache_key
key: cache-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
restore_cache: &restore_cache
restore_cache:
<<: *cache_key
save_cache: &save_cache
save_cache:
<<: *cache_key
paths:
- ~/.gradle/caches
- ~/.gradle/wrapper
workspace: &workspace
~/workspace
attach_debug_workspace: &attach_debug_workspace
attach_workspace:
at: *workspace
attach_release_workspace: &attach_release_workspace
attach_workspace:
at: *workspace
persist_debug_workspace: &persist_debug_workspace
persist_to_workspace:
root: *workspace
paths:
- build
- app/build/intermediates
- app/build/outputs/androidTest-results
- app/build/outputs/apk
- app/build/outputs/code-coverage
- app/build/test-results
persist_release_workspace: &persist_release_workspace
persist_to_workspace:
root: *workspace
paths:
- app/build
android_config: &android_config
working_directory: *workspace
docker:
- image: circleci/android:api-27-alpha
environment:
JAVA_TOOL_OPTIONS: "-Xmx2000m"
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2 -Dkotlin.incremental=false"
TERM: dumb
update_sdk: &update_sdk
name: Update SDK
command: |
mkdir "$ANDROID_HOME/licenses" || true
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
echo "84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
sdkmanager "platform-tools" "platforms;android-27"
jobs:
build_Takatorder_debug:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Gradle build (debug) for TakatOrder
command: ./gradlew assembleTakatorderDebug assembleTakatorderDebugAndroidTest
- *persist_debug_workspace
- store_artifacts:
path: app/build/outputs/apk/
destination: /apk/
build_Taghbalo_debug:
<<: *android_config
steps:
- run:
<<: *update_sdk
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Gradle build (debug) for Taghbalo
command: ./gradlew check assembleTaghbaloDebug dependencyUpdates
- *persist_debug_workspace
- store_artifacts:
path: app/build/outputs/apk/
destination: /apk/
- store_artifacts:
path: build/dependencyUpdates
destination: dependencyUpdates
build_Takatorder_release:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Gradle build (release)
command: ./gradlew assembleTakatorderRelease
- *persist_release_workspace
- store_artifacts:
path: app/build/outputs/apk/
destination: /apk/
- store_artifacts:
path: app/build/outputs/mapping/
destination: /mapping/
build_Taghbalo_release:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Gradle build (release)
command: ./gradlew assembleTaghbaloRelease
- *persist_release_workspace
- store_artifacts:
path: app/build/outputs/apk/
destination: /apk/
- store_artifacts:
path: app/build/outputs/mapping/
destination: /mapping/
test_Takatorder_unit:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Run unit tests
command: ./gradlew testTakatorderDebugUnitTest
- *persist_debug_workspace
- store_artifacts:
path: app/build/reports/
destination: /reports/
- store_test_results:
path: app/build/test-results/
destination: /test-results/
test_Taghbalo_unit:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *save_cache
- run:
name: Run unit tests
command: ./gradlew testTaghbaloDebugUnitTest
- *persist_debug_workspace
- store_artifacts:
path: app/build/reports/
destination: /reports/
- store_test_results:
path: app/build/test-results/
destination: /test-results/
report_coverage_Takatorder:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *attach_debug_workspace
- run:
name: Generate JaCoCo report
command: ./gradlew -PciBuild=true testTakatorderDebugUnitTestCoverage
- store_artifacts:
path: app/build/reports/
destination: /reports/
report_coverage_Taghbalo:
<<: *android_config
steps:
- checkout
- *restore_cache
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- *attach_debug_workspace
- run:
name: Generate JaCoCo report
command: ./gradlew testTaghbaloDebugUnitTestCoverage
- store_artifacts:
path: app/build/reports/
destination: /reports/
workflows:
version: 2
# build-Takatorder:
# jobs:
# - build_Takatorder_debug
# # - build_Takatorder_release:
# - test_Takatorder_unit:
# requires:
# - build_Takatorder_debug
# - test_Takatorder_unit:
# requires:
# - build_Takatorder_debug
# - report_coverage_Takatorder:
# requires:
# - test_Takatorder_unit
build-Taghbalo:
jobs:
- build_Taghbalo_debug
# - build_Taghbalo_release
- test_Taghbalo_unit:
requires:
- build_Taghbalo_debug
- report_coverage_Taghbalo:
requires:
- test_Taghbalo_unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment