Skip to content

Commit

Permalink
test: add/fix android e2e test github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dolcalmi committed Dec 10, 2024
1 parent 922902e commit 9cf3c22
Show file tree
Hide file tree
Showing 25 changed files with 654 additions and 224 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/e2e-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Android E2E Tests

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-latest
steps:
- uses: actions/checkout@v4

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

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

- name: Install dependencies
run: nix develop -c yarn install

- name: Build E2E tests
run: nix develop -c yarn e2e:build android.emu.debug

- name: Start Metro, Tilt, Emulator, and run tests
id: run-tests
run: |
# Create directory for PID files
mkdir -p /tmp/pids
# Start Metro in background
nix develop -c yarn start &
echo $! > /tmp/pids/metro.pid
# Start Tilt in background
cd dev && TILT_CI=true nix develop -c tilt up &
echo $! > /tmp/pids/tilt.pid
# Wait for galoy UI resource to be ready (timeout after 5 minutes)
nix develop -c tilt wait --for=condition=Ready "uiresource/galoy" --timeout=5m
# Start emulator in background
emulator -avd Pixel_API_34 -gpu swiftshader -wipe-data -no-boot-anim -no-window &
echo $! > /tmp/pids/emulator.pid
# Wait for device to be ready
adb wait-for-device
# Start screen recording
adb shell screenrecord --bit-rate 4000000 /sdcard/screenRecord.mp4 &
echo $! > /tmp/pids/screenrecord.pid
# Trigger dev setup and run tests
cd dev && nix develop -c tilt trigger dev-setup
# Run the E2E tests
nix develop -c yarn e2e:test android.emu.debug -d --take-screenshots all --record-videos all --record-logs all --artifacts-location android-recordings
TEST_EXIT_CODE=$?
# Pull the screen recording
adb pull /sdcard/screenRecord.mp4 android-recordings/
exit $TEST_EXIT_CODE
- name: Cleanup Processes
if: always()
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 just to be thorough
pkill -f "node.*metro" || true
pkill -f "tilt" || true
pkill -f "emulator" || true
adb shell pkill -f "screenrecord" || true
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: test-artifacts
path: |
android-recordings/
android-recordings/screenRecord.mp4
2 changes: 1 addition & 1 deletion dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local_resource(
)

docker_compose('vendor/galoy-quickstart/docker-compose.yml')
galoy_services = ["apollo-router", "galoy", "trigger", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats"]
galoy_services = ["apollo-router", "galoy", "trigger", "redis", "mongodb", "mongodb-migrate", "price", "price-history", "price-history-migrate", "price-history-pg", "svix", "svix-pg", "stablesats", "notifications", "notifications-pg"]
auth_services = ["oathkeeper", "kratos", "kratos-pg", "hydra", "hydra-pg", "hydra-migrate"]
bitcoin_services = ["bitcoind", "bitcoind-signer", "lnd1", "lnd-outside-1", "bria", "bria-pg", "fulcrum"]

Expand Down
6 changes: 3 additions & 3 deletions dev/vendir.lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- git:
commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@e06d6381813012d3abcf129d9eb10e8e7fae7c9cfd9a6857b726a9cbba238f93'
sha: 14743a8178f215f429608615db872ceb3b114bdb
commitTitle: 'chore(release): [ci skip] bump quickstart image to sha256@bd56a94ac9142ba771aa6d1e193c449c669bf2706f5de5727ffab7e50460eb4a'
sha: eddc43c797bbb3af3400c22a347b8968972b4c03
tags:
- 0.20.151
- 0.21.15
path: galoy-quickstart
path: vendor
kind: LockConfig
5 changes: 3 additions & 2 deletions dev/vendir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ directories:
contents:
- path: galoy-quickstart
git:
url: https://github.com/GaloyMoney/galoy.git
ref: '0.20.151'
url: https://github.com/GaloyMoney/blink.git
ref: "0.21.15"
depth: 1
includePaths:
- quickstart/bin/*
- quickstart/dev/**/*
Expand Down
5 changes: 5 additions & 0 deletions dev/vendor/galoy-quickstart/dev/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,8 @@ sh_binary(
name = "fund-user",
main = "bin/fund-user.sh",
)

sh_binary(
name = "setup-voucher-escrow",
main = "bin/setup-voucher-escrow.sh",
)
Loading

0 comments on commit 9cf3c22

Please sign in to comment.