Skip to content

Commit f7476b0

Browse files
committed
feat: android tests
1 parent 871e08e commit f7476b0

File tree

1 file changed

+122
-52
lines changed

1 file changed

+122
-52
lines changed

.github/workflows/e2e-android.yml

Lines changed: 122 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
name: e2e-android-macmini
1+
name: e2e-android
22

3-
on: pull_request
3+
on:
4+
workflow_dispatch:
5+
pull_request:
46

57
concurrency:
68
group: ${{ github.workflow }}-${{ github.ref }}
@@ -12,89 +14,157 @@ env:
1214

1315
jobs:
1416
e2e:
15-
runs-on: self-hosted
17+
runs-on: ubuntu-latest
1618

1719
steps:
1820
- name: Checkout
19-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2022
with:
2123
fetch-depth: 1
2224

23-
- name: Reset testing enviroment
24-
continue-on-error: true
25+
- name: Free Disk Space
26+
uses: jlumbroso/free-disk-space@main
27+
with:
28+
# this might remove tools that are actually needed,
29+
# if set to "true" but frees about 6 GB
30+
tool-cache: false
31+
android: false
32+
dotnet: true
33+
haskell: true
34+
large-packages: true
35+
docker-images: true
36+
swap-storage: true
37+
38+
- name: yarn and gradle caches in /mnt
2539
run: |
26-
pkill -f react-native || echo 0
27-
pkill -f qemu || echo 0
28-
rm -rf /tmp/lock/*
29-
cd docker && docker compose down -v
30-
31-
- name: Run regtest setup
40+
rm -rf ~/.yarn
41+
rm -rf ~/.gradle
42+
sudo mkdir -p /mnt/.yarn
43+
sudo mkdir -p /mnt/.gradle
44+
sudo chown -R runner /mnt/.yarn
45+
sudo chown -R runner /mnt/.gradle
46+
ln -s /mnt/.yarn /home/runner/
47+
ln -s /mnt/.gradle /home/runner/
48+
49+
- name: Create artifacts directory on /mnt
3250
run: |
33-
cd docker
34-
mkdir lnd && chmod 777 lnd
35-
docker-compose pull --quiet
36-
docker compose up -d
51+
sudo mkdir -p /mnt/artifacts
52+
sudo chown -R runner /mnt/artifacts
3753
38-
- name: Wait for electrum server
39-
timeout-minutes: 10
40-
run: while ! nc -z '127.0.0.1' 60001; do sleep 1; done
54+
- name: Specify node version
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: 20
58+
59+
- name: Use gradle caches
60+
uses: actions/cache@v4
61+
with:
62+
path: |
63+
~/.gradle/caches
64+
~/.gradle/wrapper
65+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
66+
restore-keys: |
67+
${{ runner.os }}-gradle-
68+
69+
- name: Use yarn caches
70+
uses: actions/cache@v4
71+
with:
72+
path: ~/.yarn
73+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package-lock.json') }}
74+
restore-keys: |
75+
${{ runner.os }}-yarn-
4176
4277
- name: Activate enviroment variables
4378
run: cp .env.test.template .env
4479

4580
- name: Yarn Install
46-
run: yarn --no-audit --prefer-offline || yarn --no-audit --prefer-offline
81+
run: yarn || yarn
4782
env:
4883
HUSKY: 0
4984

5085
- name: Activate Gradle variables
51-
run: mkdir -p ~/.gradle/; cp .github/workflows/gradle.properties ~/.gradle/gradle.properties
86+
run: |
87+
cp .github/workflows/gradle.properties ~/.gradle/gradle.properties
88+
patch -p1 -i ./.github/workflows/react-native-quick-crypto.patch
89+
90+
- name: Use specific Java version for sdkmanager to work
91+
uses: actions/setup-java@v4
92+
with:
93+
distribution: 'temurin'
94+
java-version: '17'
95+
96+
- name: Enable KVM group perms
97+
run: |
98+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
99+
sudo udevadm control --reload-rules
100+
sudo udevadm trigger --name-match=kvm
52101
53102
- name: Build
54103
run: yarn e2e:build:android-release || yarn e2e:build:android-release
55104

56105
- name: Kill java processes
57106
run: pkill -9 -f java || true
58107

59-
- name: Test attempt 1
60-
continue-on-error: true
61-
id: test1
62-
run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
63-
64-
- name: Test attempt 2
65-
continue-on-error: true
66-
id: test2
67-
if: steps.test1.outcome != 'success'
68-
run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
69-
70-
- name: Test attempt 3
71-
continue-on-error: true
72-
id: test3
73-
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success'
74-
run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
75-
76-
- name: Restart docker before last attempt
77-
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success'
108+
- name: Run regtest setup
78109
run: |
79-
cd docker && docker compose down -t 60 && docker compose up --quiet-pull -d && cd ..
80-
while ! nc -z '127.0.0.1' 60001; do sleep 1; done
110+
cd docker
111+
mkdir lnd && chmod 777 lnd
112+
docker-compose pull --quiet
113+
docker compose up -d
81114
82-
- name: Test attempt 4
83-
id: test4
84-
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success'
85-
run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
115+
- name: Wait for electrum server
116+
timeout-minutes: 10
117+
run: while ! nc -z '127.0.0.1' 60001; do sleep 1; done
86118

87-
- uses: actions/upload-artifact@v3
119+
- name: Run tests
120+
uses: reactivecircus/android-emulator-runner@v2
121+
with:
122+
api-level: 31
123+
avd-name: Pixel_API_31_AOSP
124+
force-avd-creation: false
125+
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
126+
arch: x86_64
127+
script: yarn e2e:test:android-release --record-videos all --record-logs all --take-screenshots all --headless -d 200000 -R 3 --artifacts-location /mnt/artifacts
128+
129+
# - name: Test attempt 1
130+
# continue-on-error: true
131+
# id: test1
132+
# run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
133+
134+
# - name: Test attempt 2
135+
# continue-on-error: true
136+
# id: test2
137+
# if: steps.test1.outcome != 'success'
138+
# run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
139+
140+
# - name: Test attempt 3
141+
# continue-on-error: true
142+
# id: test3
143+
# if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success'
144+
# run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
145+
146+
# - name: Restart docker before last attempt
147+
# if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success'
148+
# run: |
149+
# cd docker && docker compose down -t 60 && docker compose up --quiet-pull -d && cd ..
150+
# while ! nc -z '127.0.0.1' 60001; do sleep 1; done
151+
152+
# - name: Test attempt 4
153+
# id: test4
154+
# if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' && steps.test3.outcome != 'success'
155+
# run: yarn e2e:test:android-release --record-videos all --take-screenshots all --record-logs all
156+
157+
- uses: actions/upload-artifact@v4
88158
if: failure()
89159
with:
90160
name: e2e-test-videos
91-
path: ./artifacts/
161+
path: /mnt/artifacts/
92162

93163
- name: Dump docker logs on failure
94164
if: failure()
95165
uses: jwalton/gh-docker-logs@v2
96166

97-
- name: Clean docker
98-
if: ${{ always() }}
99-
run: |
100-
cd docker && docker compose down -v
167+
# - name: Clean docker
168+
# if: ${{ always() }}
169+
# run: |
170+
# cd docker && docker compose down -v

0 commit comments

Comments
 (0)