-
-
Notifications
You must be signed in to change notification settings - Fork 29
147 lines (130 loc) · 5.56 KB
/
android.yml
File metadata and controls
147 lines (130 loc) · 5.56 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
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.6.2]
include:
- BUILD_TYPE: Release
qt_arch: android_arm64_v8a
VCPKG_TARGET_TRIPLET: arm64-android
config_arch: arm64_v8a
- BUILD_TYPE: Release
qt_arch: android_x86_64
VCPKG_TARGET_TRIPLET: x64-android
config_arch: x86_64
runs-on: ubuntu-latest
env:
artifact_name: build_android
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOSL_DIR: ${{github.workspace}}/.cache/tools
INSTALL_DIR: ${{github.workspace}}/.cache/install
ChineseChessControl_VERSION: "v2.0.13"
VCPKGGITCOMMITID: 007aaced1a9d3245e28a2ba9395dca88ea890db1
ANDROID_PLATFORM: android-23
ANDROID_NATIVE_API_LEVEL: 23
qt_modules: 'qtimageformats qtmultimedia qtscxml qtwebchannel qtwebsockets qtwebview'
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: make directory
run: |
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOSL_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
cmake -E make_directory ${{github.workspace}}/build
- name: Cache installed
#if: false
uses: actions/cache@v2
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
key: install_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}
- 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: Install Qt of gcc_64
uses: jurplel/install-qt-action@v3
with:
dir: '${{env.TOOSL_DIR}}/qt' # optional
version: '${{matrix.qt_version}}'
#host: 'linux'
target: 'desktop'
arch: '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.TOOSL_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
- name: git clone RabbitCommon
working-directory: ${{env.SOURCE_DIR}}
run: |
git clone https://github.com/KangLin/RabbitCommon.git
- name: build ChineseChessControl
working-directory: ${{github.workspace}}/build
env:
RabbitCommon_DIR: ${{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_HOST_PATH=${Qt6_DIR}/../gcc_64 \
-DANDROID_PLATFORM=${{env.ANDROID_PLATFORM}} \
-DANDROID_NATIVE_API_LEVEL=${{env.ANDROID_NATIVE_API_LEVEL}} \
-DQT_ANDROID_SIGN_APK=ON \
-DQT_ENABLE_VERBOSE_DEPLOYMENT=OFF \
-DQt6LinguistTools_DIR=${Qt6_DIR}/../gcc_64/lib/cmake/Qt6LinguistTools \
-DCMAKE_INSTALL_PREFIX=`pwd`/install
cmake --build . --config ${{matrix.BUILD_TYPE}} --target all
APK_FILE=`find . -name "android-*.apk"`
cp $APK_FILE ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk
cmake --build . --config ${{matrix.BUILD_TYPE}} --target install
7z a ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip ./install/*
- name: Update artifact
#if: ${{ matrix.BUILD_TYPE == 'Release' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: |
${{github.workspace}}/build/ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.zip
${{github.workspace}}/build/ChineseChessControl_${{env.ChineseChessControl_VERSION}}_${{matrix.qt_arch}}_qt${{matrix.qt_version}}_${{matrix.BUILD_TYPE}}.apk