Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Android Multi-ABI Build #11324

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 58 additions & 19 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,13 @@ jobs:
strategy:
matrix:
BuildType: [Debug, Release]
arch: [android_armv7, android_arm64_v8a]
include:
- eabi: armeabi-v7a
arch: android_armv7
ARTIFACT: QGroundControl32.apk
- eabi: arm64-v8a
arch: android_arm64_v8a
ARTIFACT: QGroundControl64.apk

defaults:
run:
shell: bash

env:
ARTIFACT: QGroundControl.apk
QT_VERSION: 6.6.3
QT_ANDROID_KEYSTORE_PATH: ${{ github.workspace }}/deploy/android/android_release.keystore
QT_ANDROID_KEYSTORE_ALIAS: QGCAndroidKeyStore
Expand Down Expand Up @@ -80,19 +73,55 @@ jobs:
target: desktop
dir: ${{ runner.temp }}
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
cache: true
cache: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}

- name: Install Qt6 for Android
- name: Install Qt6 for Android (armv7)
uses: ./install-qt-action/action/
with:
version: ${{ env.QT_VERSION }}
host: linux
target: android
arch: ${{ matrix.arch }}
arch: android_armv7
dir: ${{ runner.temp }}
extra: --autodesktop
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
cache: true
cache: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}

- name: Install Qt6 for Android (arm64_v8a)
uses: ./install-qt-action/action/
with:
version: ${{ env.QT_VERSION }}
host: linux
target: android
arch: android_arm64_v8a
dir: ${{ runner.temp }}
extra: --autodesktop
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
cache: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}

- name: Install Qt6 for Android (x86)
uses: ./install-qt-action/action/
with:
version: ${{ env.QT_VERSION }}
host: linux
target: android
arch: android_x86
dir: ${{ runner.temp }}
extra: --autodesktop
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
cache: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}

- name: Install Qt6 for Android (x86_64)
uses: ./install-qt-action/action/
with:
version: ${{ env.QT_VERSION }}
host: linux
target: android
arch: android_x86_64
dir: ${{ runner.temp }}
extra: --autodesktop
modules: qtcharts qtlocation qtpositioning qtspeech qt5compat qtmultimedia qtserialport qtimageformats qtshadertools qtconnectivity qtquick3d
cache: ${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' }}

- name: Install gstreamer
working-directory: ${{ github.workspace }}
Expand All @@ -106,20 +135,30 @@ jobs:
- name: Install dependencies
run: sudo apt-get install -y ninja-build

- name: Set Environment
- name: Setup Environment
run: |
mkdir ${{ runner.temp }}/shadow_build_dir
chmod a+x ${QT_ROOT_DIR}/bin/qt-cmake
echo "QT_HOST_PATH=${{ runner.temp }}/Qt/${{env.QT_VERSION}}/gcc_64" >> $GITHUB_ENV
echo "QT_TARGET_PATH=${{ runner.temp }}/Qt/${{env.QT_VERSION}}/android_arm64_v8a" >> $GITHUB_ENV

- name: Configure
working-directory: ${{ runner.temp }}/shadow_build_dir
run: ${QT_ROOT_DIR}/bin/qt-cmake -S ${{ github.workspace }} -B . -G Ninja
run: cmake -S ${{ github.workspace }} -B . -G Ninja
-DCMAKE_BUILD_TYPE=${{ matrix.BuildType }}
-DANDROID_ABI=${{ matrix.eabi }}
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_FIND_ROOT_PATH:PATH=${{env.QT_TARGET_PATH}}
-DCMAKE_PREFIX_PATH:PATH=${{env.QT_TARGET_PATH}}
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake
-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
-DANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
-DANDROID_ABI="arm64-v8a"
-DANDROID_PLATFORM=android-23
-DQT_HOST_PATH:PATH=${QT_ROOT_DIR}/../gcc_64
-DQT_ANDROID_ABIS="armeabi-v7a;arm64-v8a"
-DQT_ANDROID_BUILD_ALL_ABIS=OFF
-DQT_HOST_PATH:PATH=${{env.QT_HOST_PATH}}
-DQT_ANDROID_SIGN_APK=${{ github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && 'ON' || 'OFF' }}
-DQT_DEBUG_FIND_PACKAGE=ON
-DQT_ANDROID_MULTI_ABI_FORWARD_VARS=="QGC_STABLE_BUILD"
-DQGC_STABLE_BUILD=${{ github.ref_type == 'tag' || contains(github.ref, 'Stable') && 'ON' || 'OFF' }}

- name: Build
Expand All @@ -128,13 +167,13 @@ jobs:

- name: Prepare APK
working-directory: ${{ runner.temp }}/shadow_build_dir
run: cp ./android-build/*.apk ./${{ matrix.ARTIFACT }}
run: cp ./android-build/*.apk ./${{ env.ARTIFACT }}

- name: Upload Build File
uses: ./.github/actions/upload
if: matrix.BuildType == 'Release'
with:
artifact_name: ${{ matrix.ARTIFACT }}
artifact_name: ${{ env.ARTIFACT }}
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: ''
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,18 @@ elseif(ANDROID)
include(${android_openssl_SOURCE_DIR}/android_openssl.cmake)
add_android_openssl_libraries(${PROJECT_NAME})

cmake_print_variables(
QT_ANDROID_ABIS
QT_ANDROID_BUILD_ALL_ABIS
QT_PATH_ANDROID_ABI_armeabi-v7a
QT_PATH_ANDROID_ABI_arm64-v8a
QT_PATH_ANDROID_ABI_x86
QT_PATH_ANDROID_ABI_x86_64
)

set_target_properties(${PROJECT_NAME}
PROPERTIES
QT_ANDROID_ABIS ${ANDROID_ABI}
# QT_ANDROID_ABIS ${ANDROID_ABI}
QT_ANDROID_MIN_SDK_VERSION 26
QT_ANDROID_TARGET_SDK_VERSION 33
QT_ANDROID_PACKAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/android
Expand Down