1
-
2
1
name : e2e-android
3
2
on : workflow_dispatch
4
3
5
4
jobs :
6
5
e2e-android :
7
6
runs-on : ubuntu-latest
7
+ env :
8
+ API_LEVEL : 34
9
+ ARCH : x86_64
8
10
9
11
steps :
10
12
- name : Checkout repository
11
- uses : actions/checkout@v4
13
+ uses : actions/checkout@v4
14
+
15
+ - name : Enable KVM
16
+ run : |
17
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
18
+ sudo udevadm control --reload-rules
19
+ sudo udevadm trigger --name-match=kvm
20
+
21
+ - name : Free Disk Space
22
+ uses : jlumbroso/free-disk-space@main
23
+ with :
24
+ tool-cache : false
25
+ android : false
26
+
27
+ - name : Setup Node
28
+ uses : ./.github/actions/setup-node-with-cache
29
+
30
+ - name : Install node modules
31
+ run : |
32
+ npm ci --ignore-scripts --prefer-offline --no-audit
33
+ npm run bootstrap -- --scope=mobile
34
+
35
+ - name : Setup Gradle
36
+ uses : gradle/actions/setup-gradle@v3
37
+ with :
38
+ gradle-version : wrapper
39
+ cache-read-only : false
40
+
41
+ - name : Use specific Java version for the builds
42
+ uses : joschi/setup-jdk@v2
43
+ with :
44
+ java-version : " 17"
45
+ architecture : " x64"
46
+
47
+ - name : Install Detox CLI
48
+ run : npm install detox-cli --global
49
+
50
+ - name : Detox build
51
+ run : |
52
+ yarn build:android
53
+ ls apps/mobile/native/android/app/build/outputs/apk
54
+ ls apps/mobile/native/android/app/build/outputs/apk/release
55
+
56
+ - name : Get device name
57
+ id : device
58
+ run : |
59
+ AVD_NAME=$(node -p "require('./apps/mobile/native/.detoxrc.js').devices.emulator.device.avdName")
60
+ echo "AVD_NAME=$AVD_NAME" >> $GITHUB_OUTPUT
61
+
62
+ - name : AVD cache
63
+ uses : actions/cache@v4
64
+ id : avd-cache
65
+ with :
66
+ path : |
67
+ ~/.android/avd/*
68
+ ~/.android/adb*
69
+ key : ${{ steps.device.outputs.AVD_NAME }}
70
+
71
+ - name : create AVD and generate snapshot for caching
72
+ if : steps.avd-cache.outputs.cache-hit != 'true'
73
+ uses : reactivecircus/android-emulator-runner@v2
74
+ with :
75
+ api-level : ${{ env.API_LEVEL }}
76
+ arch : ${{ env.ARCH }}
77
+ avd-name : ${{ steps.device.outputs.AVD_NAME }}
78
+ force-avd-creation : false
79
+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
80
+ disable-animations : true
81
+ script : echo "Generated AVD snapshot for caching."
82
+
83
+ - name : Detox test
84
+ uses : reactivecircus/android-emulator-runner@v2
85
+ with :
86
+ api-level : ${{ env.API_LEVEL }}
87
+ arch : ${{ env.ARCH }}
88
+ avd-name : ${{ steps.device.outputs.AVD_NAME }}
89
+ disable-animations : true
90
+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
91
+ force-avd-creation : false
92
+ script : yarn test:android --headless --record-logs failing --record-videos failing --take-screenshots failing
93
+
94
+ - name : Upload artifacts
95
+ if : failure()
96
+ uses : actions/upload-artifact@v4
97
+ with :
98
+ name : detox-artifacts
99
+ path : artifacts
100
+ retention-days : 14
0 commit comments