Skip to content

Ability to run e2e build beyond local #420

Ability to run e2e build beyond local

Ability to run e2e build beyond local #420

Workflow file for this run

name: e2e-tests
on:
workflow_dispatch:
inputs:
e2e_branch:
description: "Branch of synonymdev/bitkit-e2e-tests to use (main | default-feature-branch | custom branch name)"
required: false
default: "default-feature-branch"
pull_request:
env:
TERM: xterm-256color
FORCE_COLOR: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
if: github.event.pull_request.draft == false
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: 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 }}
SIMULATOR_NAME: "iPhone 17"
OS_VERSION: "latest"
GEO: false
run: |
echo "=== Building iOS app ==="
echo "Using simulator: $SIMULATOR_NAME (iOS $OS_VERSION)"
if xcodebuild -showsdks | grep -q "iOS Simulator"; then
echo "✅ iOS Simulator platform already installed"
else
echo "⚙️ iOS Simulator platform not found — downloading..."
xcodebuild -downloadPlatform iOS
fi
xcodebuild -workspace Bitkit.xcodeproj/project.xcworkspace \
-scheme Bitkit \
-configuration Debug \
-destination "platform=iOS Simulator,name=$SIMULATOR_NAME,OS=$OS_VERSION" \
-derivedDataPath DerivedData \
SWIFT_ACTIVE_COMPILATION_CONDITIONS='$(inherited) E2E_BUILD' \
-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-branch:
if: github.event.pull_request.draft == false
uses: synonymdev/bitkit-e2e-tests/.github/workflows/determine-e2e-branch.yml@main
with:
app_branch: ${{ github.head_ref || github.ref_name }}
e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }}
e2e-tests:
if: github.event.pull_request.draft == false
runs-on: [self-hosted, macOS]
needs: [build, e2e-branch]
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: e2e, grep: '@transfer|@send|@lnurl|@lightning|@backup|@onboarding|@onchain_1|@onchain_2|@numberpad|@widgets|@boost|@receive|@settings|@security' }
name: e2e-tests - ${{ matrix.shard.name }}
steps:
- name: Show selected E2E branch
env:
E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }}
run: echo $E2E_BRANCH
- name: Clone E2E tests
uses: actions/checkout@v4
with:
repository: synonymdev/bitkit-e2e-tests
path: bitkit-e2e-tests
ref: ${{ needs.e2e-branch.outputs.branch }}
- 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: Docker info
run: |
docker --version
docker info
docker ps
docker compose version
- name: Reset regtest environment
working-directory: bitkit-e2e-tests
continue-on-error: true
run: |
cd docker && docker compose --verbose down -v -t 300
- name: Run regtest setup
working-directory: bitkit-e2e-tests
run: |
cd docker
mkdir -p lnd && chmod 777 lnd
docker compose --verbose up --force-recreate -d
- name: Wait for electrum server
working-directory: bitkit-e2e-tests
run: |
echo "Waiting for Electrum server..."
while ! nc -z '127.0.0.1' 60001; do
echo "Electrum server not ready, waiting..."
sleep 5
done
echo "Electrum server is ready!"
- name: Clear previous E2E artifacts
working-directory: bitkit-e2e-tests
run: |
rm -rf artifacts/
rm -rf /tmp/lock/
- name: Clear iOS Simulator environment
run: |
echo "🔧 Shutting down all running iOS simulators..."
xcrun simctl shutdown all || true
echo "🔧 Erasing target simulator: iPhone 17..."
xcrun simctl erase "iPhone 17" || true
echo "🔧 Disabling iOS Simulator notifications..."
defaults write com.apple.iphonesimulator DisableAllNotifications -bool true
- name: Run E2E Tests 1 (${{ matrix.shard.name }})
continue-on-error: true
id: test1
working-directory: bitkit-e2e-tests
run: ./ci_run_ios.sh --mochaOpts.grep '${{ matrix.shard.grep }}'
env:
RECORD_VIDEO: true
ATTEMPT: 1
- name: Run E2E Tests 2 (${{ matrix.shard.name }})
continue-on-error: true
if: steps.test1.outcome != 'success'
id: test2
working-directory: bitkit-e2e-tests
run: ./ci_run_ios.sh --mochaOpts.grep "${{ matrix.shard.grep }}"
env:
RECORD_VIDEO: true
ATTEMPT: 2
- name: Run E2E Tests 3 (${{ matrix.shard.name }})
if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success'
id: test3
working-directory: bitkit-e2e-tests
run: ./ci_run_ios.sh --mochaOpts.grep "${{ matrix.shard.grep }}"
env:
RECORD_VIDEO: true
ATTEMPT: 3
- 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: Cleanup Docker containers
if: always()
working-directory: bitkit-e2e-tests
run: |
cd docker && docker compose down -v || true
e2e-status:
if: always() && github.event.pull_request.draft == false
name: e2e-status
runs-on: ubuntu-latest
needs: [e2e-tests]
steps:
- name: Verify all E2E shards succeeded
run: |
if [ "${{ needs.e2e-tests.result }}" != "success" ]; then
echo "❌ Some E2E shards failed."
exit 1
fi
echo "✅ All E2E shards passed!"