Use fastlane for more ci stability #6078
Workflow file for this run
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
--- | |
name: π± Android | |
on: | |
push: | |
branches: | |
- master | |
- release-** | |
pull_request: | |
release: | |
types: ['published'] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- triplet: 'arm64-android' | |
qt_arch: 'android_arm64_v8a' | |
all_files_access: 'OFF' | |
- triplet: 'arm64-android' | |
qt_arch: 'android_arm64_v8a' | |
all_files_access: 'ON' | |
- triplet: 'arm-neon-android' | |
qt_arch: 'android_armv7' | |
all_files_access: 'OFF' | |
- triplet: 'arm-neon-android' | |
qt_arch: 'android_armv7' | |
all_files_access: 'ON' | |
- triplet: 'x64-android' | |
qt_arch: 'android_x86_64' | |
all_files_access: 'OFF' | |
- triplet: 'x64-android' | |
qt_arch: 'android_x86_64' | |
all_files_access: 'ON' | |
- triplet: 'x86-android' | |
qt_arch: 'android_x86' | |
all_files_access: 'OFF' | |
- triplet: 'x86-android' | |
qt_arch: 'android_x86' | |
all_files_access: 'ON' | |
steps: | |
- name: π£ Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: πΎ Prepare variables | |
id: vars | |
shell: bash | |
run: | | |
echo "ANDROID_NDK_VERSION=23.1.7779620" >> $GITHUB_ENV | |
echo "ANDROID_BUILD_TOOLS_VERSION=30.0.3" >> $GITHUB_ENV | |
echo "ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/23.1.7779620" >> $GITHUB_ENV | |
echo "ndk.dir=$ANDROID_NDK_HOME" >> local.properties | |
ALL_FILES_ACCESS=${{ matrix.all_files_access }} ./scripts/ci/env_gh.sh | |
BUILD_ROOT="/home/runner" | |
echo "BUILD_ROOT=${BUILD_ROOT}" >> $GITHUB_ENV | |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV | |
echo "CMAKE_BUILD_DIR=${BUILD_ROOT}/builddir" >> $GITHUB_ENV | |
echo "INSTALL_QT_VERSION=6.6.0" >> $GITHUB_ENV | |
- name: π© Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: π Install Qt (Android) | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.INSTALL_QT_VERSION }} | |
modules: 'qt5compat qtcharts qtpositioning qtserialport qtconnectivity qtimageformats qtmultimedia qtwebview qtsensors' | |
target: android | |
arch: ${{ matrix.qt_arch }} | |
cache: false | |
- name: π Install Qt (Desktop) | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ env.INSTALL_QT_VERSION }} | |
modules: 'qt5compat qtcharts qtpositioning qtserialport qtconnectivity qtimageformats qtmultimedia qtwebview qtsensors' | |
target: desktop | |
cache: false | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{ matrix.triplet }}-qt6 | |
max-size: 200M | |
# The sentry-android dependency is added via gradle | |
# This downloads the pre-compiled sentry-android-ndk libraries | |
# But we are compiling this before gradle is executed, so it is not downloaded | |
# Therefore we download it manually to get include headers and libraries | |
# ... a better implementation of this much appreciated ... | |
- name: Download sentry libs | |
run: | | |
mkdir /tmp/sentry-android-ndk | |
wget https://repo1.maven.org/maven2/io/sentry/sentry-android-ndk/6.13.1/sentry-android-ndk-6.13.1.aar -O /tmp/sentry.zip | |
unzip /tmp/sentry.zip -d /tmp/sentry-android-ndk | |
- name: π± Update ndk | |
run: | | |
echo "ndk.dir=$ANDROID_NDK_HOME" >> local.properties | |
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --uninstall "ndk-bundle" | |
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager "platforms;android-33" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" "ndk;$ANDROID_NDK_VERSION" tools platform-tools | |
echo "yes" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --licenses | |
- name: π± Install dependencies and generate project files | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
run: | | |
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} source ./scripts/version_number.sh | |
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} source ./scripts/ci/generate-version-details.sh | |
cmake -S "${{ github.workspace }}" \ | |
-B "${CMAKE_BUILD_DIR}" \ | |
-G Ninja \ | |
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-D SYSTEM_QT=ON \ | |
-D ANDROID_SDK=/usr/local/lib/android/sdk/ \ | |
-D ANDROID_SDK_ROOT=/usr/local/lib/android/sdk/ \ | |
-D ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION}" \ | |
-D ANDROID_BUILD_TOOLS_VERSION="${ANDROID_BUILD_TOOLS_VERSION}" \ | |
-D VCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" \ | |
-D WITH_ALL_FILES_ACCESS="${{ matrix.all_files_access }}" \ | |
-D WITH_SPIX=OFF \ | |
-D CMAKE_PREFIX_PATH=${Qt6_DIR} \ | |
-D QT_HOST_PATH=/home/runner/work/QField/Qt/${{ env.INSTALL_QT_VERSION }}/gcc_64 \ | |
-D QT_HOST_PATH_CMAKE_DIR:PATH=/home/runner/work/QField/Qt/${{ env.INSTALL_QT_VERSION }}/gcc_64 \ | |
-D APP_VERSION="${APP_VERSION}" \ | |
-D APK_VERSION_CODE="${APK_VERSION_CODE}" \ | |
-D APP_VERSION_STR="${APP_VERSION_STR}" \ | |
-D APP_PACKAGE_NAME="${APP_PACKAGE_NAME}" \ | |
-D APP_ICON="${APP_ICON}" \ | |
-D APP_NAME="${APP_NAME}" \ | |
-D NUGET_USERNAME=opengisch \ | |
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \ | |
-D SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ | |
-D SENTRY_ENV="${APP_ENV}" \ | |
-D SENTRY_IMPORT_PREFIX=/tmp/sentry-android-ndk/jni | |
- name: π Upload Dep Build Logs | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: build-logs-${{ matrix.triplet }} | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/**/*.log | |
- name: π Build | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config ${{ env.BUILD_TYPE }} | |
- name: Setup signing key | |
env: | |
SIGNINGKEY: ${{ secrets.PLAYSTORE_SIGNINGKEY }} | |
run: | | |
echo "$SIGNINGKEY" | base64 --decode > ./keystore.p12 | |
- name: Cache .gradle | |
uses: burrunan/gradle-cache-action@v1 | |
- name: Package | |
env: | |
KEYNAME: qfield | |
KEYPASS: ${{ secrets.KEYPASS }} | |
STOREPASS: ${{ secrets.STOREPASS }} | |
run: | | |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target bundle --config Release | |
- name: π¦ Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.APP_PACKAGE_NAME }}-android-${{ matrix.triplet }} | |
path: | | |
${{ env.CMAKE_BUILD_DIR }}/src/app/android-build/build/outputs/apk/release/android-build-release-signed.apk | |
- name: πΊ Deploy | |
run: | | |
sudo apt install -y s3cmd | |
TRIPLET=${{ matrix.triplet }} ALL_FILES_ACCESS=${{ matrix.all_files_access }} ./scripts/ci/upload_artifacts.sh | |
env: | |
S3CFG: ${{ secrets.S3CFG }} | |
- name: Upload release assets | |
uses: AButler/[email protected] | |
if: ${{ github.event_name == 'release' && matrix.all_files_access == 'OFF' }} | |
with: | |
files: /tmp/qfield-*.apk | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ env.CI_TAG }} | |
- name: Upload debug symbols | |
# if: release or labeled PR | |
if: ${{ matrix.all_files_access == 'OFF' }} | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
run: | | |
curl -sL https://sentry.io/get-cli/ | bash | |
sentry-cli upload-dif -o opengisch -p qfield ${{ env.CMAKE_BUILD_DIR }}/src/app/android-build/build/intermediates/merged_native_libs/release | |
deploy_to_playstore: | |
name: deploy to play store | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ github.event_name == 'release' || ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Vars | |
id: vars | |
run: | | |
./scripts/ci/env_gh.sh | |
- name: Download apks | |
run: | | |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk | |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk | |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk | |
wget https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk | |
- name: Upload to Google Play Store | |
run: | | |
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib oauth2client | |
if [[ -n "${{ env.CI_TAG }}" ]] | |
then | |
RELEASE_MESSAGE="Find out what's new on https://github.com/opengisch/QField/releases/tag/${{ env.CI_TAG }}" | |
else | |
RELEASE_MESSAGE="Update from commit ${GITHUB_SHA}" | |
fi | |
./scripts/basic_upload_apks_service_account.py ch.opengis.${{ env.APP_PACKAGE_NAME }} beta "${RELEASE_MESSAGE}" \ | |
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk \ | |
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk \ | |
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk \ | |
qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk | |
env: | |
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} | |
comment_pr: | |
name: comment (pr) | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Vars | |
id: vars | |
run: | | |
./scripts/ci/env_gh.sh | |
- name: π¬ Create comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.FAIRY_TOKEN }} | |
message: | | |
π Ta-daaa, freshly created APKs are available for ${{ github.event.pull_request.head.sha }}: [**arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk) | |
<details> | |
<summary>Other architectures</summary> | |
- [arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk) | |
- [x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk) | |
- [x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk) | |
- [**all access arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk) | |
- [all access arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk) | |
- [all access x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk) | |
- [all access x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk) | |
</details> | |
comment_commit: | |
name: comment (commit) | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Vars | |
id: vars | |
run: | | |
./scripts/ci/env_gh.sh | |
- name: Comment commit | |
uses: peter-evans/commit-comment@v3 | |
with: | |
token: ${{ secrets.FAIRY_TOKEN }} | |
body: | | |
π Ta-daaa, freshly created APKs are available: [**arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk) | |
<details> | |
<summary>Other architectures</summary> | |
- [arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk) | |
- [x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk) | |
- [x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk) | |
- [**all access arm64-android**](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm64-android.apk) | |
- [all access arm-neon-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-neon-android.apk) | |
- [all access x64-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x64-android.apk) | |
- [all access x86-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-x86-android.apk) | |
</details> | |