Skip to content

Commit aad545d

Browse files
authored
Merge pull request #820 from synonymdev/test/multiple-addresses-types
test: split android e2e local and regtest (e2e multiple address)
2 parents ffd32ed + beb41b4 commit aad545d

1 file changed

Lines changed: 197 additions & 8 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 197 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
required: false
99
default: "default-feature-branch"
1010
pull_request:
11+
types: [ opened, synchronize, reopened, ready_for_review ]
1112

1213
env:
1314
TERM: xterm-256color
@@ -37,7 +38,7 @@ jobs:
3738
- 'gradle.properties'
3839
- '.github/workflows/e2e.yml'
3940
40-
build:
41+
build-local:
4142
needs: detect-changes
4243
if: github.event.pull_request.draft == false && needs.detect-changes.outputs.code == 'true'
4344
runs-on: ubuntu-latest
@@ -60,7 +61,7 @@ jobs:
6061
env:
6162
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
6263

63-
- name: Build debug app
64+
- name: Build debug app (local)
6465
env:
6566
GITHUB_ACTOR: ${{ github.actor }}
6667
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -74,12 +75,56 @@ jobs:
7475
apk=$(find app/build/outputs/apk/dev/debug -name 'bitkit-dev-debug-*-universal.apk')
7576
mv "$apk" app/build/outputs/apk/dev/debug/bitkit_e2e.apk
7677
77-
- name: Upload APK
78+
- name: Upload APK (local)
7879
uses: actions/upload-artifact@v4
7980
with:
8081
name: bitkit-e2e-apk_${{ github.run_number }}
8182
path: app/build/outputs/apk/dev/debug/bitkit_e2e.apk
8283

84+
build-regtest:
85+
needs: detect-changes
86+
if: github.event.pull_request.draft == false && needs.detect-changes.outputs.code == 'true'
87+
runs-on: ubuntu-latest
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Setup Java
94+
uses: actions/setup-java@v4
95+
with:
96+
java-version: "17"
97+
distribution: "adopt"
98+
99+
- name: Setup Gradle
100+
uses: gradle/actions/setup-gradle@v4
101+
102+
- name: Decode google-services.json
103+
run: echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/google-services.json
104+
env:
105+
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
106+
107+
- name: Build debug app (regtest)
108+
env:
109+
GITHUB_ACTOR: ${{ github.actor }}
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
112+
E2E: true
113+
E2E_BACKEND: network
114+
GEO: false
115+
run: ./gradlew assembleDevDebug
116+
117+
- name: Rename APK
118+
run: |
119+
apk=$(find app/build/outputs/apk/dev/debug -name 'bitkit-dev-debug-*-universal.apk')
120+
mv "$apk" app/build/outputs/apk/dev/debug/bitkit_e2e.apk
121+
122+
- name: Upload APK (regtest)
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: bitkit-e2e-apk-regtest_${{ github.run_number }}
126+
path: app/build/outputs/apk/dev/debug/bitkit_e2e.apk
127+
83128
e2e-branch:
84129
needs: detect-changes
85130
if: github.event.pull_request.draft == false && needs.detect-changes.outputs.code == 'true'
@@ -88,10 +133,10 @@ jobs:
88133
app_branch: ${{ github.head_ref || github.ref_name }}
89134
e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }}
90135

91-
e2e-tests:
136+
e2e-tests-local:
92137
if: github.event.pull_request.draft == false && needs.detect-changes.outputs.code == 'true'
93138
runs-on: ubuntu-latest
94-
needs: [detect-changes, build, e2e-branch]
139+
needs: [detect-changes, build-local, e2e-branch]
95140

96141
strategy:
97142
fail-fast: false
@@ -103,8 +148,9 @@ jobs:
103148
- { name: send, grep: "@send" }
104149
- { name: lightning_security, grep: "@lightning|@security" }
105150
- { name: lnurl_transfer, grep: "@lnurl|@transfer" }
151+
- { name: multi_address_local, grep: "@multi_address_1|@multi_address_3|@multi_address_4" }
106152

107-
name: e2e-tests - ${{ matrix.shard.name }}
153+
name: e2e-tests-local - ${{ matrix.shard.name }}
108154

109155
steps:
110156
- name: Show selected E2E branch
@@ -249,11 +295,154 @@ jobs:
249295
if: failure()
250296
uses: jwalton/gh-docker-logs@v2
251297

298+
e2e-tests-regtest:
299+
if: github.event.pull_request.draft == false && needs.detect-changes.outputs.code == 'true'
300+
runs-on: ubuntu-latest
301+
needs: [detect-changes, build-regtest, e2e-branch]
302+
303+
strategy:
304+
fail-fast: false
305+
matrix:
306+
shard:
307+
- { name: multi_address_2_regtest, grep: "@multi_address_2" }
308+
309+
name: e2e-tests-regtest - ${{ matrix.shard.name }}
310+
311+
steps:
312+
- name: Show selected E2E branch
313+
env:
314+
E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }}
315+
run: echo $E2E_BRANCH
316+
317+
- name: Clone E2E tests
318+
uses: actions/checkout@v4
319+
with:
320+
repository: synonymdev/bitkit-e2e-tests
321+
path: bitkit-e2e-tests
322+
ref: ${{ needs.e2e-branch.outputs.branch }}
323+
324+
- name: Enable KVM
325+
run: |
326+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
327+
sudo udevadm control --reload-rules
328+
sudo udevadm trigger --name-match=kvm
329+
330+
- name: AVD cache
331+
uses: actions/cache@v4
332+
id: avd-cache
333+
with:
334+
path: |
335+
~/.android/avd/*
336+
~/.android/adb*
337+
key: avd-33-x86_64-pixel_6
338+
339+
- name: Create AVD and generate snapshot for caching
340+
if: steps.avd-cache.outputs.cache-hit != 'true'
341+
uses: reactivecircus/android-emulator-runner@v2
342+
with:
343+
profile: pixel_6
344+
api-level: 33
345+
arch: x86_64
346+
avd-name: Pixel_6
347+
force-avd-creation: false
348+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none
349+
disable-animations: false
350+
script: echo "Generated AVD snapshot for caching."
351+
352+
- name: Download APK (regtest)
353+
uses: actions/download-artifact@v4
354+
with:
355+
name: bitkit-e2e-apk-regtest_${{ github.run_number }}
356+
path: bitkit-e2e-tests/aut
357+
358+
- name: List APK directory contents
359+
run: ls -l bitkit-e2e-tests/aut
360+
361+
- name: Setup Node.js
362+
uses: actions/setup-node@v4
363+
with:
364+
node-version: 22
365+
366+
- name: Cache npm cache
367+
uses: actions/cache@v3
368+
with:
369+
path: ~/.npm
370+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
371+
restore-keys: |
372+
${{ runner.os }}-node-
373+
374+
- name: Install dependencies
375+
working-directory: bitkit-e2e-tests
376+
run: npm ci
377+
378+
- name: Run E2E Tests 1 (${{ matrix.shard.name }})
379+
continue-on-error: true
380+
id: test1
381+
uses: reactivecircus/android-emulator-runner@v2
382+
with:
383+
profile: pixel_6
384+
api-level: 33
385+
arch: x86_64
386+
avd-name: Pixel_6
387+
force-avd-creation: false
388+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none
389+
script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}"
390+
env:
391+
BACKEND: regtest
392+
RECORD_VIDEO: true
393+
ATTEMPT: 1
394+
395+
- name: Run E2E Tests 2 (${{ matrix.shard.name }})
396+
continue-on-error: true
397+
id: test2
398+
if: steps.test1.outcome != 'success'
399+
uses: reactivecircus/android-emulator-runner@v2
400+
with:
401+
profile: pixel_6
402+
api-level: 33
403+
arch: x86_64
404+
avd-name: Pixel_6
405+
force-avd-creation: false
406+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none
407+
script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}"
408+
env:
409+
BACKEND: regtest
410+
RECORD_VIDEO: true
411+
ATTEMPT: 2
412+
413+
- name: Run E2E Tests 3 (${{ matrix.shard.name }})
414+
id: test3
415+
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success'
416+
uses: reactivecircus/android-emulator-runner@v2
417+
with:
418+
profile: pixel_6
419+
api-level: 33
420+
arch: x86_64
421+
avd-name: Pixel_6
422+
force-avd-creation: false
423+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none
424+
script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}"
425+
env:
426+
BACKEND: regtest
427+
RECORD_VIDEO: true
428+
ATTEMPT: 3
429+
430+
- name: Upload E2E Artifacts (${{ matrix.shard.name }})
431+
if: failure()
432+
uses: actions/upload-artifact@v4
433+
with:
434+
name: e2e-artifacts-regtest_${{ matrix.shard.name }}_${{ github.run_number }}
435+
path: bitkit-e2e-tests/artifacts/
436+
437+
- name: Dump docker logs on failure (${{ matrix.shard.name }})
438+
if: failure()
439+
uses: jwalton/gh-docker-logs@v2
440+
252441
e2e-status:
253442
if: always() && github.event.pull_request.draft == false
254443
name: e2e-status
255444
runs-on: ubuntu-latest
256-
needs: [detect-changes, e2e-tests]
445+
needs: [detect-changes, e2e-tests-local, e2e-tests-regtest]
257446
steps:
258447
- name: E2E skipped - no code changes
259448
if: needs.detect-changes.outputs.code != 'true'
@@ -262,7 +451,7 @@ jobs:
262451
- name: Verify all E2E shards succeeded
263452
if: needs.detect-changes.outputs.code == 'true'
264453
run: |
265-
if [ "${{ needs.e2e-tests.result }}" != "success" ]; then
454+
if [ "${{ needs.e2e-tests-local.result }}" != "success" ] || [ "${{ needs.e2e-tests-regtest.result }}" != "success" ]; then
266455
echo "❌ Some E2E shards failed."
267456
exit 1
268457
fi

0 commit comments

Comments
 (0)