Correct android setup-ndk config #204
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 Build Check | |
on: | |
push: | |
branches: [ "main", "develop" ] | |
pull_request: | |
branches: [ "main", "develop" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
with: | |
ndk-version: r27 | |
add-to-path: false | |
local-cache: true | |
- run: rustup show | |
- run: ./build_android.sh | |
env: | |
ANDROID_NDK_TOOLCHAINS_PATH: ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v3 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: "temurin" | |
cache: 'gradle' | |
- name: AVD cache | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-34 | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 34 | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Prepare Gradle build | |
env: | |
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }} | |
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }} | |
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }} | |
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }} | |
SONATYPEUSERNAME: ${{ secrets.SONATYPEUSERNAME }} | |
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }} | |
run: | | |
cd ./android | |
echo ${ENCODED_KEYSTORE} | base64 -d > ./app/keystore.jks | |
echo SIGN_KEY_STORE_PATH=keystore.jks >> local.properties | |
echo SIGN_STORE_PASSWORD=${SIGN_STORE_PASSWORD} >> local.properties | |
echo SIGN_KEY_ALIAS=${SIGN_KEY_ALIAS} >> local.properties | |
echo SIGN_KEY_PASSWORD=${SIGN_KEY_PASSWORD} >> local.properties | |
echo sonatypeUsername=${SONATYPEUSERNAME} >> local.properties | |
echo sonatypePassword=${SONATYPEPASSWORD} >> local.properties | |
- name: Android test | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 34 | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: cd ./android; ./gradlew connectedAndroidTest |