Testing... #5474
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-22.04 | |
strategy: | |
fail-fast: true | |
matrix: | |
triplet: ['arm64-android', 'arm-android', 'x64-android', 'x86-android'] | |
all_files_access: ['ON', 'OFF'] | |
steps: | |
- name: Free disk space | |
run: | | |
# sudo apt-get remove -y '^ghc-.*' | |
# sudo apt-get remove -y '^dotnet-.*' | |
# sudo apt-get remove -y 'php.*' | |
- name: π£ Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: πΎ Prepare vars | |
id: vars | |
shell: bash | |
run: | | |
echo "ANDROID_NDK_VERSION=22.1.7171670" >> $GITHUB_ENV | |
echo "ANDROID_BUILD_TOOLS_VERSION=29.0.2" >> $GITHUB_ENV | |
echo "ANDROID_NDK_HOME=/usr/local/lib/android/sdk/ndk/22.1.7171670" >> $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 | |
- name: π© Install CMake and Ninja | |
uses: lukka/get-cmake@latest | |
- name: π Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: 5.14.2 | |
modules: 'qtcharts' | |
target: 'android' | |
arch: 'android' | |
cache: true | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{ matrix.triplet }} | |
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/5.7.4/sentry-android-ndk-5.7.4.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-31" "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_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 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: | | |
# Qt 5.x androiddeployqt is not compatible with r25, a bit of cheating | |
# rm ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readobj | |
# ln -s /usr/local/lib/android/sdk/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readobj ${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readobj | |
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 }}/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/upload-release-assets@v2.0 | |
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 }}/android-build/build/intermediates/merged_native_libs/release | |
deploy_to_playstore: | |
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@v3 | |
- 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-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-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: | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-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-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-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: | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Vars | |
id: vars | |
run: | | |
./scripts/ci/env_gh.sh | |
- name: Comment commit | |
uses: peter-evans/commit-comment@v2 | |
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-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-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-android](https://sos-ch-dk-2.exo.io/qfieldapks/ci-builds/qfield_all_access-${{ env.CI_PACKAGE_FILE_SUFFIX }}-arm-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> | |