Skip to content

Commit 2d1190e

Browse files
committed
MOPPAND-1704 Setup Github actions for Android and unit tests and App assemble.
1 parent ac9fbab commit 2d1190e

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/build.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: RIA DigiDoc Android
2+
on: [push, pull_request]
3+
env:
4+
BUILD_NUMBER: ${{ github.run_number }}
5+
jobs:
6+
ubuntu:
7+
name: Build on Ubuntu
8+
if: contains(github.repository, 'open-eid/RIA-DigiDoc-Android')
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v5
13+
with:
14+
submodules: recursive
15+
- name: Setup environment
16+
env:
17+
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
18+
run: |
19+
cd ${{ github.workspace }}/app
20+
echo -n "$GOOGLE_SERVICES_JSON" | base64 --decode > "google-services.json"
21+
- name: Enable KVM to run instrumented tests
22+
run: |
23+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
24+
sudo udevadm control --reload-rules
25+
sudo udevadm trigger --name-match=kvm
26+
- name: Setup JDK
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: zulu
30+
java-version: 21
31+
- name: Setup Gradle
32+
uses: gradle/actions/setup-gradle@v4
33+
- name: Generate debug.keystore
34+
run: |
35+
mkdir -p ${{ github.workspace }}/app/src/main/assets/keystore/
36+
keytool -genkeypair \
37+
-alias androiddebugkey \
38+
-keyalg RSA \
39+
-keysize 2048 \
40+
-validity 10000 \
41+
-keystore ${{ github.workspace }}/app/src/main/assets/keystore/debug.keystore \
42+
-storepass android \
43+
-keypass android \
44+
-dname "CN=Android Debug,O=Android,C=US"
45+
echo "Generated debug.keystore at ${{ github.workspace }}/app/src/main/assets/keystore/debug.keystore"
46+
- name: Set up Android SDK
47+
uses: android-actions/setup-android@v3
48+
- name: Run fetch default configuration
49+
run: |
50+
./gradlew fetchAndPackageDefaultConfiguration
51+
- name: Run unit tests
52+
run: |
53+
./gradlew test
54+
- name: Run instrumented tests on emulator
55+
uses: reactivecircus/android-emulator-runner@v2
56+
with:
57+
api-level: 33
58+
arch: x86_64
59+
target: google_apis
60+
disable-animations: true
61+
emulator-boot-timeout: 900
62+
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
63+
profile: pixel_7_pro
64+
ram-size: 4096M
65+
heap-size: 512M
66+
disk-size: 2048M
67+
script: ./gradlew connectedCheck -Dorg.gradle.jvmargs="-Xmx4g"

0 commit comments

Comments
 (0)