-
-
Notifications
You must be signed in to change notification settings - Fork 226
308 lines (271 loc) Β· 13.1 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
---
name: π± Android
on:
push:
branches:
- master
- release-**
pull_request:
release:
types: ['published']
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
include:
- triplet: 'arm64-android'
qt_arch: 'android_arm64_v8a'
all_files_access: 'OFF'
- triplet: 'arm64-android'
qt_arch: 'android_arm64_v8a'
all_files_access: 'ON'
- triplet: 'arm-neon-android'
qt_arch: 'android_armv7'
all_files_access: 'OFF'
- triplet: 'arm-neon-android'
qt_arch: 'android_armv7'
all_files_access: 'ON'
- triplet: 'x64-android'
qt_arch: 'android_x86_64'
all_files_access: 'OFF'
- triplet: 'x64-android'
qt_arch: 'android_x86_64'
all_files_access: 'ON'
- triplet: 'x86-android'
qt_arch: 'android_x86'
all_files_access: 'OFF'
- triplet: 'x86-android'
qt_arch: 'android_x86'
all_files_access: 'ON'
steps:
- name: π£ Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: πΎ Prepare variables
id: vars
shell: bash
run: |
echo "ANDROID_NDK_VERSION=23.1.7779620" >> $GITHUB_ENV
echo "ANDROID_BUILD_TOOLS_VERSION=30.0.3" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/23.1.7779620" >> $GITHUB_ENV
echo "ndk.dir=$ANDROID_NDK_HOME" >> local.properties
ALL_FILES_ACCESS=${{ matrix.all_files_access }} ./scripts/ci/env_gh.sh
BUILD_ROOT="/home/runner"
echo "BUILD_ROOT=${BUILD_ROOT}" >> $GITHUB_ENV
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CMAKE_BUILD_DIR=${BUILD_ROOT}/builddir" >> $GITHUB_ENV
- name: π© Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: π Install Qt (Android)
uses: jurplel/install-qt-action@v3
with:
version: 6.5.2
modules: 'qt5compat qtcharts qtpositioning qtserialport qtconnectivity qtmultimedia qtwebview qtsensors'
target: android
arch: ${{ matrix.qt_arch }}
cache: false
- name: π Install Qt (Desktop)
uses: jurplel/install-qt-action@v3
with:
version: 6.5.2
modules: 'qt5compat qtcharts qtpositioning qtserialport qtconnectivity qtmultimedia qtwebview qtsensors'
target: desktop
cache: false
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.triplet }}-qt6
max-size: 200M
# The sentry-android dependency is added via gradle
# This downloads the pre-compiled sentry-android-ndk libraries
# But we are compiling this before gradle is executed, so it is not downloaded
# Therefore we download it manually to get include headers and libraries
# ... a better implementation of this much appreciated ...
- name: Download sentry libs
run: |
mkdir /tmp/sentry-android-ndk
wget https://repo1.maven.org/maven2/io/sentry/sentry-android-ndk/6.13.1/sentry-android-ndk-6.13.1.aar -O /tmp/sentry.zip
unzip /tmp/sentry.zip -d /tmp/sentry-android-ndk
- name: π± Update ndk
run: |
echo "ndk.dir=$ANDROID_NDK_HOME" >> local.properties
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --uninstall "ndk-bundle"
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager "platforms;android-31" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" "ndk;$ANDROID_NDK_VERSION" tools platform-tools
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses
- name: π± Install dependencies and generate project files
env:
WORKSPACE: ${{ github.workspace }}
run: |
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} source ./scripts/version_number.sh
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} source ./scripts/ci/generate-version-details.sh
cmake -S "${{ github.workspace }}" \
-B "${CMAKE_BUILD_DIR}" \
-G Ninja \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D SYSTEM_QT=ON \
-D ANDROID_SDK=/usr/local/lib/android/sdk/ \
-D ANDROID_SDK_ROOT=/usr/local/lib/android/sdk/ \
-D ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION}" \
-D ANDROID_BUILD_TOOLS_VERSION="${ANDROID_BUILD_TOOLS_VERSION}" \
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
-D WITH_ALL_FILES_ACCESS="${{ matrix.all_files_access }}" \
-D WITH_SPIX=OFF \
-D CMAKE_PREFIX_PATH=${Qt6_DIR} \
-D QT_HOST_PATH=/home/runner/work/QField/Qt/6.5.2/gcc_64 \
-D QT_HOST_PATH_CMAKE_DIR:PATH=/home/runner/work/QField/Qt/6.5.2/gcc_64 \
-D APP_VERSION="${APP_VERSION}" \
-D APK_VERSION_CODE="${APK_VERSION_CODE}" \
-D APP_VERSION_STR="${APP_VERSION_STR}" \
-D APP_PACKAGE_NAME="${APP_PACKAGE_NAME}" \
-D APP_ICON="${APP_ICON}" \
-D APP_NAME="${APP_NAME}" \
-D NUGET_USERNAME=opengisch \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D SENTRY_DSN=${{ secrets.SENTRY_DSN }} \
-D SENTRY_ENV="${APP_ENV}" \
-D SENTRY_IMPORT_PREFIX=/tmp/sentry-android-ndk/jni
- name: π Upload Dep Build Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: build-logs-${{ matrix.triplet }}
path: |
${{ env.CMAKE_BUILD_DIR }}/**/*.log
- name: π Build
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config ${{ env.BUILD_TYPE }}
- name: Setup signing key
env:
SIGNINGKEY: ${{ secrets.PLAYSTORE_SIGNINGKEY }}
run: |
echo "$SIGNINGKEY" | base64 --decode > ./keystore.p12
- name: Cache .gradle
uses: burrunan/gradle-cache-action@v1
- name: Package
env:
KEYNAME: qfield
KEYPASS: ${{ secrets.KEYPASS }}
STOREPASS: ${{ secrets.STOREPASS }}
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target bundle --config Release
- name: π¦ Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.APP_PACKAGE_NAME }}-android-${{ matrix.triplet }}
path: |
${{ env.CMAKE_BUILD_DIR }}/src/app/android-build/build/outputs/apk/release/android-build-release-signed.apk
- name: πΊ Deploy
run: |
sudo apt install -y s3cmd
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} ./scripts/ci/upload_artifacts.sh
env:
S3CFG: ${{ secrets.S3CFG }}
- name: Upload release assets
uses: AButler/upload-release-assets@v2.0
if: ${{ github.event_name == 'release' && matrix.all_files_access == 'OFF' }}
with:
files: /tmp/qfield-*.apk
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ env.CI_TAG }}
- name: Upload debug symbols
# if: release or labeled PR
if: ${{ matrix.all_files_access == 'OFF' }}
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: |
curl -sL https://sentry.io/get-cli/ | bash
sentry-cli upload-dif -o opengisch -p qfield ${{ env.CMAKE_BUILD_DIR }}/android-build/build/intermediates/merged_native_libs/release
deploy_to_playstore:
name: deploy to play store
runs-on: ubuntu-20.04
needs: build
if: ${{ github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Vars
id: vars
run: |
./scripts/ci/env_gh.sh
- name: Download apks
run: |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk
- name: Upload to Google Play Store
run: |
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client
if [[ -n "${{ env.CI_TAG }}" ]]
then
RELEASE_MESSAGE="Find out what's new on https://github.com/opengisch/QField/releases/tag/${{ env.CI_TAG }}"
else
RELEASE_MESSAGE="Update from commit ${GITHUB_SHA}"
fi
./scripts/basic_upload_apks_service_account.py ch.opengis.${{ env.APP_PACKAGE_NAME }} beta "${RELEASE_MESSAGE}" \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk
env:
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
comment_pr:
name: comment (pr)
runs-on: ubuntu-20.04
needs: build
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Vars
id: vars
run: |
./scripts/ci/env_gh.sh
- name: π¬ Create comment
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.FAIRY_TOKEN }}
message: |
π Ta-daaa, freshly created APKs are available for ${{ github.event.pull_request.head.sha }}: [**arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk)
<details>
<summary>Other architectures</summary>
- [arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk)
- [x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk)
- [x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk)
- [**all access arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk)
- [all access arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk)
- [all access x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk)
- [all access x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk)
</details>
comment_commit:
name: comment (commit)
runs-on: ubuntu-20.04
needs: build
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Vars
id: vars
run: |
./scripts/ci/env_gh.sh
- name: Comment commit
uses: peter-evans/commit-comment@v2
with:
token: ${{ secrets.FAIRY_TOKEN }}
body: |
π Ta-daaa, freshly created APKs are available: [**arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk)
<details>
<summary>Other architectures</summary>
- [arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk)
- [x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk)
- [x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk)
- [**all access arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk)
- [all access arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk)
- [all access x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk)
- [all access x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk)
</details>