Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Update Web

Update Web #2949

Workflow file for this run

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 == 'workflow_dispatch' ||
github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Android'))
name: Run all tests
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [29]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- 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@v3
env:
ANDROID_NDK_TOOLCHAIN_DIR: ${{ env.ANDROID_NDK_HOME }}/toolchains
with:
build-root-directory: platforms/android
cache-read-only: false
- name: Enable KVM group perms
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: 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 }}
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
enable-hw-keyboard: true
disk-size: 3G
script: |
chmod +x scripts/ci_test.sh
scripts/ci_test.sh
- name : Upload test results
if : ${{ always() }}
uses : actions/upload-artifact@v4
with :
name : android-test-results-${{ matrix.api-level }}
path : |
./**/build/reports/tests/**
./**/build/reports/androidTests/connected/**
./**/build/reports/screenshots/**
- name: Upload unit test coverage to Codecov
uses: codecov/codecov-action@v4
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@v4
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 }}