Skip to content

Remove appstate

Remove appstate #3441

Workflow file for this run

name: Android
on:
push:
paths:
- 'app/**'
- 'core/**'
- 'scripts/**'
- 'cmake/**'
- 'cmake_templates/**'
- 'CMakeLists.txt'
- '.github/workflows/android.yml'
release:
types:
- published
concurrency:
group: ci-${{github.ref}}-android
cancel-in-progress: true
jobs:
android_build:
if: ( github.repository == 'MerginMaps/input' ) && (!contains(github.event.head_commit.message, 'Translate '))
runs-on: macos-12
env:
QT_VERSION: '6.4.2'
NDK_VERSION: r23
NDK_VERSION_FULL: r23b
JDK_VERSION: 11
SDK_PLATFORM: android-31
SDK_BUILD_TOOLS: 31.0.0
INPUT_SDK_VERSION: android-macOS-20230110-133
CCACHE_DIR: /Users/runner/work/ccache
GITHUB_TOKEN: ${{ secrets.INPUTAPP_BOT_GITHUB_TOKEN }}
CACHE_VERSION: 2
QT_ANDROID_KEYSTORE_ALIAS: input
QT_ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.INPUTKEYSTORE_STOREPASS }}
QT_ANDROID_KEYSTORE_STORE_PASS: ${{ secrets.INPUTKEYSTORE_STOREPASS }}
XC_VERSION: ${{ '14.2' }}
steps:
- uses: actions/checkout@v3
- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode_$XC_VERSION.app"
# CCache
- name: Prepare build cache for pull request
uses: pat-s/[email protected]
if: github.event_name == 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
key: build-android-ccache-${{ github.actor }}-${{ github.head_ref }}-${{ github.sha }}
# The head_ref or source branch of the pull request in a workflow run.
# The base_ref or target branch of the pull request in a workflow run.
restore-keys: |
build-android-ccache-${{ github.actor }}-${{ github.head_ref }}-
build-android-ccache-refs/heads/${{ github.base_ref }}-
build-android-ccache-refs/heads/master-
- name: Prepare build cache for branch/tag
# use a fork of actions/cache@v2 to upload cache even when the build or test failed
uses: pat-s/[email protected]
if: github.event_name != 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
# The branch or tag ref that triggered the workflow run. For branches this in the format refs/heads/<branch_name>, and for tags it is refs/tags/<tag_name>
key: build-android-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
build-android-ccache-${{ github.ref }}-
build-android-ccache-refs/heads/master-
- name: Install ccache
run: |
mkdir -p ${CCACHE_DIR}
brew install ccache
ccache --set-config=max_size=2.0G
ccache -s
- name: Install Build Dependencies
run: |
brew install bison flex automake shtool gtk-doc
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
brew install gnupg
brew install [email protected]
brew install ninja
pip3 install -U pip
pip3 install aqtinstall
if [[ ${{ github.ref }} == refs/tags/* ]]
then
export GIT_TAG="${GITHUB_REF//refs\/tags\//}"
export GIT_BRANCH=""
else
export GIT_TAG=""
export GIT_BRANCH="${GITHUB_REF//refs\/heads\//}"
fi
echo "GIT_TAG: $GIT_TAG"
echo "GIT_BRANCH: $GIT_BRANCH"
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
- name: Cache Qt
id: cache-qt
uses: pat-s/[email protected]
with:
path: ${{ github.workspace }}/Qt
key: ${{ runner.os }}-QtCache-v2-${{ env.QT_VERSION }}-android
- name: Install Qt
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
python3 -m aqt install-qt \
mac android ${{ env.QT_VERSION }} android_arm64_v8a \
-m qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools \
-O ${{ github.workspace }}/Qt
python3 -m aqt install-qt \
mac android ${{ env.QT_VERSION }} android_armv7 \
-m qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools \
-O ${{ github.workspace }}/Qt
python3 -m aqt install-qt \
mac desktop ${{ env.QT_VERSION }} \
-m qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools \
-O ${{ github.workspace }}/Qt
# Android SDK & NDK
- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: ${{ env.NDK_VERSION_FULL }}
add-to-path: true
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ env.JDK_VERSION }}
distribution: zulu
- name: Setup Android SDK
uses: malinskiy/action-android/install-sdk@release/0.1.4
- name: Install Android Tools
run: |
sdkmanager --licenses && sdkmanager --verbose "platforms;${SDK_PLATFORM}" "build-tools;${SDK_BUILD_TOOLS}" tools platform-tools
# Input SDK
- name: Cache Input-SDK
id: cache-input-sdk
uses: pat-s/[email protected]
with:
path: ${{ github.workspace }}/input-sdk
key: ${{ runner.os }}-input-sdk-v0-${{ env.INPUT_SDK_VERSION }}-${{ env.CACHE_VERSION }}
- name: Install Input-SDK
if: steps.cache-input-sdk.outputs.cache-hit != 'true'
run: |
wget -O \
input-sdk.tar.gz \
https://github.com/MerginMaps/input-sdk/releases/download/${{ env.INPUT_SDK_VERSION }}/input-sdk-qt-${{ env.QT_VERSION }}-${{ env.INPUT_SDK_VERSION }}.tar.gz
mkdir -p ${{ github.workspace }}/input-sdk
cd ${{ github.workspace }}/input-sdk
tar -xvzf ${{ github.workspace }}/input-sdk.tar.gz
ls ${{ github.workspace }}/input-sdk
- name: Extract Mergin API_KEY
env:
MERGINSECRETS_DECRYPT_KEY: ${{ secrets.MERGINSECRETS_DECRYPT_KEY }}
run: |
cd core/
/usr/local/opt/[email protected]/bin/openssl \
aes-256-cbc -d \
-in merginsecrets.cpp.enc \
-out merginsecrets.cpp \
-k "$MERGINSECRETS_DECRYPT_KEY" \
-md md5
- name: Extract GPS keystore
env:
INPUTKEYSTORE_DECRYPT_KEY: ${{ secrets.INPUTKEYSTORE_DECRYPT_KEY }}
run: |
/usr/local/opt/[email protected]/bin/openssl \
aes-256-cbc -d \
-in Input_keystore.keystore.enc \
-out Input_keystore.keystore \
-k $INPUTKEYSTORE_DECRYPT_KEY \
-md md5
PATH_TO_KEYSTORE=`pwd`/Input_keystore.keystore
echo "path to keystore $PATH_TO_KEYSTORE"
echo "QT_ANDROID_KEYSTORE_PATH=$PATH_TO_KEYSTORE" >> $GITHUB_ENV
# Build Input App
- name: Calculate build number
env:
OFFFSET: 10 # offset for build number - due to previous builds ~ new builds must always have a higher number
run: |
BUILD_NUM=$GITHUB_RUN_NUMBER$((GITHUB_RUN_ATTEMPT + OFFFSET))
echo "INPUT_VERSION_CODE=${BUILD_NUM}" >> $GITHUB_ENV
echo "Version code: ${BUILD_NUM}"
- name: Configure Input
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_HOST: darwin-x86_64
QT_BASE: ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}
INPUT_SDK_ANDROID_BASE: ${{ github.workspace }}/input-sdk
run: |
mkdir -p ${{ github.workspace }}/build-Input
cd ${{ github.workspace }}/build-Input
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DQT_ANDROID_ABIS="arm64-v8a;armeabi-v7a" \
-DQT_HOST_PATH=$QT_BASE/macos \
-DQT_ANDROID_SIGN_APK=Yes \
-DQT_ANDROID_SIGN_AAB=Yes \
-DCMAKE_TOOLCHAIN_FILE=$QT_BASE/android_arm64_v8a/lib/cmake/Qt6/qt.toolchain.cmake \
-GNinja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-S ../ \
-B ./
- name: build APK
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_HOST: darwin-x86_64
QT_BASE: ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}
INPUT_SDK_ANDROID_BASE: ${{ github.workspace }}/input-sdk
run: |
cd ${{ github.workspace }}/build-Input
ninja apk
echo "APKs:"
find . | grep .apk
- name: Rename APK artefacts
run: |
mv \
${{ github.workspace }}/build-Input/app/android-build/build/outputs/apk/release/android-build-release-signed.apk \
${{ github.workspace }}/merginmaps-${{ env.INPUT_VERSION_CODE }}.apk
- name: Upload APK to Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/merginmaps-${{ env.INPUT_VERSION_CODE }}.apk
name: Mergin Maps ${{ env.INPUT_VERSION_CODE }} APK [v7 + v8a]
- name: build AAB
if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }}
env:
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_HOST: darwin-x86_64
QT_BASE: ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}
INPUT_SDK_ANDROID_BASE: ${{ github.workspace }}/input-sdk
run: |
cd ${{ github.workspace }}/build-Input
ninja aab
echo "AAB:"
find . | grep .aab
- name: Rename AAB artefacts
if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }}
run: |
mv \
${{ github.workspace }}/build-Input/app/android-build/build/outputs/bundle/release/android-build-release.aab \
${{ github.workspace }}/merginmaps-${{ env.INPUT_VERSION_CODE }}.aab
- name: Upload AAB to Artifacts
if: ${{ github.ref_name == 'master' || github.ref_type == 'tag' }}
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/merginmaps-${{ env.INPUT_VERSION_CODE }}.aab
name: Mergin Maps ${{ env.INPUT_VERSION_CODE }} AAB