-
-
Notifications
You must be signed in to change notification settings - Fork 68
200 lines (179 loc) · 8.29 KB
/
Copy pathandroid.yml
File metadata and controls
200 lines (179 loc) · 8.29 KB
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
# Author:Kang Lin <kl222@126.com>
name: android
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_android.outputs.name }}
jobs:
build_android:
strategy:
matrix:
include:
- qt_arch: android_arm64_v8a
VCPKG_TARGET_TRIPLET: arm64-android
ANDROID_ABI: arm64-v8a
arch: arm64
qt_version: 6.11.1
BUILD_TYPE: Release
- qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
ANDROID_ABI: x86_64
arch: x86_64
qt_version: 6.11.1
BUILD_TYPE: Release
- qt_arch: android_arm64_v8a
VCPKG_TARGET_TRIPLET: arm64-android
ANDROID_ABI: arm64-v8a
arch: arm64
qt_version: 6.10.3
BUILD_TYPE: Release
- qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
ANDROID_ABI: x86_64
arch: x86_64
qt_version: 6.10.3
BUILD_TYPE: Release
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ubuntu-24.04
env:
VCPKGGITCOMMITID: 7213cf8135c329c37c7e2778e40774489a0583a8
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
VCPKG_DEFAULT_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
VCPKG_DEFAULT_HOST_TRIPLET: x64-linux
VCPKG_MANIFEST_FEATURES: "freerdp;vnc;wol;filetransfer;${{matrix.VCPKG_MANIFEST_FEATURES}}"
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install
artifact_name: build_android
#ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/26.3.11579264
ANDROID_PLATFORM: android-34
ANDROID_NATIVE_API_LEVEL: 34
ANDROID_ABI: ${{matrix.ANDROID_ABI}}
qt_modules: 'qtscxml qtserialport'
SerialPortAssistant_VERSION: v0.5.34-dev
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: make directory
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOLS_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{env.BUILD_DIR}}
- name: Install apt packages
run: |
#sudo apt-get update -y
#sudo apt-get upgrade -y
sudo apt install -y -q ninja-build nasm
- name: Cache installed
#if: false
uses: actions/cache@v4
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: installed-qt${{matrix.qt_version}}-${{matrix.qt_arch}}-${{matrix.VCPKG_TARGET_TRIPLET}}
- name: Install Qt of linux_gcc_64
uses: jurplel/install-qt-action@v4
with:
dir: '${{env.TOOLS_DIR}}/qt' # optional
version: '${{matrix.qt_version}}'
#host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
set-env: false
cache: true
cache-key-prefix: cached-qt_${{matrix.qt_version}}_${{matrix.qt_arch}}
- name: Install Qt of android
uses: jurplel/install-qt-action@v4
with:
# Directory to install Qt
dir: '${{env.TOOLS_DIR}}/qt' # optional
# Version of Qt to install
version: '${{matrix.qt_version}}'
# Host platform
#host: linux # optional
# Target platform for build
target: 'android' # optional, default is desktop
# Architecture for Windows/Android
arch: '${{matrix.qt_arch}}' # optional
# Additional Qt modules to install
modules: '${{env.qt_modules}}' # optional. See: https://ddalcino.github.io/aqt-list-server/
cache: true
cache-key-prefix: cached-qt_${{matrix.qt_version}}_${{matrix.qt_arch}}
- name: chmod qt-cmake
run: |
sudo chmod 777 ${QT_ROOT_DIR}/bin/qt-cmake
# 清理 resConfig
find ${QT_ROOT_DIR} -path "*/templates/build.gradle" -type f | while read file; do
echo "Fixing: $file"
sed -i 's/resConfig "en"//g' "$file"
done
- name: run vcpkg
uses: lukka/run-vcpkg@v11
with:
# Indicates whether to only setup vcpkg (i.e. installing it and setting the environment variables VCPKG_ROOT, RUNVCPK_VCPKG_ROOT), without installing any port.
#setupOnly: # optional
#vcpkgGitURL: https://github.com/KangLin/vcpkg.git
vcpkgGitCommitId: ${{env.VCPKGGITCOMMITID}}
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build SerialPortAssistant
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_ROOT: ${{env.SOURCE_DIR}}/RabbitCommon
QT_ANDROID_KEYSTORE_PATH: ${{env.SOURCE_DIR}}/RabbitCommon/RabbitCommon.keystore
QT_ANDROID_KEYSTORE_ALIAS: rabbitcommon
QT_ANDROID_KEYSTORE_STORE_PASS: ${{secrets.STOREPASS}}
run: |
sudo chmod 777 ${QT_ROOT_DIR}/bin/qt-cmake
${QT_ROOT_DIR}/bin/qt-cmake .. \
-DCMARK_SHARED=OFF \
-DCMARK_TESTS=OFF \
-DCMARK_STATIC=ON \
-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} \
-DQT_CHAINLOAD_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DVCPKG_TARGET_TRIPLET=${{env.VCPKG_TARGET_TRIPLET}} \
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON \
-DVCPKG_APPLOCAL_DEPS=ON \
-DRABBIT_ENABLE_INSTALL_QT=ON \
-DRABBIT_ENABLE_INSTALL_TO_BUILD_PATH=ON \
-DQT_HOST_PATH=${QT_ROOT_DIR}/../gcc_64 \
-DQT_ANDROID_SIGN_APK=ON \
-DQT_ENABLE_VERBOSE_DEPLOYMENT=ON \
-DQt6LinguistTools_DIR=${QT_ROOT_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \
-DCMAKE_INSTALL_PREFIX=`pwd`/install
cmake --build . --verbose --config ${{matrix.BUILD_TYPE}} --target all
APK_FILE=`find . -name "android-*.apk"`
cp $APK_FILE SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
- name: Update configure file
working-directory: ${{github.workspace}}/build
run: |
${{env.SOURCE_DIR}}/RabbitCommon/Install/GenerateJsonFile.sh \
update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json \
SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk \
android ${{matrix.ANDROID_ABI}} \
"https://github.com/KangLin/SerialPortAssistant/releases/download/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk,https://sourceforge.net/projects/SerialPortAssistant/${{env.SerialPortAssistant_VERSION}}/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk?viasf=1"
- name: update
if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}_${{matrix.qt_version}}_${{matrix.qt_arch}}
path: |
${{github.workspace}}/build/SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
${{github.workspace}}/build/update_${{matrix.qt_arch}}_${{matrix.qt_version}}.json