From a27389274402a03f029d939c1150436fa87a13c8 Mon Sep 17 00:00:00 2001 From: SachinVin Date: Mon, 4 Apr 2022 23:48:33 +0530 Subject: [PATCH] Github Actions: Build android --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 8 +++++++ 2 files changed, 54 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd0f4f0ca1..08936bc35f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,52 @@ jobs: shell: bash env: ENABLE_COMPATIBILITY_REPORTING: "ON" + android: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + ~/.ccache + key: ${{ runner.os }}-android-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-android- + - name: Query tag name + uses: little-core-labs/get-git-tag@v3.0.2 + id: tagName + - name: Deps + run: | + sudo apt-get update + sudo apt-get install ccache -y + - name: Build + run: | + export NDK_CCACHE=$(which ccache) + + ccache -s + + cd src/android + chmod +x ./gradlew + ./gradlew bundleRelease + ./gradlew assembleRelease + + ccache -s + - name: Copy artifacts + run: | + mkdir artifacts/ + cp src/android/app/build/outputs/apk/release/*.apk \ + src/android/app/build/outputs/bundle/release/*.aab \ + artifacts/ + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: android + path: artifacts/ transifex: runs-on: ubuntu-latest container: citraemu/build-environments:linux-transifex diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f0bee8950..4a3cedcbdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,14 @@ if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit) DESTINATION ${PROJECT_SOURCE_DIR}/.git/hooks) endif() +# Use ccache for android if available +# ======================================================================= +if (NOT $ENV{NDK_CCACHE} EQUAL "") + set(CCACHE_EXE $ENV{NDK_CCACHE}) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE}) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE}) +endif() + # Sanity check : Check that all submodules are present # =======================================================================