-
-
Notifications
You must be signed in to change notification settings - Fork 68
165 lines (148 loc) · 6.87 KB
/
android.yml
File metadata and controls
165 lines (148 loc) · 6.87 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
# 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:
BUILD_TYPE: [Release]
qt_arch: [android_arm64_v8a, android_x86_64]
qt_version: [6.9.2]
include:
- qt_arch: android_arm64_v8a
VCPKG_TARGET_TRIPLET: arm64-android
ANDROID_ABI: arm64-v8a
- qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
ANDROID_ABI: x86_64
# See: https://docs.github.com/zh/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners
# See: https://github.com/actions/runner-images/
runs-on: ubuntu-24.04
env:
artifact_name: build_android
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOLS_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install
VCPKGGITCOMMITID: 4c5ae6b55f3e3e39d291679f89822f496cf190ee
VCPKG_TARGET_TRIPLET: ${{matrix.VCPKG_TARGET_TRIPLET}}
VCPKG_DEFAULT_HOST_TRIPLET: x64-linux
ANDROID_ABI: ${{matrix.ANDROID_ABI}}
ANDROID_PLATFORM: android-35
ANDROID_NATIVE_API_LEVEL: 35
qt_modules: 'qtscxml qtserialport'
SerialPortAssistant_VERSION: v0.5.33
# 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: 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 gcc_64
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOLS_DIR}}' # optional
version: '${{matrix.qt_version}}'
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
set-env: false
cache: true
cache-key-prefix: cached_qt
- name: Install Qt of android
uses: jurplel/install-qt-action@v3
with:
# Directory to install Qt
dir: '${{env.TOOLS_DIR}}' # 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/
# Whether or not to actually download Qt
cache: true
cache-key-prefix: cached_qt
- 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 ${Qt6_DIR}/bin/qt-cmake
${Qt6_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=${Qt6_DIR}/../gcc_64 \
-DQT_ANDROID_SIGN_APK=ON \
-DQT_ENABLE_VERBOSE_DEPLOYMENT=ON \
-DQt6LinguistTools_DIR=${Qt6_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