-
Notifications
You must be signed in to change notification settings - Fork 106
241 lines (223 loc) · 8.7 KB
/
android.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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Android CI
on:
push:
branches: [ main ]
paths: [ '.github/**', 'android/**' ]
pull_request:
branches: [ main ]
paths: [ '.github/**', 'android/**' ]
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
# Setup
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Deploy APK signing keystore and related secrets (test signing)
if: ${{ github.event_name != 'pull_request' }}
env:
KEYSTORE_BASE64: ${{ secrets.APK_SIGNING_TEST_KEYSTORE }}
KEYSTORE_PATH: ${{ runner.temp }}/apk_signing_keystore.jks
run: echo $KEYSTORE_BASE64 | base64 --decode > $KEYSTORE_PATH
# Build
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle and run tests
env:
ORG_GRADLE_PROJECT_apkSigningKeystorePath: ${{ runner.temp }}/apk_signing_keystore.jks
ORG_GRADLE_PROJECT_apkSigningKeyAlias: signing
ORG_GRADLE_PROJECT_apkSigningKeystorePassword: ${{ secrets.APK_SIGNING_TEST_PASSWORD }}
ORG_GRADLE_PROJECT_apkSigningKeyPassword: ${{ secrets.APK_SIGNING_TEST_PASSWORD }}
run: ./gradlew build
# Upload binaries to workflow artifacts
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: binaries
path: |
android/clientlib/build/outputs/aar/*.aar
android/clientlib-ktx/build/outputs/aar/*.aar
android/common/build/outputs/aar/*.aar
android/fakedapp/build/outputs/apk/**/*.apk
android/fakewallet/build/outputs/apk/**/*.apk
android/walletlib/build/outputs/aar/*.aar
if-no-files-found: error
retention-days: 5
# Upload javadoc to workflow artifacts
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: clientlib-javadoc
path: |
android/clientlib/build/docs/*
!android/clientlib/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: common-javadoc
path: |
android/common/build/docs/*
!android/common/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: walletlib-javadoc
path: |
android/walletlib/build/docs/*
!android/walletlib/build/docs/**/*.zip
if-no-files-found: error
retention-days: 1
# Publish to Maven Central (only for releases that start with 'v')
- name: Publish to Maven Central (release only)
if: ${{ github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v') }}
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PASSWORD }}
TAG: ${{ github.event.release.tag_name }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -P version=${TAG:1}
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
include:
- api-level: 27
recipe_uuid: ea5fda48-fa8b-48c1-8acc-07d910856141 # Pixel XL, Android 8.1 (API 27)
# fb936099-d261-4dd3-8dec-3fc14f1d0f03 # Pixel 3a, Android 9.0 (API 28)
# 4c015ada-e64e-4f5d-a320-06cbf6e95648 # Pixel 3a, Android 10 (API 29)
# 95016679-8f8d-4890-b026-e4ad889aadf1 # Pixel 3a, Android 11 (API 30)
# see here for more recipes: https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
steps:
# Setup
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9.16"
architecture: "x64"
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v3
# Caching
- name: Gradle cache
uses: gradle/actions/setup-gradle@v4
# Create Genymotion instance
- name: Start Genymotion Cloud SaaS instance
uses: genymobile/genymotion-saas-github-action@v1
with:
api_token: ${{ secrets.GMSAAS_API_KEY }}
recipe_uuid: ${{ matrix.recipe_uuid }}
# Run the tests
- name: Run Android Integration Tests
run: |
cd android
adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS
./gradlew :fakewallet:connectedV1DebugAndroidTest
./gradlew :fakewallet:installV1Debug :fakedapp:connectedDebugAndroidTest
# Archive test results
- name: Archive fakewallet test results
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: fakewallet-connected-test-results-${{ matrix.api-level }}
path: android/fakewallet/build/reports/androidTests/connected/
retention-days: 7
- name: Archive fakedapp test results
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v4
with:
name: fakedapp-connected-test-results-${{ matrix.api-level }}
path: android/fakedapp/build/reports/androidTests/connected/
retention-days: 7
# Note: only runs on 'push' events
publish-to-gh-pages:
runs-on: ubuntu-latest
needs: build
concurrency: publish-to-gh-pages
if: ${{ github.event_name == 'push' }}
steps:
- name: Update clientlib javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: clientlib-javadoc
dest: clientlib
commit-message: 'Update clientlib javadoc'
- name: Update common javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: common-javadoc
dest: common
commit-message: 'Update common javadoc'
- name: Update walletlib javadoc
uses: solana-mobile/gha-commit-artifact-to-branch@v2
with:
token: ${{ secrets.UPDATE_GITHUB_PAGES_TOKEN }}
branch: gh-pages
artifact-name: walletlib-javadoc
dest: walletlib
commit-message: 'Update walletlib javadoc'
# Note: only runs on 'release' events
upload-to-release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write # needed for uploading files to releases
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/download-artifact@v4
with:
name: binaries
path: binaries
- uses: actions/download-artifact@v4
with:
name: clientlib-javadoc
path: clientlib-javadoc
- uses: actions/download-artifact@v4
with:
name: common-javadoc
path: common-javadoc
- uses: actions/download-artifact@v4
with:
name: walletlib-javadoc
path: walletlib-javadoc
- name: Compress clientlib javadoc
run: tar -cvzf clientlib-javadoc/clientlib-javadoc.tgz -C clientlib-javadoc javadoc
- name: Compress common javadoc
run: tar -cvzf common-javadoc/common-javadoc.tgz -C common-javadoc javadoc
- name: Compress walletlib javadoc
run: tar -cvzf walletlib-javadoc/walletlib-javadoc.tgz -C walletlib-javadoc javadoc
- name: Upload files to release
run: find ${FILES} -type f -exec gh release -R ${GITHUB_REPOSITORY} upload ${TAG} {} +
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
FILES: |
binaries/
clientlib-javadoc/clientlib-javadoc.tgz
common-javadoc/common-javadoc.tgz
walletlib-javadoc/walletlib-javadoc.tgz