Work on CI builds #49
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Workflow configuration | |
#------------------------------------------------------------------------------- | |
name: "Mobile CI builds (cmake)" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
#------------------------------------------------------------------------------- | |
# Define application name & version | |
#------------------------------------------------------------------------------- | |
env: | |
APP_NAME: "QmlAppTemplate" | |
APP_VERSION: "0.6" | |
QT_VERSION: "6.6.0" | |
#------------------------------------------------------------------------------- | |
# Workflow jobs | |
#------------------------------------------------------------------------------- | |
jobs: | |
## Android build ############################################################# | |
build-android: | |
name: "Android CI build" | |
runs-on: ubuntu-20.04 | |
steps: | |
# Checkout the repository (and submodules) | |
- name: Checkout repository (and submodules) | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Java environment (already installed in 'ubuntu-20.04') | |
#- name: Install JDK environment | |
# uses: actions/setup-java@v2 | |
# with: | |
# distribution: 'zulu' | |
# java-version: '11' | |
# Android environment (already installed in 'ubuntu-20.04') | |
#- name: Setup Android SDK | |
# uses: android-actions/setup-android@v2 | |
#- name: Install Android SDK / NDK / tools | |
# run: | | |
# sdkmanager "platforms;android-33" | |
# sdkmanager "ndk;25.2.9519653" | |
# sdkmanager "build-tools;33.0.2" | |
# Install Qt (Android & desktop) | |
- name: Install Qt (Android & desktop) | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{env.QT_VERSION}} | |
host: 'linux' | |
target: 'android' | |
arch: 'android_arm64_v8a' | |
modules: qt5compat | |
aqtversion: '==3.1.*' | |
py7zrversion: '==0.20.*' | |
extra: '--autodesktop' | |
# Install dependencies (from package manager) | |
- name: Install dependencies (from package manager) | |
run: | | |
sudo apt-get install cmake ninja-build -y; | |
# Setup env | |
- name: Setup env | |
run: | | |
echo "QT_HOST_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/gcc_64" >> $GITHUB_ENV | |
echo "QT_TARGET_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/android_arm64_v8a" >> $GITHUB_ENV | |
cmake --version | |
# Build application | |
- name: Build application | |
run: | | |
export JAVA_HOME=$JAVA_HOME_17_X64 | |
qt-cmake -B build/ \ | |
-DCMAKE_SYSTEM_NAME=Android \ | |
-DCMAKE_FIND_ROOT_PATH:PATH=${{env.QT_TARGET_PATH}} \ | |
-DCMAKE_PREFIX_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_PLATFORM=android-23 \ | |
-DANDROID_ABI="arm64-v8a" \ | |
-DQT_ANDROID_BUILD_ALL_ABIS=TRUE | |
cmake --build build/ --config Release | |
## iOS build ################################################################# | |
build-ios: | |
name: "iOS CI build" | |
runs-on: macos-12 | |
steps: | |
# Checkout the repository (and submodules) | |
- name: Checkout repository (and submodules) | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
# Install Qt (iOS & desktop) | |
- name: Install Qt (iOS & desktop) | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{env.QT_VERSION}} | |
host: 'mac' | |
target: 'ios' | |
modules: qt5compat qtshadertools | |
aqtversion: '==3.1.*' | |
py7zrversion: '==0.20.*' | |
extra: '--autodesktop' | |
# Install dependencies (from package manager) | |
#- name: Install dependencies (from package manager) | |
# run: | | |
# brew install cmake | |
# Setup env | |
- name: Setup env | |
run: | | |
echo "QT_HOST_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/macos" >> $GITHUB_ENV | |
echo "QT_TARGET_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/ios" >> $GITHUB_ENV | |
cmake --version | |
# Build application | |
- name: Build application | |
run: | | |
export QT_HOST_PATH=${{env.QT_HOST_PATH}} | |
qt-cmake -B build/ -G Xcode \ | |
-DQT_HOST_PATH=${{env.QT_HOST_PATH}} \ | |
-DCMAKE_SYSTEM_NAME=iOS \ | |
-DCMAKE_FIND_ROOT_PATH:PATH=${{env.QT_TARGET_PATH}} \ | |
-DCMAKE_PREFIX_PATH=${{env.QT_TARGET_PATH}} \ | |
-DCMAKE_TOOLCHAIN_FILE=assets/ios/ios.toolchain.cmake \ | |
-DPLATFORM=OS64 | |
cmake --build build/ --config Release |