~ #543
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 APKs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/wrapper-validation-action@v2 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: corretto | |
- name: Setup Gradle Cache | |
uses: gradle/gradle-build-action@v3 | |
- name: Restore Native Libs | |
id: restore-nativeLibs | |
uses: actions/cache@v4 | |
with: | |
path: | | |
nativeLibs/djvu | |
nativeLibs/mupdf | |
nativeLibs/mupdfModule/build | |
nativeLibs/mupdfModule/.cxx | |
nativeLibs/djvuModule/build | |
nativeLibs/djvuModule/.cxx | |
key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} | |
- name: Prepare thirdparty | |
run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf | |
if: steps.restore-nativeLibs.outputs.cache-hit != 'true' | |
- 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@v4 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-armeabi-v7a-debug.apk | |
path: orion-viewer/build/outputs/apk/debug/orion-viewer-*-v7a-debug.apk | |
- name: Upload arm64 APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-arm64-v8a-debug.apk | |
path: orion-viewer/build/outputs/apk/debug/orion-viewer-*-v8a-debug.apk | |
- name: Upload x86 APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-x86-debug.apk | |
path: orion-viewer/build/outputs/apk/debug/orion-viewer-*-x86-debug.apk | |
- name: Upload x86_64 APK | |
uses: actions/upload-artifact@v4 | |
with: | |
name: orion-viewer-${{steps.read_version_property.outputs.value}}-${{github.run_number}}-x86_64-debug.apk | |
path: orion-viewer/build/outputs/apk/debug/orion-viewer-*-x86_64-debug.apk | |
test: | |
strategy: | |
matrix: | |
arch: [[16, x86, ubuntu-latest], [19, x86, ubuntu-latest], [21, x86, ubuntu-latest], [24, x86, ubuntu-latest], [28, x86, ubuntu-latest], [30, x86_64, ubuntu-latest], [31, x86_64, ubuntu-latest], [32, x86_64, macos-latest], [33, x86_64, ubuntu-latest]] | |
env: | |
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL: 170 | |
EMULATOR_API: ${{ matrix.arch[0] }} | |
runs-on: ${{ matrix.arch[2] }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Enable KVM group perms | |
if: ${{ matrix.arch[2] == 'ubuntu-latest' }} | |
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: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: corretto | |
- name: Setup Gradle Cache | |
uses: gradle/gradle-build-action@v3 | |
- name: Restore Native Libs | |
id: restore-nativeLibs | |
uses: actions/cache@v4 | |
with: | |
path: | | |
nativeLibs/djvu | |
nativeLibs/mupdf | |
nativeLibs/mupdfModule/build | |
nativeLibs/mupdfModule/.cxx | |
nativeLibs/djvuModule/build | |
nativeLibs/djvuModule/.cxx | |
key: ${{ runner.os }}-native-libs-${{ hashFiles('thirdparty_build.gradle') }} | |
- name: Prepare thirdparty | |
run: bash ./gradlew -b thirdparty_build.gradle downloadAndPatchDjvu downloadAndMakeMupdf | |
if: steps.restore-nativeLibs.outputs.cache-hit != 'true' | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.arch[0] }} | |
arch: ${{ matrix.arch[1] }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
sdcard-path-or-size: 900M | |
script: ./gradlew forwardLogcat connectedDebugAndroidTest -Porion.CIBuild=true | |
- uses: dorny/test-reporter@v1 | |
with: | |
name: Test results ${{ matrix.arch[0] }} | |
path: orion-viewer/build/outputs/androidTest-results/connected/debug/TEST-*.xml | |
reporter: java-junit | |
if: always() | |
- name: Upload screenshots and logcat | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshotsAndLogcat${{ matrix.arch[0] }} | |
path: orion-viewer/build/failures/ | |
if-no-files-found: ignore | |
if: always() | |
- name: Test Summary | |
uses: test-summary/action@v2 | |
with: | |
paths: orion-viewer/build/outputs/androidTest-results/connected/debug/TEST-*.xml | |
if: always() |