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 CI | |
on: | |
push: | |
branches: | |
- master | |
- dev** | |
pull_request: | |
branches: | |
- master | |
- dev** | |
jobs: | |
build_and_upload_artifacts: | |
name: Generate APK | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: gradle/wrapper-validation-action@v1 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: corretto | |
- name: Prepare thirdparty | |
run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf | |
- name: Build debug APK | |
run: bash ./gradlew assembleDebug --stacktrace -Porion.CIBuild=true | |
- name: Read value from Properties-file | |
id: read_version_property | |
uses: christian-draeger/[email protected] | |
with: | |
path: './orion-viewer/version.properties' | |
property: 'orion.version.name' | |
- name: Upload arm7 APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-arm7-debug.apk | |
# path: orion-viewer/build/outputs/apk/arm7/debug/orion-viewer-${{steps.read_version_property.outputs.value}}-arm7-debug.apk | |
path: orion-viewer/build/outputs/apk/arm7/debug/*.apk | |
- name: Upload arm64 APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-arm64-debug.apk | |
path: orion-viewer/build/outputs/apk/arm64/debug/*.apk | |
- name: Upload x86 APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-x86-debug.apk | |
path: orion-viewer/build/outputs/apk/x86/debug/*.apk | |
- name: Upload x86_64 APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-x86_64-debug.apk | |
path: orion-viewer/build/outputs/apk/x86_64/debug/*.apk | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
api-level: [18, 25] | |
arch: [x86] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 11 | |
distribution: corretto | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }} | |
- name: Prepare thirdparty | |
run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf | |
- 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: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
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: ./gradlew connectedDebugAndroidTest -Porion.CIBuild=true |