This repository has been archived by the owner on Sep 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
106 lines (93 loc) · 3.68 KB
/
android.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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 }}