Renaming enum values p2 #793
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: | |
pull_request: null | |
workflow_dispatch: | |
inputs: | |
myCommit: | |
description: Commit SHA1 | |
required: false | |
default: '' | |
type: string | |
releaseTag: | |
description: Release tag | |
required: false | |
default: '' | |
type: string | |
workflow_call: | |
inputs: | |
myCommit: | |
description: Commit SHA1 | |
required: false | |
default: '' | |
type: string | |
releaseTag: | |
description: Release tag | |
required: false | |
default: '' | |
type: string | |
push: null | |
release: | |
types: | |
- published | |
env: | |
# This version is referenced in android/openenroth/build.gradle. | |
# See https://developer.android.com/ndk/downloads for revision-to-version mapping. | |
NDK_REVISION: r26-rc1 | |
jobs: | |
build_android: | |
name: Build Android Client | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: | |
- Debug | |
- Release | |
# Magical: https://stackoverflow.com/questions/73630573/how-to-write-conditional-expressions-in-github-actions | |
architecture: ${{ fromJson('[["universal"], ["arm64-v8a", "armeabi-v7a", "x86_64"]]')[inputs.releaseTag == ''] }} | |
steps: | |
- name: Configure fast APT mirror | |
uses: vegardit/fast-apt-mirror.sh@v1 | |
with: # the following parameters are listed with their action default values and are optional | |
healthchecks: 10 # Number of mirrors from the mirrors list to check for availability and up-to-dateness | |
speedtests: 6 # Maximum number of healthy mirrors to test for speed | |
parallel: 2 # Number of parallel speed tests | |
sample-size: 1024 # Number of kilobytes to download during the speed from each mirror | |
sample-time: 3 # Maximum number of seconds within the sample download from a mirror must finish | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
ref: '${{inputs.myCommit}}' | |
- name: Decode keystore | |
if: env.super_secret != '' | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: android_keystore.jks | |
fileDir: /home/runner/work/OpenEnroth/OpenEnroth/app/keystore/ | |
encodedString: '${{secrets.KEYSTORE}}' | |
env: | |
super_secret: '${{secrets.KEYSTORE}}' | |
- name: Get NDK | |
id: get-ndk | |
uses: nttld/setup-ndk@v1.3.1 | |
with: | |
ndk-version: '${{env.NDK_REVISION}}' | |
add-to-path: false | |
local-cache: true | |
link-to-sdk: true | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y yasm | |
if [[ "${{matrix.architecture}}" = "universal" || "${{matrix.architecture}}" = "x86" ]]; then | |
sudo dpkg --add-architecture i386 | |
fi | |
if [[ "${{matrix.architecture}}" = "universal" || "${{matrix.architecture}}" = "x86" || "${{matrix.architecture}}" = "armeabi-v7a" ]]; then | |
sudo apt-get update | |
sudo apt-get install -y gcc-13-multilib g++-13-multilib | |
fi | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17.0.6 | |
cache: gradle | |
- name: Check for ffmpeg cache | |
id: ffmpeg-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
android/openenroth/jni/FFmpeg/android/ | |
key: ffmpeg-cache | |
- name: Build ffmpeg | |
if: steps.ffmpeg-cache.outputs.cache-hit != 'true' | |
working-directory: android/openenroth/jni/FFmpeg | |
run: | | |
./build.sh | |
- name: Save ffmpeg cache | |
if: steps.ffmpeg-cache.outputs.cache-hit != 'true' | |
id: check-for-ffmpeg-save | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
android/openenroth/jni/FFmpeg/android/ | |
key: ffmpeg-cache | |
- name: Run ccache | |
uses: hendrikmuhs/ccache-action@v1.2.10 | |
with: | |
key: 'android-${{matrix.configuration}}-${{matrix.architecture}}' | |
save: ${{ github.ref == 'refs/heads/master' || inputs.releaseTag != '' }} | |
verbose: 2 | |
max-size: ${{ fromJson('["100M", "300M"]')[matrix.architecture == 'universal'] }} | |
- name: Build the app | |
working-directory: android | |
run: | | |
./gradlew "assemble${{matrix.configuration}}" -Pandroid.native.buildOutput=verbose | |
env: | |
SIGNING_KEY_ALIAS: '${{secrets.SIGNING_KEY_ALIAS}}' | |
SIGNING_KEY_PASSWORD: '${{secrets.SIGNING_KEY_PASSWORD}}' | |
SIGNING_STORE_PASSWORD: '${{secrets.SIGNING_STORE_PASSWORD}}' | |
CMAKE_BUILD_PARALLEL_LEVEL: 3 | |
GITHUBARCH: '${{matrix.architecture}}' | |
- name: Publish apk package | |
if: inputs.releaseTag != '' | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
tag_name: '${{inputs.releaseTag}}' | |
files: | | |
android/openenroth/build/outputs/apk/debug/openenroth-debug.apk | |
android/openenroth/build/outputs/apk/release/openenroth-release-unsigned.apk | |
android/openenroth/build/outputs/apk/release/openenroth-release-signed.apk | |
- name: Cleanup ccache | |
run: | | |
ccache -c |