Skip to content

Commit ef7d783

Browse files
committed
WIP
1 parent 3cf6e7b commit ef7d783

File tree

1 file changed

+137
-161
lines changed

1 file changed

+137
-161
lines changed

.github/workflows/e2e-self-hosted.yml

Lines changed: 137 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -21,97 +21,97 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24-
# build:
25-
# runs-on: [self-hosted, macOS]
26-
27-
# steps:
28-
# - name: Checkout
29-
# uses: actions/checkout@v4
24+
build:
25+
runs-on: [self-hosted, macOS]
3026

31-
# - name: System Information
32-
# run: |
33-
# echo "=== System Information ==="
34-
# echo "macOS Version:"
35-
# sw_vers
36-
# echo ""
37-
# echo "Xcode Version:"
38-
# xcodebuild -version
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
3930

40-
# - name: Setup iOS Simulator
41-
# run: |
42-
# # Set simulator name
43-
# SIMULATOR_NAME="iPhone 17"
44-
# echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV
31+
- name: System Information
32+
run: |
33+
echo "=== System Information ==="
34+
echo "macOS Version:"
35+
sw_vers
36+
echo ""
37+
echo "Xcode Version:"
38+
xcodebuild -version
39+
40+
- name: Setup iOS Simulator
41+
run: |
42+
# Set simulator name
43+
SIMULATOR_NAME="iPhone 17"
44+
echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV
4545
46-
# # Boot the iPhone 17 simulator if not already running
47-
# if ! xcrun simctl list devices | grep "iPhone 17" | grep -q "Booted"; then
48-
# echo "Booting $SIMULATOR_NAME..."
49-
# xcrun simctl boot "$SIMULATOR_NAME"
46+
# Boot the iPhone 17 simulator if not already running
47+
if ! xcrun simctl list devices | grep "iPhone 17" | grep -q "Booted"; then
48+
echo "Booting $SIMULATOR_NAME..."
49+
xcrun simctl boot "$SIMULATOR_NAME"
5050
51-
# # Wait 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-
# else
61-
# echo "$SIMULATOR_NAME is already booted!"
62-
# fi
51+
# Wait 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+
else
61+
echo "$SIMULATOR_NAME is already booted!"
62+
fi
6363
64-
# # Wait for simulator to be fully ready
65-
# sleep 15
64+
# Wait for simulator to be fully ready
65+
sleep 15
6666
67-
# # Launch simulator app
68-
# open -a Simulator
67+
# Launch simulator app
68+
open -a Simulator
6969
70-
# - name: Clean build environment
71-
# run: |
72-
# # Clean any existing build artifacts
73-
# rm -rf DerivedData
74-
# rm -rf ~/Library/Developer/Xcode/DerivedData
70+
- name: Clean build environment
71+
run: |
72+
# Clean any existing build artifacts
73+
rm -rf DerivedData
74+
rm -rf ~/Library/Developer/Xcode/DerivedData
7575
76-
# # Clean Swift Package Manager caches
77-
# rm -rf ~/Library/Caches/org.swift.swiftpm
78-
# rm -rf ~/Library/org.swift.swiftpm
76+
# Clean Swift Package Manager caches
77+
rm -rf ~/Library/Caches/org.swift.swiftpm
78+
rm -rf ~/Library/org.swift.swiftpm
7979
80-
# # Reset package caches
81-
# xcodebuild -resolvePackageDependencies -workspace Bitkit.xcodeproj/project.xcworkspace -scheme Bitkit
80+
# Reset package caches
81+
xcodebuild -resolvePackageDependencies -workspace Bitkit.xcodeproj/project.xcworkspace -scheme Bitkit
8282
83-
# - name: Build iOS app
84-
# env:
85-
# GITHUB_ACTOR: ${{ github.actor }}
86-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87-
# CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
88-
# E2E: true
89-
# run: |
90-
# echo "=== Building iOS app ==="
83+
- name: Build iOS app
84+
env:
85+
GITHUB_ACTOR: ${{ github.actor }}
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
88+
E2E: true
89+
run: |
90+
echo "=== Building iOS app ==="
9191
92-
# # Ensure iOS Simulator platform is available
93-
# xcodebuild -downloadPlatform iOS || echo "iOS platform already installed"
92+
# Ensure iOS Simulator platform is available
93+
xcodebuild -downloadPlatform iOS || echo "iOS platform already installed"
9494
95-
# # Build for iOS Simulator
96-
# xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
97-
# -scheme Bitkit \
98-
# -configuration Debug \
99-
# -destination "platform=iOS Simulator,name=$SIMULATOR_NAME" \
100-
# -derivedDataPath DerivedData \
101-
# -allowProvisioningUpdates \
102-
# build
103-
104-
# - name: Prepare app for E2E tests
105-
# run: |
106-
# # Copy the .app bundle to the expected location and name
107-
# mkdir -p e2e-app
108-
# cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app
95+
# Build for iOS Simulator
96+
xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
97+
-scheme Bitkit \
98+
-configuration Debug \
99+
-destination "platform=iOS Simulator,name=$SIMULATOR_NAME" \
100+
-derivedDataPath DerivedData \
101+
-allowProvisioningUpdates \
102+
build
103+
104+
- name: Prepare app for E2E tests
105+
run: |
106+
# Copy the .app bundle to the expected location and name
107+
mkdir -p e2e-app
108+
cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app
109109
110-
# - name: Upload iOS app
111-
# uses: actions/upload-artifact@v4
112-
# with:
113-
# name: bitkit-e2e-ios_${{ github.run_number }}
114-
# path: e2e-app/
110+
- name: Upload iOS app
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: bitkit-e2e-ios_${{ github.run_number }}
114+
path: e2e-app/
115115

116116
e2e-tests:
117117
runs-on: [self-hosted, macOS]
@@ -142,47 +142,31 @@ jobs:
142142
path: bitkit-e2e-tests
143143
ref: ${{ github.event.inputs.e2e_branch || 'main' }}
144144

145-
# - name: Download iOS app
146-
# uses: actions/download-artifact@v4
147-
# with:
148-
# name: bitkit-e2e-ios_${{ github.run_number }}
149-
# path: bitkit-e2e-tests/aut
150-
151-
# - name: List iOS app directory contents
152-
# run: ls -l bitkit-e2e-tests/aut
153-
154-
# - name: Setup Node.js
155-
# uses: actions/setup-node@v4
156-
# with:
157-
# node-version: 22
145+
- name: Download iOS app
146+
uses: actions/download-artifact@v4
147+
with:
148+
name: bitkit-e2e-ios_${{ github.run_number }}
149+
path: bitkit-e2e-tests/aut
158150

159-
# - name: Cache npm cache
160-
# uses: actions/cache@v3
161-
# with:
162-
# path: ~/.npm
163-
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
164-
# restore-keys: |
165-
# ${{ runner.os }}-node-
151+
- name: List iOS app directory contents
152+
run: ls -l bitkit-e2e-tests/aut
166153

167-
# - name: Install dependencies
168-
# working-directory: bitkit-e2e-tests
169-
# run: npm ci
154+
- name: Setup Node.js
155+
uses: actions/setup-node@v4
156+
with:
157+
node-version: 22
170158

171-
# - name: Install Docker
172-
# run: |
173-
# # Install Docker Desktop for Mac
174-
# brew install --cask docker
175-
# # Start Docker Desktop
176-
# open -a Docker
177-
# # Wait for Docker to be ready (with longer timeout)
178-
# echo "Waiting for Docker to start..."
179-
# timeout 120 bash -c 'until docker info >/dev/null 2>&1; do echo "Waiting for Docker..."; sleep 5; done'
180-
# echo "Docker is ready!"
159+
- name: Cache npm cache
160+
uses: actions/cache@v3
161+
with:
162+
path: ~/.npm
163+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
164+
restore-keys: |
165+
${{ runner.os }}-node-
181166
182-
# - name: Install Docker Compose
183-
# run: |
184-
# # Install docker-compose via pip (more reliable than brew on macOS runners)
185-
# python3 -m pip install docker-compose
167+
- name: Install dependencies
168+
working-directory: bitkit-e2e-tests
169+
run: npm ci
186170

187171
- name: Docker info
188172
run: |
@@ -203,21 +187,13 @@ jobs:
203187
run: |
204188
cd docker
205189
mkdir lnd && chmod 777 lnd
206-
# docker compose pull --quiet
207190
docker compose --verbose up --force-recreate -d
208191
209192
- name: Wait for electrum server
210193
working-directory: bitkit-e2e-tests
211194
timeout-minutes: 20
212195
run: while ! nc -z '127.0.0.1' 60001; do sleep 1; done
213196

214-
# - name: Run regtest setup
215-
# working-directory: bitkit-e2e-tests
216-
# run: |
217-
# cd docker
218-
# mkdir lnd && chmod 777 lnd
219-
# docker compose --verbose up -d
220-
221197
# - name: Wait for electrum server and LND
222198
# working-directory: bitkit-e2e-tests
223199
# timeout-minutes: 10
@@ -240,50 +216,50 @@ jobs:
240216
# chmod -R 755 docker/lnd
241217
# echo "LND setup complete!"
242218

243-
# - name: Setup iOS Simulator
244-
# run: |
245-
# # Boot iOS Simulator
246-
# xcrun simctl boot "iPhone 17" || true
247-
# xcrun simctl bootstatus "iPhone 17" -b
219+
- name: Setup iOS Simulator
220+
run: |
221+
# Boot iOS Simulator
222+
xcrun simctl boot "iPhone 17" || true
223+
xcrun simctl bootstatus "iPhone 17" -b
248224
249-
# # Install the app
250-
# xcrun simctl install "iPhone 17" bitkit-e2e-tests/aut/bitkit.app
225+
# Install the app
226+
xcrun simctl install "iPhone 17" bitkit-e2e-tests/aut/bitkit.app
251227
252-
# - name: Run E2E Tests (${{ matrix.shard.name }})
253-
# run: |
254-
# cd bitkit-e2e-tests
228+
- name: Run E2E Tests (${{ matrix.shard.name }})
229+
run: |
230+
cd bitkit-e2e-tests
255231
256-
# # Setup logging
257-
# LOGDIR="./artifacts"
258-
# mkdir -p "$LOGDIR"
259-
# LOGFILE="$LOGDIR/simulator.log"
232+
# Setup logging
233+
LOGDIR="./artifacts"
234+
mkdir -p "$LOGDIR"
235+
LOGFILE="$LOGDIR/simulator.log"
260236
261-
# # Start simulator logging
262-
# xcrun simctl spawn "iPhone 17" log stream --predicate 'process == "Bitkit"' --style compact > "$LOGFILE" &
263-
# LOG_PID=$!
237+
# Start simulator logging
238+
xcrun simctl spawn "iPhone 17" log stream --predicate 'process == "Bitkit"' --style compact > "$LOGFILE" &
239+
LOG_PID=$!
264240
265-
# # Setup port forwarding for regtest and LND
266-
# xcrun simctl spawn "iPhone 17" launchctl load -w /System/Library/LaunchDaemons/com.apple.usbmuxd.plist || true
241+
# Setup port forwarding for regtest and LND
242+
xcrun simctl spawn "iPhone 17" launchctl load -w /System/Library/LaunchDaemons/com.apple.usbmuxd.plist || true
267243
268-
# # Cleanup function
269-
# cleanup() {
270-
# kill "$LOG_PID" 2>/dev/null || true
271-
# wait "$LOG_PID" 2>/dev/null || true
272-
# }
273-
# trap cleanup EXIT INT TERM
244+
# Cleanup function
245+
cleanup() {
246+
kill "$LOG_PID" 2>/dev/null || true
247+
wait "$LOG_PID" 2>/dev/null || true
248+
}
249+
trap cleanup EXIT INT TERM
274250
275-
# # Pass everything through to WDIO/Mocha
276-
# npm run e2e:ios -- "$@"
277-
# env:
278-
# RECORD_VIDEO: true
251+
# Pass everything through to WDIO/Mocha
252+
npm run e2e:ios -- "$@"
253+
env:
254+
RECORD_VIDEO: true
279255

280-
# - name: Upload E2E Artifacts (${{ matrix.shard.name }})
281-
# if: failure()
282-
# uses: actions/upload-artifact@v4
283-
# with:
284-
# name: e2e-artifacts_${{ matrix.shard.name }}_${{ github.run_number }}
285-
# path: bitkit-e2e-tests/artifacts/
256+
- name: Upload E2E Artifacts (${{ matrix.shard.name }})
257+
if: failure()
258+
uses: actions/upload-artifact@v4
259+
with:
260+
name: e2e-artifacts_${{ matrix.shard.name }}_${{ github.run_number }}
261+
path: bitkit-e2e-tests/artifacts/
286262

287-
# - name: Dump docker logs on failure (${{ matrix.shard.name }})
288-
# if: failure()
289-
# uses: jwalton/gh-docker-logs@v2
263+
- name: Dump docker logs on failure (${{ matrix.shard.name }})
264+
if: failure()
265+
uses: jwalton/gh-docker-logs@v2

0 commit comments

Comments
 (0)