-
Notifications
You must be signed in to change notification settings - Fork 9
215 lines (186 loc) · 7.61 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
name: Build android (on MacOS)
on:
push:
paths-ignore:
- '.github/workflows/ios.yml'
- '.github/workflows/linux.yml'
- '.github/workflows/mac.yml'
- '.github/workflows/win.yml'
- 'vcpkg-overlay/triplets/arm64-ios.yml'
- 'vcpkg-overlay/triplets/arm64-osx.yml'
- 'vcpkg-overlay/triplets/x64-linux.yml'
- 'vcpkg-overlay/triplets/x64-osx.yml'
- 'vcpkg-overlay/triplets/x64-windows.yml'
- 'scripts/**'
- 'LICENSE'
- 'README.md'
concurrency:
group: ci-${{github.ref}}-android
cancel-in-progress: true
jobs:
android_build:
strategy:
fail-fast: false
matrix:
include:
- TRIPLET: 'arm-android'
QT_ARCH: 'android_armv7'
ANDROID_ABI: 'armeabi-v7a'
- TRIPLET: 'arm64-android'
QT_ARCH: 'android_arm64_v8a'
ANDROID_ABI: 'arm64-v8a'
runs-on: macos-12
env: # update README for devs if you modify these env. variables
QT_VERSION: '6.6.0' # use scripts/update_qt_version.bash to change
ANDROIDAPI: 24
NDK_VERSION: '25.1.8937393'
NDK_VERSION_FULL: r25b
JDK_VERSION: 11
SDK_PLATFORM: android-33
SDK_BUILD_TOOLS: 33.0.1
XC_VERSION: ${{ '14.2' }}
VCPKG_ROOT: "${{ github.workspace }}/vcpkg"
steps:
- uses: actions/checkout@v3
with:
path: input-sdk
- name: Prepare vars
id: vars
run: |
brew install automake bison flex gnu-sed autoconf-archive libtool gettext cmake ninja
echo $(brew --prefix bison)/bin >> $GITHUB_PATH
echo $(brew --prefix flex)/bin >> $GITHUB_PATH
echo $(brew --prefix gettext)/bin >> $GITHUB_PATH
pip3 install -U pip
pip3 install aqtinstall
- name: Setup compiler
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XC_VERSION }}
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ env.NDK_VERSION_FULL }}
add-to-path: false
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ env.JDK_VERSION }}
distribution: zulu
- name: Setup Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.2
- name: Install Android Tools
run: |
sdkmanager --licenses && sdkmanager --verbose "platforms;${SDK_PLATFORM}" "build-tools;${SDK_BUILD_TOOLS}" tools platform-tools
- name: Restore cached Qt
id: cache-qt-restore
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}/Qt
key: ${{ runner.os }}-QtCache-v15-${{ env.QT_VERSION }}-${{ matrix.QT_ARCH }}
- name: Install Qt
if: steps.cache-qt-restore.outputs.cache-hit != 'true'
run: |
python3 -m aqt install-qt \
mac android ${{ env.QT_VERSION }} ${{ matrix.QT_ARCH }} \
-m qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools \
-O ${{ github.workspace }}/Qt
python3 -m aqt install-qt \
mac desktop ${{ env.QT_VERSION }} \
-m qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools \
-O ${{ github.workspace }}/Qt
- name: Save Qt cache
uses: actions/cache/save@v3
if: steps.cache-qt-restore.outputs.cache-hit != 'true'
id: cache-qt-save
with:
path: ${{ github.workspace }}/Qt
key: ${{ steps.cache-qt-restore.outputs.cache-primary-key }}
- name: Get vcpkg
shell: bash
run: |
mkdir -p "${{ env.VCPKG_ROOT }}"
cd "${{ env.VCPKG_ROOT }}"
git init
git remote add origin https://github.com/microsoft/vcpkg.git
git pull origin master
VCPKG_TAG=`cat ${{ github.workspace }}/input-sdk/VCPKG_BASELINE`
echo "using VCPKG_TAG ${VCPKG_TAG}"
git checkout ${VCPKG_TAG}
- name: Install vcpkg
run: |
echo "install vcpkg"
cd "${{ env.VCPKG_ROOT }}"
chmod +x ./bootstrap-vcpkg.sh
./bootstrap-vcpkg.sh
- name: Build Deps
run: |
export Qt6_DIR=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/${{ matrix.QT_ARCH }}
export QT_HOST_PATH=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos
export PATH=${{ env.VCPKG_ROOT }}:$PATH
export ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}
export ANDROID_NDK_ROOT=${{ steps.setup-ndk.outputs.ndk-path }}
export ANDROID_ABI=${{ matrix.ANDROID_ABI }}
vcpkg --version
mkdir -p ${{ github.workspace }}/build
cd ${{ github.workspace }}/build
cmake -B ${{ github.workspace }}/build \
-S ${{ github.workspace }}/input-sdk \
-DCMAKE_TOOLCHAIN_FILE:PATH="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${Qt6_DIR}/lib/cmake/Qt6/qt.toolchain.cmake \
-G Ninja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.TRIPLET }} \
-DVCPKG_OVERLAY_TRIPLETS:PATH="${{ github.workspace }}/input-sdk/vcpkg-overlay/triplets" \
-DVCPKG_OVERLAY_PORTS="${{ github.workspace }}/input-sdk/vcpkg-overlay/ports" \
-D ANDROID_SDK=${ANDROID_HOME} \
-DCMAKE_MAKE_PROGRAM=ninja \
-DANDROID_ARM_NEON=ON \
-DANDROID_ABI=${{ matrix.ANDROID_ABI }} \
-DQT_ANDROID_ABIS=${{ matrix.ANDROID_ABI }} \
-DANDROIDAPI=${ANDROIDAPI} \
-DANDROID_PLATFORM=android-${ANDROIDAPI} \
-DANDROID_NDK_PLATFORM=android-${ANDROIDAPI} \
-DANDROID_STL="c++_shared"
- name: Upload build logs on deps failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: build-logs-${{ matrix.TRIPLET }}
path: |
${{ env.VCPKG_ROOT }}/buildtrees/**/*.log
- name: Build Test App
run: |
cd ${{ github.workspace }}/build/${{ matrix.arch }}
cmake --build . --config Release --verbose
- name: Get TimeStamp
id: time
uses: nanzm/[email protected]
with:
timeZone: 8
format: 'YYYYMMDD'
- name: Create SDK data folder
run: |
mkdir -p ${{ github.workspace }}/sdk
cp -R ${{ github.workspace }}/build/vcpkg_installed/${{ matrix.TRIPLET }}/* ${{ github.workspace }}/sdk/
rm -rf ${{ github.workspace }}/sdk/debug
rm -rf ${{ github.workspace }}/sdk/etc
rm -rf ${{ github.workspace }}/sdk/mkspecs
rm -rf ${{ github.workspace }}/sdk/share
rm -rf ${{ github.workspace }}/sdk/tools
SDK_TAR=mergin-maps-input-sdk-qt-${{ env.QT_VERSION }}-${{ matrix.TRIPLET }}-${{ steps.time.outputs.time }}-${{ github.run_number }}.tar.gz
echo "SDK_TAR=${SDK_TAR}" >> $GITHUB_ENV
cd ${{ github.workspace }}/sdk/
tar -c -z -f ${{ github.workspace }}/${SDK_TAR} ./
- name: Upload Sdk in Artifacts
uses: actions/upload-artifact@v3
with:
name: sdk-${{ matrix.TRIPLET }}
path: ${{ github.workspace }}/${{ env.SDK_TAR }}
- name: Create Release
if: ${{ github.ref == 'refs/heads/master' }}
uses: ncipollo/release-action@v1
with:
tag: ${{ matrix.TRIPLET }}-${{ steps.time.outputs.time }}-${{ github.run_number }}
allowUpdates: true
artifacts: ${{ env.SDK_TAR }}
token: ${{ secrets.GITHUB_TOKEN }}