forked from igorwojda/android-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
113 lines (100 loc) · 3.6 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
version: 2.1
references:
container_config: &container_config
docker:
- image: circleci/android:api-29
working_directory: ~/data
environment:
JVM_OPTS: -Xmx3g
commands:
generate-gradle-checksums:
steps:
- run:
name: Generate Gradle checksums
command: |
# This finds all *.kt files and generates checksums for caching
find buildSrc -name "*.kt" -type f | sort | xargs shasum > gradle-checksums.txt
cat gradle-checksums.txt
restore-gradle-cache:
description: Restore the cache of ~/.gradle based on the local build files.
steps:
- generate-gradle-checksums
- restore_cache:
keys:
- gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "gradle-checksums.txt" }}
- gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-
save-gradle-cache:
description: Cache the contents of ~/.gradle based on the local build files.
steps:
- save_cache:
paths:
- ~/.gradle
key: gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "gradle-checksums.txt" }}
jobs:
update_dependency_cache:
<<: *container_config
steps:
- checkout
- restore-gradle-cache
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save-gradle-cache
ktlint:
<<: *container_config
steps:
- checkout
- restore-gradle-cache
- run: ./gradlew ktlintCheck
detekt:
<<: *container_config
steps:
- checkout
- restore-gradle-cache
- run: ./gradlew detekt
lint:
<<: *container_config
steps:
- checkout
- restore-gradle-cache
# pure "lint" gradle task should be avoided because it is parent task for lintDebug and lintRelease (it runs lint
# multiple times for each build variant). We want to run "lintDebug" task, because it's faster.
- run: ./gradlew lintDebug
unit_test:
<<: *container_config
steps:
- checkout
- restore-gradle-cache
- run: ./gradlew testDebugUnitTest
build_app:
description: An executor with sensible defaults for Android Gradle tasks (set with GRADLE_OPTS).
<<: *container_config
environment:
GRADLE_OPTS: -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false
steps:
- checkout
- restore-gradle-cache
- run: ./gradlew :app:bundleDebug
workflows:
version: 2
check:
jobs:
- update_dependency_cache
- lint:
requires:
- update_dependency_cache
- detekt:
requires:
- update_dependency_cache
- ktlint:
requires:
- update_dependency_cache
- unit_test:
requires:
- update_dependency_cache
- build_app:
requires:
- lint
- detekt
- ktlint
- unit_test