Skip to content

Commit 1318e1d

Browse files
committed
WIP
1 parent 42f6623 commit 1318e1d

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: e2e-tests-hybrid
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
e2e_branch:
7+
description: "Branch of synonymdev/bitkit-e2e-tests to use"
8+
required: false
9+
default: "main"
10+
pull_request: # Temporarily disabled for testing
11+
12+
env:
13+
TERM: xterm-256color
14+
FORCE_COLOR: 1
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
# Job 1: Run regtest infrastructure on Ubuntu
22+
regtest-infrastructure:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
electrum-url: ${{ steps.setup-regtest.outputs.electrum-url }}
26+
lnd-url: ${{ steps.setup-regtest.outputs.lnd-url }}
27+
28+
steps:
29+
- name: Clone E2E tests
30+
uses: actions/checkout@v4
31+
with:
32+
repository: synonymdev/bitkit-e2e-tests
33+
path: bitkit-e2e-tests
34+
ref: ${{ github.event.inputs.e2e_branch || 'main' }}
35+
36+
- name: Run regtest setup
37+
working-directory: bitkit-e2e-tests
38+
id: setup-regtest
39+
run: |
40+
cd docker
41+
mkdir lnd && chmod 777 lnd
42+
docker compose pull --quiet
43+
docker compose up -d
44+
45+
# Wait for services to be ready
46+
while ! nc -z '127.0.0.1' 60001; do sleep 1; done
47+
while [ ! -f lnd/data/chain/bitcoin/regtest/admin.macaroon ]; do sleep 1; done
48+
chmod -R 777 lnd
49+
50+
# Get the runner's public IP (this will be accessible from other runners)
51+
PUBLIC_IP=$(curl -s https://api.ipify.org)
52+
echo "electrum-url=$PUBLIC_IP:60001" >> $GITHUB_OUTPUT
53+
echo "lnd-url=$PUBLIC_IP:9735" >> $GITHUB_OUTPUT
54+
echo "Regtest infrastructure ready at $PUBLIC_IP"
55+
56+
- name: Keep regtest running
57+
run: |
58+
# Keep the job running so regtest stays up
59+
while true; do
60+
echo "Regtest infrastructure running... $(date)"
61+
sleep 60
62+
done
63+
64+
# Job 2: Build iOS app and run E2E tests on macOS
65+
e2e-tests:
66+
runs-on: macos-latest
67+
needs: regtest-infrastructure
68+
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
shard:
73+
- { name: onboarding, grep: "@onboarding" }
74+
75+
name: e2e-tests - ${{ matrix.shard.name }}
76+
77+
steps:
78+
- name: Checkout
79+
uses: actions/checkout@v4
80+
81+
- name: Setup Xcode
82+
uses: maxim-lobanov/setup-xcode@v1
83+
with:
84+
xcode-version: '16.4'
85+
86+
- name: Build iOS app
87+
env:
88+
GITHUB_ACTOR: ${{ github.actor }}
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
91+
E2E: true
92+
# Override regtest URLs to point to the Ubuntu runner
93+
E2E_ELECTRUM_SERVER: ${{ needs.regtest-infrastructure.outputs.electrum-url }}
94+
E2E_LND_URL: ${{ needs.regtest-infrastructure.outputs.lnd-url }}
95+
run: |
96+
xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
97+
-scheme Bitkit \
98+
-configuration Debug \
99+
-destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
100+
-derivedDataPath DerivedData \
101+
build
102+
103+
- name: Prepare app for E2E tests
104+
run: |
105+
mkdir -p e2e-app
106+
cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app
107+
108+
- name: Clone E2E tests
109+
uses: actions/checkout@v4
110+
with:
111+
repository: synonymdev/bitkit-e2e-tests
112+
path: bitkit-e2e-tests
113+
ref: ${{ github.event.inputs.e2e_branch || 'main' }}
114+
115+
- name: Setup Node.js
116+
uses: actions/setup-node@v4
117+
with:
118+
node-version: 22
119+
120+
- name: Install dependencies
121+
working-directory: bitkit-e2e-tests
122+
run: npm ci
123+
124+
- name: Setup iOS Simulator
125+
run: |
126+
# Boot iOS Simulator
127+
xcrun simctl boot "iPhone 16" || true
128+
xcrun simctl bootstatus "iPhone 16" -b
129+
130+
# Install the app
131+
xcrun simctl install "iPhone 16" e2e-app/bitkit.app
132+
133+
- name: Run E2E Tests (${{ matrix.shard.name }})
134+
run: |
135+
cd bitkit-e2e-tests
136+
137+
# Setup logging
138+
LOGDIR="./artifacts"
139+
mkdir -p "$LOGDIR"
140+
LOGFILE="$LOGDIR/simulator.log"
141+
142+
# Start simulator logging
143+
xcrun simctl spawn "iPhone 16" log stream --predicate 'process == "Bitkit"' --style compact > "$LOGFILE" &
144+
LOG_PID=$!
145+
146+
# Cleanup function
147+
cleanup() {
148+
kill "$LOG_PID" 2>/dev/null || true
149+
wait "$LOG_PID" 2>/dev/null || true
150+
}
151+
trap cleanup EXIT INT TERM
152+
153+
# Pass everything through to WDIO/Mocha
154+
npm run e2e:ios -- "$@"
155+
env:
156+
RECORD_VIDEO: true
157+
# Use the regtest infrastructure from Ubuntu runner
158+
E2E_ELECTRUM_SERVER: ${{ needs.regtest-infrastructure.outputs.electrum-url }}
159+
E2E_LND_URL: ${{ needs.regtest-infrastructure.outputs.lnd-url }}
160+
161+
- name: Upload E2E Artifacts (${{ matrix.shard.name }})
162+
if: failure()
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: e2e-artifacts_${{ matrix.shard.name }}_${{ github.run_number }}
166+
path: bitkit-e2e-tests/artifacts/

0 commit comments

Comments
 (0)