-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
154 lines (149 loc) · 4.68 KB
/
azure-pipelines.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
# Android
# Build your Android project with Gradle.
# Add steps that test, sign, and distribute the APK, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/android
# Pipeline shallow clone has been disabled (https://shorturl.at/otuX8) due to a
# sonar cloud warning (https://shorturl.at/muyJ4)
variables:
GRADLE_USER_HOME: $(Pipeline.Workspace)/.gradle
trigger:
- master
pool:
vmImage: 'macos-latest'
steps:
# Download & Copy sonar.properties
- task: DownloadSecureFile@1
displayName: 'Fetch sonar configurations.'
inputs:
secureFile: 'sonar.properties'
retryCount: '1'
- task: CopyFiles@2
displayName: 'Copy sonar configurations.'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: 'sonar.properties'
TargetFolder: $(Build.SourcesDirectory)/config
OverWrite: true
retryCount: '1'
# Download & Copy Firebase App Distribution Config json
- task: DownloadSecureFile@1
displayName: 'Fetch Firebase App Distribution Config.'
inputs:
secureFile: 'apps-catalog-e4a0b-140bcb296b4b.json'
retryCount: '1'
- task: CopyFiles@2
displayName: 'Copy Firebase App Distribution Config.'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: 'apps-catalog-e4a0b-140bcb296b4b.json'
TargetFolder: $(Build.SourcesDirectory)/config
OverWrite: true
retryCount: '1'
# Download & Copy keystore
- task: DownloadSecureFile@1
displayName: 'Fetch keystore.'
inputs:
secureFile: 'apps_catalog_keystore'
retryCount: '1'
- task: CopyFiles@2
displayName: 'Copy keystore.'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: 'apps_catalog_keystore'
TargetFolder: $(Build.SourcesDirectory)
OverWrite: true
retryCount: '1'
# Download & Copy signing.properties
- task: DownloadSecureFile@1
displayName: 'Fetch signing config.'
inputs:
secureFile: 'signing.properties'
retryCount: '1'
- task: CopyFiles@2
displayName: 'Copy signing config.'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: 'signing.properties'
TargetFolder: $(Build.SourcesDirectory)/config
OverWrite: true
retryCount: '1'
# Download & Copy google-services.json
- task: DownloadSecureFile@1
displayName: 'Fetch google-services.json.'
inputs:
secureFile: 'google-services.json'
retryCount: '1'
- task: CopyFiles@2
displayName: 'Copy google-services.json.'
inputs:
SourceFolder: $(Agent.TempDirectory)
Contents: 'google-services.json'
TargetFolder: $(Build.SourcesDirectory)/app
OverWrite: true
retryCount: '1'
- task: JavaToolInstaller@0
displayName: 'Setup to use JDK 17.'
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- script: |
# Accept all SDK licenses
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
displayName: 'Accept all Android SDK Licenses'
- task: Cache@2
displayName: 'Configure gradle caching'
inputs:
key: 'gradle | "$(Agent.OS)" | **/build.gradle.kts'
restoreKeys: |
gradle | "$(Agent.OS)"
gradle
path: '$(GRADLE_USER_HOME)'
- task: Gradle@3
displayName: 'Build (Compilation Check)'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'clean build'
- task: Gradle@3
displayName: 'Check code quality (Detekt).'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'detekt'
options: '--build-cache'
- task: Gradle@3
displayName: 'Check code quality (Sonar Cloud)'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'sonar'
options: '--build-cache'
- task: Gradle@3
displayName: 'Unit Tests'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'testDebugUnitTest'
options: '--build-cache'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
- task: Gradle@3
displayName: 'UI Tests'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'runUITests'
options: '--build-cache -Pandroid.sdk.channel=3 -Pandroid.testoptions.manageddevices.emulator.gpu=swiftshader_indirect'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
- task: Gradle@3
displayName: 'Upload to Firebase App Distribution.'
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
tasks: 'assembleDebug appDistributionUploadDebug'
options: '--build-cache'
- script: |
./gradlew --stop
displayName: 'Stop Gradle'