Skip to content

Commit cb4421d

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

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]
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@v4
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: Setup JDK
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: zulu
25+
java-version: 17
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v4
28+
- name: Generate debug.keystore
29+
run: |
30+
mkdir -p ${{ github.workspace }}/app/src/main/assets/keystore/
31+
keytool -genkeypair \
32+
-alias androiddebugkey \
33+
-keyalg RSA \
34+
-keysize 2048 \
35+
-validity 10000 \
36+
-keystore ${{ github.workspace }}/app/src/main/assets/keystore/debug.keystore \
37+
-storepass android \
38+
-keypass android \
39+
-dname "CN=Android Debug,O=Android,C=US"
40+
echo "Generated debug.keystore at ${{ github.workspace }}/app/src/main/assets/keystore/debug.keystore"
41+
- name: Set up Android SDK
42+
uses: android-actions/setup-android@v3
43+
- name: Run unit tests
44+
run: |
45+
./gradlew test
46+
- name: Run instrumented tests on emulator
47+
uses: reactivecircus/android-emulator-runner@v2
48+
with:
49+
api-level: 34
50+
arch: x86_64
51+
target: google_apis
52+
disable-animations: true
53+
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
54+
script: |
55+
echo "Starting logcat (live)..."
56+
adb logcat -v time &
57+
echo "Running instrumented tests..."
58+
./gradlew connectedDebugAndroidTest --no-daemon --stacktrace
59+
- name: Download logcat from emulator
60+
if: failure()
61+
run: adb logcat -d > emulator.log || true
62+
- name: Upload emulator log
63+
if: always()
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: emulator-log
67+
path: emulator.log

0 commit comments

Comments
 (0)