Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add/fix ios/android e2e test github action #3351

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9cf3c22
test: add/fix android e2e test github action
dolcalmi Dec 10, 2024
b488f21
test: add/fix ios e2e test github action
dolcalmi Dec 10, 2024
0d776b3
fix: iOS device version
dolcalmi Dec 10, 2024
aad7376
fix: add docker
dolcalmi Dec 10, 2024
49e47ae
test: add cache to e2e ios
dolcalmi Dec 10, 2024
06d7db8
fix: wait for tilt to start
dolcalmi Dec 10, 2024
deecad7
chore: change docker installation
dolcalmi Dec 11, 2024
958b80e
perf: install from lock and improbe ios build
dolcalmi Dec 11, 2024
4538d1b
perf: improve cache
dolcalmi Dec 11, 2024
0ebff7c
chore: reduce tilt logs in gh action step
dolcalmi Dec 11, 2024
e01e8af
fix: split metro and tilt start
dolcalmi Dec 11, 2024
874b1bf
chore: update tilt ready timeout
dolcalmi Dec 12, 2024
bb652a4
chore: update timeout for api ready
dolcalmi Dec 12, 2024
72d88f1
test: move test cmd to tilt file
dolcalmi Dec 12, 2024
8f47175
fix: update tilt file and test cmd
dolcalmi Dec 12, 2024
b5d6dd9
fix: init onchain
dolcalmi Dec 12, 2024
2d2944a
chore: update detox
dolcalmi Dec 12, 2024
6e4afd3
chore: vendir sync
dolcalmi Dec 12, 2024
b7e5897
fix: avoid auto-init for e2e test
dolcalmi Dec 12, 2024
1b3f726
fix: tilt deps
dolcalmi Dec 13, 2024
cc8c511
chore: set specific simulator version to build
dolcalmi Dec 13, 2024
ad4fcf5
chore: create simulator without os version
dolcalmi Dec 13, 2024
19e28cc
fix: create recording folder
dolcalmi Dec 13, 2024
c550207
chore: improve build + test start
dolcalmi Dec 13, 2024
bd8ae83
test: increase jest timeout
dolcalmi Dec 17, 2024
638b6a2
ci: update docker compose start pulling cmd
dolcalmi Dec 17, 2024
a2441db
test: add initialize ci step
dolcalmi Dec 18, 2024
751f5d2
chore: set ci timeout to 0
dolcalmi Dec 18, 2024
be22690
chore: test docker compose pull sync
dolcalmi Dec 18, 2024
78d3caf
fix: colima docker host path
dolcalmi Dec 19, 2024
b36370e
test: add e2e ios with podman
dolcalmi Dec 19, 2024
f051c73
fix: update docker host path
dolcalmi Dec 19, 2024
9499053
fix: add podman compose
dolcalmi Dec 19, 2024
86958c2
fix: export docker host path before pull images
dolcalmi Dec 19, 2024
5212d38
chore: update macos runner
dolcalmi Dec 19, 2024
ecbc223
chore: force podman machine rm
dolcalmi Dec 19, 2024
0b40364
chore: install vfkit
dolcalmi Dec 19, 2024
99f450f
chore: add tilt podman
dolcalmi Dec 19, 2024
bf108ed
chore: vendor sync
dolcalmi Dec 20, 2024
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
18 changes: 16 additions & 2 deletions .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,29 @@ module.exports = {
config: "e2e/detox/jest.config.js",
},
jest: {
setupTimeout: 120000,
setupTimeout: 240000,
},
},
apps: {
"ios.debug": {
type: "ios.app",
binaryPath: "ios/build/Build/Products/Debug-iphonesimulator/Blink.app",
build:
"xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"xcodebuild -workspace ios/GaloyApp.xcworkspace -scheme GaloyApp " +
"-configuration Debug -sdk iphonesimulator " +
"-destination 'platform=iOS Simulator,name=iPhone SE (3rd generation)' " +
"-derivedDataPath ios/build " +
"-parallelizeTargets " +
"-jobs 8 " +
"ONLY_ACTIVE_ARCH=YES " +
"COMPILER_INDEX_STORE_ENABLE=NO " +
"BUILD_LIBRARY_FOR_DISTRIBUTION=NO " +
"CODE_SIGNING_REQUIRED=NO " +
"CODE_SIGN_IDENTITY='' " +
"ENABLE_BITCODE=NO " +
"GCC_OPTIMIZATION_LEVEL=0 " +
"SWIFT_OPTIMIZATION_LEVEL=-Onone " +
"-quiet",
},
"android.debug": {
type: "android.apk",
Expand Down
195 changes: 195 additions & 0 deletions .github/workflows/e2e-ios-podman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
name: iOS E2E Tests Podman

on:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
e2e-test:
runs-on: macos-13
steps:
- uses: actions/checkout@v4

- name: Set up Podman and pull images in background
run: |
brew install podman podman-compose
podman --help

# Remove any existing machine and create new one
podman machine reset --force || true
podman machine init --cpus 4 --memory 4104 --disk-size 60 --now
# podman machine start

# Verify machine status
podman machine ls
podman version

# Set DOCKER_HOST environment variable
SOCKET_PATH=$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
echo "DOCKER_HOST=unix://${SOCKET_PATH}" >> $GITHUB_ENV
export DOCKER_HOST="unix://${SOCKET_PATH}"

# Wait for Podman to be ready
while ! podman info > /dev/null 2>&1; do
echo "Waiting for Podman to be ready..."
sleep 5
done

podman info
podman system connection list

# Start pulling images
podman compose -f dev/vendor/galoy-quickstart/docker-compose.yml pull

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14

- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v8

- name: Initialize ci deps
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
run: nix develop -c tilt -f ./dev/Tiltfile ci --timeout 0

- name: Restore Node Modules Cache
id: cache-node-restore
uses: actions/cache/restore@v4
with:
path: |
node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Restore Pods Cache
id: cache-pods-restore
uses: actions/cache/restore@v4
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-

- name: Restore iOS Build Cache
id: cache-ios-build-restore
uses: actions/cache/restore@v4
with:
path: |
ios/build
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }}
restore-keys: |
${{ runner.os }}-ios-build-

- name: Install dependencies
run: nix develop -c yarn install --frozen-lockfile --prefer-offline

- name: Save Node Modules Cache
if: always()
uses: actions/cache/save@v4
with:
path: |
node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}

- name: Build E2E tests
run: nix develop -c yarn e2e:build ios.sim.debug -i

- name: Save Pods Cache
if: always()
uses: actions/cache/save@v4
with:
path: ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}

- name: Save iOS Build Cache
if: always()
uses: actions/cache/save@v4
with:
path: |
ios/build
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-ios-build-${{ hashFiles('ios/**/*.pbxproj') }}-${{ hashFiles('ios/**/*.xcconfig') }}

- name: Create iOS Simulator
run: |
DEVICE_ID=$(xcrun simctl create "iPhone SE (3rd generation)" com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation)
echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV

- name: Boot Simulator
run: xcrun simctl boot $DEVICE_ID

- name: Start Metro
run: |
mkdir -p /tmp/pids
nix develop -c yarn start &
echo $! > /tmp/pids/metro.pid

# Wait for Metro to be ready
while ! lsof -i:8081 >/dev/null 2>&1; do
echo "Waiting for Metro to be ready..."
sleep 5
done

- name: Run E2E Tests
id: run-tests
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
run: |
# Wait for device to be ready
while ! xcrun simctl list devices | grep "(Booted)"; do
sleep 5
echo "Waiting for Simulator device to come online..."
done

# Start screen recording
mkdir -p ios-recordings
rm -rf ios-recordings/* || true
xcrun simctl io booted recordVideo ios-recordings/screenRecord.mov &
echo $! > /tmp/pids/sim_record.pid

# Run the E2E tests
nix develop -c tilt -f ./dev/Tiltfile ci -- --test ios-e2e-tests

- name: Cleanup Processes
if: always()
env:
DOCKER_HOST: ${{ env.DOCKER_HOST }}
run: |
# Function to kill process by PID file
kill_process() {
local pidfile=$1
if [ -f "$pidfile" ]; then
PID=$(cat "$pidfile")
if ps -p $PID > /dev/null; then
echo "Killing process $(basename "$pidfile" .pid) (PID: $PID)"
kill $PID || kill -9 $PID
fi
rm "$pidfile"
fi
}

# Kill all processes
for pidfile in /tmp/pids/*.pid; do
[ -f "$pidfile" ] && kill_process "$pidfile"
done

# Additional cleanup commands
# nix develop -c tilt down -f ./dev/Tiltfile
pkill -f "node.*metro" || true
pkill -f "tilt" || true
podman machine stop || true

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-artifacts
path: |
ios-recordings/
ios-recordings/screenRecord.mov
Loading
Loading