This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
Update uniffi version to 0.24.1 #1846
Workflow file for this run
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: | |
push: | |
branches: [ main, "version-*" ] | |
pull_request: | |
branches: [ "main" ] | |
types: [ labeled, synchronize, opened, reopened ] | |
workflow_dispatch: | |
# Enrich gradle.properties for CI/CD | |
env: | |
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false | |
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --no-daemon | |
ARCH: x86_64 | |
DEVICE: Nexus 5X | |
concurrency: | |
group: ${{ github.ref == 'refs/heads/main' && format('android-build-main-{0}', github.sha) || format('android-build-pr-{0}', github.ref) }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
if: | | |
github.event_name == 'push' || | |
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Android')) | |
name: Run all tests | |
runs-on: macos-12 | |
strategy: | |
matrix: | |
api-level: [31] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Rust & Cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Install Rust targets | |
run: make targets-android | |
- name: Setup Gradle & Build test cases | |
uses: gradle/gradle-build-action@v2 | |
env: | |
ANDROID_NDK_TOOLCHAIN_DIR: ${{ env.ANDROID_NDK_HOME }}/toolchains | |
with: | |
build-root-directory: platforms/android | |
arguments: | | |
:library:assembleDebugUnitTest :library:assembleDebugAndroidTest ${{ env.CI_GRADLE_ARG_PROPERTIES }} | |
cache-read-only: false | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ 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: | |
working-directory: platforms/android | |
api-level: ${{ matrix.api-level }} | |
profile: ${{ env.DEVICE }} | |
arch: ${{ env.ARCH }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
enable-hw-keyboard: true | |
script: echo "Generated AVD snapshot for caching." | |
- name: Run all tests with coverage | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
working-directory: platforms/android | |
api-level: ${{ matrix.api-level }} | |
arch: ${{ env.ARCH }} | |
profile: ${{ env.DEVICE }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
enable-hw-keyboard: true | |
script: | | |
./gradlew unitTestsWithCoverage ${{ env.CI_GRADLE_ARG_PROPERTIES }} | |
./gradlew generateUnitTestCoverageReport ${{ env.CI_GRADLE_ARG_PROPERTIES }} | |
./gradlew instrumentationTestsWithCoverage ${{ env.CI_GRADLE_ARG_PROPERTIES }} | |
./gradlew generateInstrumentationTestCoverageReport ${{ env.CI_GRADLE_ARG_PROPERTIES }} | |
- name : Upload test results | |
if : ${{ always() }} | |
uses : actions/upload-artifact@v3 | |
with : | |
name : android-test-results-${{ matrix.api-level }} | |
path : | | |
./**/build/reports/tests/** | |
./**/build/reports/androidTests/connected/** | |
- name: Upload unit test coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/reports/jacoco/generateUnitTestCoverageReport/generateUnitTestCoverageReport.xml | |
fail_ci_if_error: false | |
flags: unittests-android, unittests | |
# https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652 | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload instrumentation test coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/reports/jacoco/generateInstrumentationTestCoverageReport/generateInstrumentationTestCoverageReport.xml | |
fail_ci_if_error: false | |
flags: uitests-android, uitests | |
# https://github.com/codecov/codecov-action/issues/557#issuecomment-1216749652 | |
token: ${{ secrets.CODECOV_TOKEN }} |