-
Notifications
You must be signed in to change notification settings - Fork 44
140 lines (130 loc) · 5.67 KB
/
check.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Run tests
on: [ pull_request ]
jobs:
build:
name: build
runs-on: ubuntu-latest # Needs to be macos for running AVD on Github
env:
SKIP_ICS_OPENVPN_BUILD: >
--build-cache
-x :ics-openvpn-main:configureCMakeRelWithDebInfo[arm64-v8a]
-x :ics-openvpn-main:buildCMakeRelWithDebInfo[arm64-v8a]
-x :ics-openvpn-main:configureCMakeRelWithDebInfo[armeabi-v7a]
-x :ics-openvpn-main:buildCMakeRelWithDebInfo[armeabi-v7a]
-x :ics-openvpn-main:configureCMakeRelWithDebInfo[x86]
-x :ics-openvpn-main:buildCMakeRelWithDebInfo[x86]
-x :ics-openvpn-main:configureCMakeRelWithDebInfo[x86_64]
-x :ics-openvpn-main:buildCMakeRelWithDebInfo[x86_64]
-x :ics-openvpn-main:externalNativeBuildUiOvpn23Release
-x :ics-openvpn-main:packageUiOvpn23ReleaseResources
-x :ics-openvpn-main:compileUiOvpn23ReleaseJavaWithJavac
-x :ics-openvpn-main:configureCMakeDebug[x86_64]
-x :ics-openvpn-main:buildCMakeDebug[x86_64]
-x :ics-openvpn-main:buildCMakeDebug[arm64-v8a]
-x :ics-openvpn-main:buildCMakeDebug[armeabi-v7a]
-x :ics-openvpn-main:buildCMakeDebug[x86]
strategy:
matrix:
api-level: [ 34 ]
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Cache build
uses: actions/cache@v3
with:
path: |
.gradle
app/build
key: ${{ runner.os }}-${{ matrix.api-level }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.api-level }}-build-
- name: Cache ics-openvpn build
id: cache-ics-openvpn
uses: actions/cache@v3
with:
path: |
ics-openvpn/.gradle
ics-openvpn/main/build
ics-openvpn/main/.cxx
key: ${{ runner.os }}-${{ matrix.api-level }}-ics_openvpn-${{ hashFiles('.git/modules/ics-openvpn/HEAD') }}
- if: ${{ steps.cache-ics-openvpn.outputs.cache-hit == 'true' }}
# For unknown reason, ninja always rebuilds, so force use of cache
name: Build app with ics-openvpn cache
run: |
./gradlew app:assembleBasicRelease app:assembleBasicDebugAndroidTest \
--warning-mode all $SKIP_ICS_OPENVPN_BUILD
- if: ${{ steps.cache-ics-openvpn.outputs.cache-hit != 'true' }}
name: Build app
run: |
#sudo apt-get update
#sudo apt-get -y install swig ninja-build cmake
./gradlew app:assembleBasicRelease app:assembleBasicDebugAndroidTest \
--build-cache --warning-mode all
# Setup the runner in the KVM group to enable HW Accleration for the emulator.
# see https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
shell: bash
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
# Get the AVD if it's already cached.
- name : AVD cache
uses : actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
id : restore-avd-cache
with :
path : |
~/.android/avd/*
~/.android/adb*
key : avd-${{ matrix.api-level }}
# If the AVD cache didn't exist, create an AVD
- name : create AVD and generate snapshot for caching
if : steps.restore-avd-cache.outputs.cache-hit != 'true'
uses : reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with :
api-level : ${{ matrix.api-level }}
arch : x86_64
disable-animations : false
emulator-boot-timeout : 12000
emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
force-avd-creation : false
profile : Galaxy Nexus
ram-size : 4096M
script : echo "Generated AVD snapshot."
# If we just created an AVD because there wasn't one in the cache, then cache that AVD.
- name : cache new AVD before tests
if : steps.restore-avd-cache.outputs.cache-hit != 'true'
id : save-avd-cache
uses : actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with :
path : |
~/.android/avd/*
~/.android/adb*
key : avd-${{ matrix.api-level }}
- name : Run tests
uses : reactivecircus/android-emulator-runner@6b0df4b0efb23bb0ec63d881db79aefbc976e4b2 # v2
with :
api-level : ${{ matrix.api-level }}
arch : x86_64
disable-animations : true
emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
force-avd-creation : false
profile : Galaxy Nexus
script: |
adb logcat -c
adb logcat &
./gradlew :app:connectedBasicDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=nl.eduvpn.app.service $SKIP_ICS_OPENVPN_BUILD
- name : Upload results
if : ${{ always() }}
uses : actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
with :
name : instrumentation-test-results
path : ./**/build/reports/androidTests/connected/**