Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test in github action #20

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
110 changes: 110 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Android

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
java-version: 11
cache: 'gradle'
distribution: 'temurin'

- name: Run lint
run: ./gradlew lintDebug

- name: Upload html test report
uses: actions/upload-artifact@v3
with:
name: libjxl-lint.html
path: libjxl/build/reports/lint-results-debug.html
unit-test:
needs: [lint]
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
java-version: 11
cache: 'gradle'
distribution: 'temurin'

- name: Run tests
run: ./gradlew test

- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: unit_test_report
path: libjxl/build/reports/tests/testDebugUnitTest/
instrumentation-test:
needs: [unit-test]
runs-on: macos-latest
strategy:
matrix:
api-level: [21, 33]
arch: [x86_64]
steps:
- name: Checkout the code
uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-java@v3
with:
java-version: 11
cache: 'gradle'
distribution: 'temurin'

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.arch }}-${{ matrix.api-level }}

- 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 }}
arch: ${{ matrix.arch }}
target: google_apis
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 }}
arch: ${{ matrix.arch }}
target: google_apis
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 :libjxl:connectedCheck

- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: instrumentation_test_report
path: libjxl/build/reports/androidTests/connected/