-
Notifications
You must be signed in to change notification settings - Fork 8
134 lines (113 loc) · 4.38 KB
/
ci-detox-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
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
name: ci-detox-android
on:
pull_request:
branches:
- master
jobs:
java-wrapper:
name: Build Java Wrapper
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./wrappers/react-native
steps:
- name: Checkout
uses: actions/checkout@83b7061638ee4956cf7545a6f7efe594e5ad0247 # pin@v3.5.1
- name: Setup rust toolchain
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # pin@v1.0.6
with:
profile: minimal
toolchain: stable
override: true
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Libraries for Android
run: yarn build:android
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Archive build artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: ci-detox-android-artifacts-libs-${{ github.sha }}
path: wrappers/react-native/android/lib
retention-days: 1
android:
name: Detox Android E2E Testing
needs: [java-wrapper]
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max-old-space-size=5120"
defaults:
run:
working-directory: wrappers/react-native
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org
- name: Download Android Libraries
uses: actions/download-artifact@v3
with:
name: ci-detox-android-artifacts-libs-${{ github.sha }}
path: wrappers/react-native/android/lib
- name: Inspect Android Libraries
run: ls -R android/lib
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Example App Install Dependencies
working-directory: wrappers/react-native/example
run: yarn install --frozen-lockfile
- name: Enable Hardware accelerated Android virtualization
# Recommended by ReactiveCircus to speed up running emulators
# https://github.com/ReactiveCircus/android-emulator-runner/blob/main/README.md#running-hardware-accelerated-emulators-on-linux-runners
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
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: Build Android Detox Example
working-directory: wrappers/react-native
run: yarn detox:build:android
- name: Start Android Emulator
uses: reactivecircus/android-emulator-runner@v2
with:
working-directory: wrappers/react-native
target: google_apis
api-level: 29
ram-size: 4096M
channel: stable
arch: x86_64
emulator-port: 5556
avd-name: Nexus_5X_API_29
force-avd-creation: true # https://github.com/ReactiveCircus/android-emulator-runner/issues/385#issuecomment-2339191348
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-boot-timeout: 12000
disable-animations: true
script: yarn detox:android:ci
- name: Archive detox failed test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: detox-artifacts-${{ github.sha }}
path: wrappers/react-native/example/detox-artifacts
retention-days: 1