1+ name : e2e-tests
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 :
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+ build :
22+ runs-on : self-hosted
23+
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+
28+ # - name: Setup Xcode
29+ # uses: maxim-lobanov/setup-xcode@v1
30+ # with:
31+ # xcode-version: '16.4'
32+
33+ - name : Setup iOS Simulator
34+ run : |
35+ # Set simulator name (easy to change if needed)
36+ SIMULATOR_NAME="iPhone 16"
37+ echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV
38+
39+ # List available simulators
40+ xcrun simctl list devices available
41+
42+ # Kill any existing simulators to start fresh
43+ xcrun simctl shutdown all || true
44+ sleep 5
45+
46+ # Boot the specified simulator
47+ echo "Booting $SIMULATOR_NAME..."
48+ xcrun simctl boot "$SIMULATOR_NAME" || true
49+
50+ # Wait for simulator to boot
51+ echo "Waiting for simulator to boot..."
52+ for i in {1..30}; do
53+ if xcrun simctl list devices | grep "$SIMULATOR_NAME" | grep -q "Booted"; then
54+ echo "$SIMULATOR_NAME is booted!"
55+ break
56+ fi
57+ echo "Waiting for $SIMULATOR_NAME boot... ($i/30)"
58+ sleep 5
59+ done
60+
61+ # Additional wait for simulator to be fully ready
62+ sleep 15
63+
64+ # Install the app
65+ xcrun simctl install "$SIMULATOR_NAME" e2e-app/bitkit.app
66+
67+ # Verify app installation
68+ xcrun simctl listapps "$SIMULATOR_NAME" | grep -i bitkit || echo "App not found in simulator"
69+
70+ # Check simulator status
71+ xcrun simctl list devices | grep "$SIMULATOR_NAME"
72+
73+ # Launch simulator app to ensure it's visible
74+ open -a Simulator
75+ sleep 5
76+
77+ - name : Build iOS app
78+ env :
79+ GITHUB_ACTOR : ${{ github.actor }}
80+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81+ CHATWOOT_API : ${{ secrets.CHATWOOT_API }}
82+ E2E : true
83+ run : |
84+ xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
85+ -scheme Bitkit \
86+ -configuration Debug \
87+ -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' \
88+ -derivedDataPath DerivedData \
89+ build
90+
91+ - name : Prepare app for E2E tests
92+ run : |
93+ # Copy the .app bundle to the expected location and name
94+ mkdir -p e2e-app
95+ cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app
96+
97+ - name : Upload iOS app
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : bitkit-e2e-ios_${{ github.run_number }}
101+ path : e2e-app/
102+
103+ # e2e-tests:
104+ # runs-on: self-hosted
105+ # needs: build
106+
107+ # strategy:
108+ # fail-fast: false
109+ # matrix:
110+ # shard:
111+ # # - { name: onboarding_backup_numberpad, grep: "@onboarding|@backup|@numberpad" }
112+ # # - { name: onchain_boost_receive_widgets, grep: "@onchain|@boost|@receive|@widgets" }
113+ # # - { name: settings, grep: "@settings" }
114+ # # - { name: security, grep: "@security" }
115+ # - { name: onboarding, grep: "@onboarding" }
116+
117+ # name: e2e-tests - ${{ matrix.shard.name }}
118+
119+ # steps:
120+ # - name: Show selected E2E branch
121+ # env:
122+ # E2E_BRANCH: ${{ github.event.inputs.e2e_branch || 'main' }}
123+ # run: echo $E2E_BRANCH
124+
125+ # - name: Clone E2E tests
126+ # uses: actions/checkout@v4
127+ # with:
128+ # repository: synonymdev/bitkit-e2e-tests
129+ # path: bitkit-e2e-tests
130+ # ref: ${{ github.event.inputs.e2e_branch || 'main' }}
131+
132+ # - name: Download iOS app
133+ # uses: actions/download-artifact@v4
134+ # with:
135+ # name: bitkit-e2e-ios_${{ github.run_number }}
136+ # path: bitkit-e2e-tests/aut
137+
138+ # - name: List iOS app directory contents
139+ # run: ls -l bitkit-e2e-tests/aut
140+
141+ # - name: Setup Node.js
142+ # uses: actions/setup-node@v4
143+ # with:
144+ # node-version: 22
145+
146+ # - name: Cache npm cache
147+ # uses: actions/cache@v3
148+ # with:
149+ # path: ~/.npm
150+ # key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
151+ # restore-keys: |
152+ # ${{ runner.os }}-node-
153+
154+ # - name: Install dependencies
155+ # working-directory: bitkit-e2e-tests
156+ # run: npm ci
157+
158+ # - name: Install Docker
159+ # run: |
160+ # # Install Docker Desktop for Mac
161+ # brew install --cask docker
162+ # # Start Docker Desktop
163+ # open -a Docker
164+ # # Wait for Docker to be ready (with longer timeout)
165+ # echo "Waiting for Docker to start..."
166+ # timeout 120 bash -c 'until docker info >/dev/null 2>&1; do echo "Waiting for Docker..."; sleep 5; done'
167+ # echo "Docker is ready!"
168+
169+ # - name: Install Docker Compose
170+ # run: |
171+ # # Install docker-compose via pip (more reliable than brew on macOS runners)
172+ # python3 -m pip install docker-compose
173+
174+ # - name: Docker info
175+ # run: |
176+ # docker --version
177+ # docker info
178+ # docker ps
179+
180+ # - name: Run regtest setup
181+ # working-directory: bitkit-e2e-tests
182+ # run: |
183+ # cd docker
184+ # mkdir lnd && chmod 777 lnd
185+ # docker compose pull --quiet
186+ # docker compose up -d
187+
188+ # - name: Wait for electrum server and LND
189+ # working-directory: bitkit-e2e-tests
190+ # timeout-minutes: 10
191+ # run: |
192+ # while ! nc -z '127.0.0.1' 60001; do sleep 1; done
193+ # sudo bash -c "while [ ! -f docker/lnd/data/chain/bitcoin/regtest/admin.macaroon ]; do sleep 1; done"
194+ # sudo chmod -R 777 docker/lnd
195+
196+ # - name: Setup iOS Simulator
197+ # run: |
198+ # # Boot iOS Simulator
199+ # xcrun simctl boot "iPhone 16" || true
200+ # xcrun simctl bootstatus "iPhone 16" -b
201+
202+ # # Install the app
203+ # xcrun simctl install "iPhone 16" bitkit-e2e-tests/aut/bitkit.app
204+
205+ # - name: Run E2E Tests (${{ matrix.shard.name }})
206+ # run: |
207+ # cd bitkit-e2e-tests
208+
209+ # # Setup logging
210+ # LOGDIR="./artifacts"
211+ # mkdir -p "$LOGDIR"
212+ # LOGFILE="$LOGDIR/simulator.log"
213+
214+ # # Start simulator logging
215+ # xcrun simctl spawn "iPhone 16" log stream --predicate 'process == "Bitkit"' --style compact > "$LOGFILE" &
216+ # LOG_PID=$!
217+
218+ # # Setup port forwarding for regtest and LND
219+ # xcrun simctl spawn "iPhone 16" launchctl load -w /System/Library/LaunchDaemons/com.apple.usbmuxd.plist || true
220+
221+ # # Cleanup function
222+ # cleanup() {
223+ # kill "$LOG_PID" 2>/dev/null || true
224+ # wait "$LOG_PID" 2>/dev/null || true
225+ # }
226+ # trap cleanup EXIT INT TERM
227+
228+ # # Pass everything through to WDIO/Mocha
229+ # npm run e2e:ios -- "$@"
230+ # env:
231+ # RECORD_VIDEO: true
232+
233+ # - name: Upload E2E Artifacts (${{ matrix.shard.name }})
234+ # if: failure()
235+ # uses: actions/upload-artifact@v4
236+ # with:
237+ # name: e2e-artifacts_${{ matrix.shard.name }}_${{ github.run_number }}
238+ # path: bitkit-e2e-tests/artifacts/
239+
240+ # - name: Dump docker logs on failure (${{ matrix.shard.name }})
241+ # if: failure()
242+ # uses: jwalton/gh-docker-logs@v2
243+
0 commit comments