-
-
Notifications
You must be signed in to change notification settings - Fork 226
338 lines (296 loc) ยท 14.4 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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
---
name: ๐ฑ Android
on:
push:
branches:
- master
- release-**
pull_request:
release:
types: ['published']
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
include:
- triplet: 'arm64-android'
qt_arch: 'android_arm64_v8a'
all_files_access: 'OFF'
artifact_name: 'android-arm64'
- triplet: 'arm64-android'
qt_arch: 'android_arm64_v8a'
all_files_access: 'ON'
artifact_name: 'android-arm64'
- triplet: 'arm-neon-android'
qt_arch: 'android_armv7'
all_files_access: 'OFF'
artifact_name: 'android-arm-neon'
- triplet: 'arm-neon-android'
qt_arch: 'android_armv7'
all_files_access: 'ON'
artifact_name: 'android-arm-neon'
- triplet: 'x64-android'
qt_arch: 'android_x86_64'
all_files_access: 'OFF'
artifact_name: 'android-x64'
- triplet: 'x64-android'
qt_arch: 'android_x86_64'
all_files_access: 'ON'
artifact_name: 'android-x64'
- triplet: 'x86-android'
qt_arch: 'android_x86'
all_files_access: 'OFF'
artifact_name: 'android-x86'
- triplet: 'x86-android'
qt_arch: 'android_x86'
all_files_access: 'ON'
artifact_name: 'android-x86'
steps:
- name: ๐ฃ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: โป๏ธ Check disk space
run: df . -h
- name: ๐งน Reclaim disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: โป๏ธ Check disk space
run: df . -h
- name: ๐พ Prepare variables
id: vars
shell: bash
run: |
NDK_VERSION=26.3.11579264
echo "JAVA_HOME=${JAVA_HOME_17_X64}" >> $GITHUB_ENV
echo "ANDROID_BUILD_TOOLS_VERSION=34.0.0" >> $GITHUB_ENV
echo "ANDROID_NDK_VERSION=${NDK_VERSION}" >> $GITHUB_ENV
echo "ANDROID_NDK=/usr/local/lib/android/sdk/ndk/${NDK_VERSION}" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/${NDK_VERSION}" >> $GITHUB_ENV
echo "ANDROID_NDK_ROOT=/usr/local/lib/android/sdk/ndk/${NDK_VERSION}" >> $GITHUB_ENV
echo "ndk.dir=/usr/local/lib/android/sdk/ndk/${NDK_VERSION}" >> 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: ๐ Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: ๐ฉ Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.29.0
- name: ๐จ Prepare build env
run: |
sudo apt-get update
sudo apt-get install -y gperf autopoint '^libxcb.*-dev' libx11-xcb-dev libegl1-mesa libegl1-mesa-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf-archive libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libfuse2 libcups2-dev nasm
- 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/7.14.0/sentry-android-ndk-7.14.0.aar -O /tmp/sentry.zip
unzip /tmp/sentry.zip -d /tmp/sentry-android-ndk
- 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 ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT} \
-D ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION}" \
-D ANDROID_BUILD_TOOLS_VERSION="${ANDROID_BUILD_TOOLS_VERSION}" \
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \
-D VCPKG_INSTALL_OPTIONS="--allow-unsupported" \
-D WITH_ALL_FILES_ACCESS="${{ matrix.all_files_access }}" \
-D WITH_SPIX=OFF \
-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@v4
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@v2
- 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@v4
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
${{ env.CMAKE_BUILD_DIR }}/src/app/android-build/build/outputs/apk/debug/android-build-debug.apk
- name: ๐บ Deploy
run: |
sudo apt install -y s3cmd
# This script will rename the artifact and move it to /tmp
NAME=${{ matrix.artifact_name }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} ./scripts/ci/upload_artifacts.sh
env:
S3CFG: ${{ secrets.S3CMD_CFG }}
- name: Upload release assets
uses: AButler/upload-release-assets@v3.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 != '' }}
env:
SENTRY_ORG_SLUG: opengisch
SENTRY_PROJECT_SLUG: qfield
run: |
bundle exec fastlane run sentry_debug_files_upload path:${{ env.CMAKE_BUILD_DIR }}/src/app/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@v4
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
- name: Vars
id: vars
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
run: |
./scripts/ci/env_gh.sh
- name: Download apks
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
run: |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.apk
- name: Upload to Google Play Store
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
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 }}-android-arm64.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk \
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.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@v4
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
- name: Vars
id: vars
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
run: |
./scripts/ci/env_gh.sh
- name: ๐ฌ Create comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
with:
GITHUB_TOKEN: ${{ secrets.FAIRY_TOKEN }}
message: |
๐ Ta-daaa, freshly created APKs are available for ${{ github.event.pull_request.head.sha }}: [**arm64-android**](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk)
<details>
<summary>Other architectures</summary>
- [arm-neon-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk)
- [x64-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk)
- [x86-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.apk)
- [**all access arm64-android**](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk)
- [all access arm-neon-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk)
- [all access x64-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk)
- [all access x86-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.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@v4
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
- name: Vars
id: vars
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
run: |
./scripts/ci/env_gh.sh
- name: Comment commit
uses: peter-evans/commit-comment@v3
if: ${{ env.SENTRY_AUTH_TOKEN != '' }}
with:
token: ${{ secrets.FAIRY_TOKEN }}
body: |
๐ Ta-daaa, freshly created APKs are available: [**arm64-android**](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk)
<details>
<summary>Other architectures</summary>
- [arm-neon-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk)
- [x64-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk)
- [x86-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.apk)
- [**all access arm64-android**](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm64.apk)
- [all access arm-neon-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-arm-neon.apk)
- [all access x64-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x64.apk)
- [all access x86-android](https://qfieldapks.sos-ch-dk-2.exoscale-cdn.com/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-android-x86.apk)
</details>