Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions .github/workflows/debug-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Debug Docker Setup

# on:
# workflow_dispatch:
# pull_request:

jobs:
debug-docker:
runs-on: macos-13

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check system info
run: |
echo "=== System Information ==="
uname -a
sw_vers
echo "=== Available commands ==="
which brew
which python3
which docker || echo "Docker not found"

- name: Install Docker CLI only
run: |
echo "=== Installing Docker CLI (no GUI) ==="
# Install just the Docker CLI, not the full Desktop app
brew install docker
echo "Docker CLI installed"

- name: Set up Docker
uses: docker/setup-docker-action@v4
id: docker-official
continue-on-error: true
with:
install: false # We already installed it
daemon-config: |
{
"experimental": false,
"debug": true,
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}

# - name: Setup Docker Colima (Fallback)
# uses: douglascamata/setup-docker-macos-action@v1-alpha
# id: docker-colima
# continue-on-error: true

- name: Check Docker setup results
run: |
echo "=== Docker Setup Results ==="
echo "Official Docker action result: ${{ steps.docker-official.outcome }}"
# echo "Colima action result: ${{ steps.docker-colima.outcome }}"

- name: Wait for Docker to start
run: |
echo "=== Waiting for Docker to start ==="
# Use a for loop instead of timeout (macOS doesn't have timeout command)
for i in {1..18}; do
if docker info >/dev/null 2>&1; then
echo "Docker is ready!"
break
fi
echo "Waiting for Docker... ($(date)) (attempt $i/18)"
sleep 10
done

# Final check
if ! docker info >/dev/null 2>&1; then
echo "Docker failed to start after 3 minutes"
exit 1
fi

- name: Test Docker functionality
run: |
echo "=== Testing Docker ==="
docker --version
docker info
docker ps
echo "=== Testing Docker Compose V2 ==="
docker compose version || echo "docker compose not found"

- name: Install Docker Compose V2
run: |
echo "=== Installing Docker Compose V2 ==="
# Install Docker Compose V2 plugin via Homebrew
brew install docker-compose
echo "Docker Compose V2 installed"
docker compose version

- name: Test simple Docker command
run: |
echo "=== Testing simple Docker command ==="
docker run --rm hello-world
echo "Docker test successful!"

- name: Test Docker Compose V2
run: |
echo "=== Testing Docker Compose V2 ==="
mkdir -p test-compose
cat > test-compose/docker-compose.yml << 'EOF'
version: '3.8'
services:
test:
image: hello-world
command: echo "Docker Compose V2 test successful!"
EOF
cd test-compose
docker compose up
echo "Docker Compose V2 test successful!"
269 changes: 269 additions & 0 deletions .github/workflows/e2e-self-hosted.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
name: e2e-tests

on:
workflow_dispatch:
inputs:
e2e_branch:
description: "Branch of synonymdev/bitkit-e2e-tests to use"
required: false
default: "main"
push:
branches: [master]
pull_request:
branches: [master]

env:
TERM: xterm-256color
FORCE_COLOR: 1

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# build:
# runs-on: [self-hosted, macOS]

# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: System Information
# run: |
# echo "=== System Information ==="
# echo "macOS Version:"
# sw_vers
# echo ""
# echo "Xcode Version:"
# xcodebuild -version

# - name: Setup iOS Simulator
# run: |
# # Set simulator name
# SIMULATOR_NAME="iPhone 17"
# echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV

# # Boot the iPhone 17 simulator if not already running
# if ! xcrun simctl list devices | grep "iPhone 17" | grep -q "Booted"; then
# echo "Booting $SIMULATOR_NAME..."
# xcrun simctl boot "$SIMULATOR_NAME"

# # Wait for simulator to boot
# for i in {1..30}; do
# if xcrun simctl list devices | grep "$SIMULATOR_NAME" | grep -q "Booted"; then
# echo "$SIMULATOR_NAME is booted!"
# break
# fi
# echo "Waiting for $SIMULATOR_NAME boot... ($i/30)"
# sleep 5
# done
# else
# echo "$SIMULATOR_NAME is already booted!"
# fi

# # Wait for simulator to be fully ready
# sleep 15

# # Launch simulator app
# open -a Simulator

# - name: Clean build environment
# run: |
# # Clean any existing build artifacts
# rm -rf DerivedData
# rm -rf ~/Library/Developer/Xcode/DerivedData

# # Clean Swift Package Manager caches
# rm -rf ~/Library/Caches/org.swift.swiftpm
# rm -rf ~/Library/org.swift.swiftpm

# # Reset package caches
# xcodebuild -resolvePackageDependencies -workspace Bitkit.xcodeproj/project.xcworkspace -scheme Bitkit

# - name: Build iOS app
# env:
# GITHUB_ACTOR: ${{ github.actor }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# CHATWOOT_API: ${{ secrets.CHATWOOT_API }}
# E2E: true
# run: |
# echo "=== Building iOS app ==="

# # Ensure iOS Simulator platform is available
# xcodebuild -downloadPlatform iOS || echo "iOS platform already installed"

# # Build for iOS Simulator
# xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
# -scheme Bitkit \
# -configuration Debug \
# -destination "platform=iOS Simulator,name=$SIMULATOR_NAME" \
# -derivedDataPath DerivedData \
# -allowProvisioningUpdates \
# build

# - name: Prepare app for E2E tests
# run: |
# # Copy the .app bundle to the expected location and name
# mkdir -p e2e-app
# cp -r DerivedData/Build/Products/Debug-iphonesimulator/Bitkit.app e2e-app/bitkit.app

# - name: Upload iOS app
# uses: actions/upload-artifact@v4
# with:
# name: bitkit-e2e-ios_${{ github.run_number }}
# path: e2e-app/

e2e-tests:
runs-on: [self-hosted, macOS]
# needs: build

strategy:
fail-fast: false
matrix:
shard:
# - { name: onboarding_backup_numberpad, grep: "@onboarding|@backup|@numberpad" }
# - { name: onchain_boost_receive_widgets, grep: "@onchain|@boost|@receive|@widgets" }
# - { name: settings, grep: "@settings" }
# - { name: security, grep: "@security" }
- { name: onboarding, grep: "@onboarding" }

name: e2e-tests - ${{ matrix.shard.name }}

steps:
- name: Show selected E2E branch
env:
E2E_BRANCH: ${{ github.event.inputs.e2e_branch || 'main' }}
run: echo $E2E_BRANCH

- name: Clone E2E tests
uses: actions/checkout@v4
with:
repository: synonymdev/bitkit-e2e-tests
path: bitkit-e2e-tests
ref: ${{ github.event.inputs.e2e_branch || 'main' }}

# - name: Download iOS app
# uses: actions/download-artifact@v4
# with:
# name: bitkit-e2e-ios_${{ github.run_number }}
# path: bitkit-e2e-tests/aut

# - name: List iOS app directory contents
# run: ls -l bitkit-e2e-tests/aut

# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22

# - name: Cache npm cache
# uses: actions/cache@v3
# with:
# path: ~/.npm
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-

# - name: Install dependencies
# working-directory: bitkit-e2e-tests
# run: npm ci

# - name: Install Docker
# run: |
# # Install Docker Desktop for Mac
# brew install --cask docker
# # Start Docker Desktop
# open -a Docker
# # Wait for Docker to be ready (with longer timeout)
# echo "Waiting for Docker to start..."
# timeout 120 bash -c 'until docker info >/dev/null 2>&1; do echo "Waiting for Docker..."; sleep 5; done'
# echo "Docker is ready!"

# - name: Install Docker Compose
# run: |
# # Install docker-compose via pip (more reliable than brew on macOS runners)
# python3 -m pip install docker-compose

- name: Docker info
run: |
docker --version
docker info
docker ps
docker compose version

- name: Run regtest setup
working-directory: bitkit-e2e-tests
run: |
cd docker
mkdir lnd && chmod 777 lnd
docker compose --verbose up -d

- name: Wait for electrum server and LND
working-directory: bitkit-e2e-tests
timeout-minutes: 10
run: |
echo "Waiting for Electrum server..."
while ! nc -z '127.0.0.1' 60001; do
echo "Electrum server not ready, waiting..."
sleep 2
done
echo "Electrum server is ready!"

echo "Waiting for LND admin.macaroon..."
while [ ! -f docker/lnd/data/chain/bitcoin/regtest/admin.macaroon ]; do
echo "LND macaroon not ready, waiting..."
sleep 2
done
echo "LND macaroon is ready!"

echo "Setting LND permissions..."
chmod -R 755 docker/lnd
echo "LND setup complete!"

# - name: Setup iOS Simulator
# run: |
# # Boot iOS Simulator
# xcrun simctl boot "iPhone 17" || true
# xcrun simctl bootstatus "iPhone 17" -b

# # Install the app
# xcrun simctl install "iPhone 17" bitkit-e2e-tests/aut/bitkit.app

# - name: Run E2E Tests (${{ matrix.shard.name }})
# run: |
# cd bitkit-e2e-tests

# # Setup logging
# LOGDIR="./artifacts"
# mkdir -p "$LOGDIR"
# LOGFILE="$LOGDIR/simulator.log"

# # Start simulator logging
# xcrun simctl spawn "iPhone 17" log stream --predicate 'process == "Bitkit"' --style compact > "$LOGFILE" &
# LOG_PID=$!

# # Setup port forwarding for regtest and LND
# xcrun simctl spawn "iPhone 17" launchctl load -w /System/Library/LaunchDaemons/com.apple.usbmuxd.plist || true

# # Cleanup function
# cleanup() {
# kill "$LOG_PID" 2>/dev/null || true
# wait "$LOG_PID" 2>/dev/null || true
# }
# trap cleanup EXIT INT TERM

# # Pass everything through to WDIO/Mocha
# npm run e2e:ios -- "$@"
# env:
# RECORD_VIDEO: true

# - name: Upload E2E Artifacts (${{ matrix.shard.name }})
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: e2e-artifacts_${{ matrix.shard.name }}_${{ github.run_number }}
# path: bitkit-e2e-tests/artifacts/

# - name: Dump docker logs on failure (${{ matrix.shard.name }})
# if: failure()
# uses: jwalton/gh-docker-logs@v2
Loading
Loading