-
Notifications
You must be signed in to change notification settings - Fork 157
/
circle.yml
161 lines (153 loc) · 4.22 KB
/
circle.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: cimg/android:2022.04
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: chmod permissions
command: chmod +x ./gradlew
- run:
name: scripts permissions
command: chmod +x ./circleciscripts/*.sh
- run:
name: Decrypt env vars
command: ./circleciscripts/decrypt_env_vars.sh
- run:
name: Make env vars available
command: cat secret-env-plain >> $BASH_ENV
- run:
name: Download keystore
command: ./circleciscripts/download_keystore.sh
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Build
command: ./gradlew build
- store_artifacts:
path: app/build/outputs/apk
destination: apks
- persist_to_workspace:
root: app
paths:
- build
test:
working_directory: ~/code
docker:
- image: cimg/android:2022.04
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- attach_workspace:
at: app
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: chmod permissions
command: chmod +x ./gradlew
- run:
name: Run unit tests
command: ./gradlew test
- run:
name: Run Lint Tests
command: ./gradlew lint test
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
deploy-appcenter:
working_directory: ~/code
docker:
- image: circleci/node:10
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- attach_workspace:
at: app
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: scripts permissions
command: chmod +x ./circleciscripts/*.sh
- run:
name: Deploy to hockeyapp
command: source ./circleciscripts/deployAppCenter.sh && uploadToAppCenter
deploy-gplay:
working_directory: ~/code
docker:
- image: cimg/android:2022.04
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- attach_workspace:
at: app
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: chmod permissions
command: chmod +x ./gradlew
- run:
name: scripts permissions
command: chmod +x ./circleciscripts/*.sh
- run:
name: Decrypt env vars
command: ./circleciscripts/decrypt_env_vars.sh
- run:
name: Make env vars available
command: cat secret-env-plain >> $BASH_ENV
- run:
name: Download keystore
command: ./circleciscripts/download_keystore.sh
- run:
name: Download keystore
command: ./circleciscripts/download_pubprofile.sh
- run:
name: Deploy to gplay
command: ./gradlew publishGplayReleaseApk
workflows:
version: 2
build-test-deploy:
jobs:
- build
- test:
requires:
- build
- deploy-appcenter: # never for branches
requires:
- test
filters:
branches:
only:
- master
- hold: # requires manual approval, never for branches
type: approval
requires:
- test
filters:
branches:
only:
- master
- deploy-gplay: # when manual approval and never for branches
requires:
- hold
filters:
# tags:
# only: /^release.*/
branches:
only:
- master