Skip to content

Commit 9bf0aa7

Browse files
committed
WIP
1 parent 033b1de commit 9bf0aa7

File tree

9 files changed

+1678
-11
lines changed

9 files changed

+1678
-11
lines changed

.github/workflows/debug-docker.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Debug Docker Setup
2+
3+
# on:
4+
# workflow_dispatch:
5+
# pull_request:
6+
7+
jobs:
8+
debug-docker:
9+
runs-on: macos-13
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Check system info
16+
run: |
17+
echo "=== System Information ==="
18+
uname -a
19+
sw_vers
20+
echo "=== Available commands ==="
21+
which brew
22+
which python3
23+
which docker || echo "Docker not found"
24+
25+
- name: Install Docker CLI only
26+
run: |
27+
echo "=== Installing Docker CLI (no GUI) ==="
28+
# Install just the Docker CLI, not the full Desktop app
29+
brew install docker
30+
echo "Docker CLI installed"
31+
32+
- name: Set up Docker
33+
uses: docker/setup-docker-action@v4
34+
id: docker-official
35+
continue-on-error: true
36+
with:
37+
install: false # We already installed it
38+
daemon-config: |
39+
{
40+
"experimental": false,
41+
"debug": true,
42+
"log-driver": "json-file",
43+
"log-opts": {
44+
"max-size": "10m",
45+
"max-file": "3"
46+
}
47+
}
48+
49+
# - name: Setup Docker Colima (Fallback)
50+
# uses: douglascamata/setup-docker-macos-action@v1-alpha
51+
# id: docker-colima
52+
# continue-on-error: true
53+
54+
- name: Check Docker setup results
55+
run: |
56+
echo "=== Docker Setup Results ==="
57+
echo "Official Docker action result: ${{ steps.docker-official.outcome }}"
58+
# echo "Colima action result: ${{ steps.docker-colima.outcome }}"
59+
60+
- name: Wait for Docker to start
61+
run: |
62+
echo "=== Waiting for Docker to start ==="
63+
# Use a for loop instead of timeout (macOS doesn't have timeout command)
64+
for i in {1..18}; do
65+
if docker info >/dev/null 2>&1; then
66+
echo "Docker is ready!"
67+
break
68+
fi
69+
echo "Waiting for Docker... ($(date)) (attempt $i/18)"
70+
sleep 10
71+
done
72+
73+
# Final check
74+
if ! docker info >/dev/null 2>&1; then
75+
echo "Docker failed to start after 3 minutes"
76+
exit 1
77+
fi
78+
79+
- name: Test Docker functionality
80+
run: |
81+
echo "=== Testing Docker ==="
82+
docker --version
83+
docker info
84+
docker ps
85+
echo "=== Testing Docker Compose V2 ==="
86+
docker compose version || echo "docker compose not found"
87+
88+
- name: Install Docker Compose V2
89+
run: |
90+
echo "=== Installing Docker Compose V2 ==="
91+
# Install Docker Compose V2 plugin via Homebrew
92+
brew install docker-compose
93+
echo "Docker Compose V2 installed"
94+
docker compose version
95+
96+
- name: Test simple Docker command
97+
run: |
98+
echo "=== Testing simple Docker command ==="
99+
docker run --rm hello-world
100+
echo "Docker test successful!"
101+
102+
- name: Test Docker Compose V2
103+
run: |
104+
echo "=== Testing Docker Compose V2 ==="
105+
mkdir -p test-compose
106+
cat > test-compose/docker-compose.yml << 'EOF'
107+
version: '3.8'
108+
services:
109+
test:
110+
image: hello-world
111+
command: echo "Docker Compose V2 test successful!"
112+
EOF
113+
cd test-compose
114+
docker compose up
115+
echo "Docker Compose V2 test successful!"
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
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

Comments
 (0)