-
Notifications
You must be signed in to change notification settings - Fork 0
/
codemagic.yaml
194 lines (190 loc) · 6.47 KB
/
codemagic.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
workflows:
appTester:
environment:
groups:
- firebase_credentials
- signing
max_build_duration: 60
triggering:
events:
- push
branch_patterns:
- pattern: 'develop'
include: true
source: true
cancel_previous_builds: true
name: App Distribution
scripts:
- name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/local.properties"
- name: Set chmod +x gradlew
script: chmod +x gradlew
- name: Pre-build
script: |
#!/bin/sh
set -ex
echo $CM_KEYSTORE_FILE | base64 --decode > $CM_BUILD_DIR/dayoff.keystore
echo $ANDROID_FIREBASE_JSON | base64 --decode > $CM_BUILD_DIR/app/google-services.json
- name: bundle Release
script: ./gradlew app:bundleRelease
- name: Build universal apk
script: |
#!/bin/sh
set -ex
android-app-bundle build-universal-apk \
--bundle $FCI_BUILD_DIR/app/build/outputs/bundle/release/app-release.aab \
--ks $FCI_BUILD_DIR/dayoff.keystore \
--ks-pass $CM_KEYSTORE_PASSWORD \
--ks-key-alias $CM_KEY_ALIAS \
--key-pass $CM_KEY_PASSWORD
- name: Write release notes
script: |
#!/bin/sh
set -ex
echo "[$CM_BRANCH]($BUILD_NUMBER)" >> release_notes.txt
git shortlog >> release_notes.txt
git log -1 --pretty=%B >> release_notes.txt
echo $CM_ARTIFACT_LINKS >> release_notes.txt
cat release_notes.txt
artifacts:
- app/build/**/outputs/bundle/**/app-release-universal.apk
- app/build/**/outputs/bundle/**/*.aab
- app/build/**/outputs/apk/**/*.apk
- build/**/outputs/**/mapping.txt
publishing:
firebase:
firebase_token: $FIREBASE_TOKEN
android:
app_id: $FIREBASE_APP_ID
groups:
- testeurs-release
artifact_type: apk
email:
recipients:
notify:
success: true
failure: true
slack:
channel: '#general'
notify_on_build_start: true # To receive a notification when a build starts
notify:
success: true # To not receive a notification when a build succeeds
failure: true # To not receive a notification when a build fails
cache:
cache_paths:
- ~/.gradle/caches
testLab:
environment:
groups:
- firebase_credentials
- signing
max_build_duration: 60
triggering:
events:
- push
branch_patterns:
- pattern: 'release'
include: true
source: true
cancel_previous_builds: true
name: test lab
scripts:
- name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/local.properties"
- name: Set chmod +x gradlew
script: chmod +x gradlew
- name: Pre-build
script: |
#!/bin/sh
set -ex
echo $CM_KEYSTORE_FILE | base64 --decode > $CM_BUILD_DIR/dayoff.keystore
echo $ANDROID_FIREBASE_JSON | base64 --decode > $CM_BUILD_DIR/app/google-services.json
- name: assemble Android Test
script: ./gradlew app:bundleDebug app:assembleDebugAndroidTest
- name: Run Firebase Test Lab tests
script: |
#!/bin/sh
#--results-bucket=tests-lab
set -ex
echo $GCLOUD_KEY_FILE | base64 --decode > ./gcloud_key_file.json
gcloud auth activate-service-account --key-file=gcloud_key_file.json
gcloud --quiet config set project $FIREBASE_PROJECT
gcloud firebase test android run \
--type instrumentation \
--app $FCI_BUILD_DIR/app/build/outputs/bundle/debug/app-debug.aab \
--test $FCI_BUILD_DIR/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk \
--device model=oriole,version=31 \
--device model=redfin,version=30 \
--device model=Nexus6,version=21 \
--environment-variables coverage=true,coverageFile="/sdcard/coverage.ec" \
--directories-to-pull /sdcard \
--timeout 3m
publishing:
slack:
channel: '#general'
notify_on_build_start: true # To receive a notification when a build starts
notify:
success: true # To not receive a notification when a build succeeds
failure: true # To not receive a notification when a build fails
cache:
cache_paths:
- ~/.gradle/caches
android:
environment:
groups:
- firebase_credentials
- signing
max_build_duration: 60
triggering:
events:
- pull_request
branch_patterns:
- pattern: '*'
include: true
source: true
cancel_previous_builds: true
#instance_type: mac_pro
name: build, test & publish Android version
scripts:
- name: Set Android SDK location
script: |
echo "sdk.dir=$ANDROID_SDK_ROOT" > "$FCI_BUILD_DIR/local.properties"
echo $CM_BUILD_DIR
- name: Set chmod +x gradlew
script: chmod +x gradlew
- name: Pre-build
script: |
echo $CM_KEYSTORE_FILE | base64 --decode > $CM_BUILD_DIR/dayoff.keystore
echo $ANDROID_FIREBASE_JSON | base64 --decode > $CM_BUILD_DIR/app/google-services.json
- name: Build bundle debug aab
script: |
./gradlew bundleDebug
- name: Test & coverage
script: |
./gradlew testDebugUnitTest testDebugUnitTestCoverage --stacktrace
test_report: '**/build/test-results/**/*.xml'
- name: Lint
script: ./gradlew lintDebug
#- name: Kover
# script: ./gradlew koverMergedReport
artifacts:
- app/build/**/outputs/bundle/**/*.aab
- '**/build/reports/lint-results-*.html'
- build/**/outputs/**/mapping.txt
#- build/reports/kover/html
- '**/build/coverage-report'
- build/reports/configuration-cache
publishing:
slack:
channel: '#general'
notify_on_build_start: true # To receive a notification when a build starts
notify:
success: true # To not receive a notification when a build succeeds
failure: true # To not receive a notification when a build fails
cache:
cache_paths:
- ~/.gradle/caches