Skip to content

Commit

Permalink
chore: tilt ci process is spinning up backend deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Feb 12, 2024
1 parent 5041f74 commit d443ed2
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ if [ -f ".env.local" ]; then
dotenv .env.local
fi

use flake .
use flake ./dev
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: E2E against Local

on: [push]

jobs:
tilt-ci-android:
name: Tilt CI Android
runs-on: ["self-hosted", "Linux", "X64"]

steps:
- uses: actions/checkout@v2
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Tilt CI
run: |
for i in {1..5}; do
echo "Tilt CI attempt $i"
nix develop -c sh -c 'cd dev && tilt ci' && exit 0 || sleep 15
done
exit 1
- name: Destroy backend
if: always()
continue-on-error: true
run: nix develop -c sh -c 'cd dev && tilt down'

tilt-ci-ios:
name: Tilt CI MacOS
runs-on: ["self-hosted", "MacOS", "ARM64"]

steps:
- uses: actions/checkout@v2
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Tilt CI
run: |
for i in {1..5}; do
echo "Tilt CI attempt $i"
nix develop -c sh -c 'cd dev && tilt ci' && exit 0 || sleep 15
done
exit 1
- name: Destroy backend
if: always()
continue-on-error: true
run: nix develop -c sh -c 'cd dev && tilt down'
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ yalc.lock

*.log

.env
.dependencies
ios/assets
ios/GaloyApp/assets
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ start:
yarn start

tilt-up:
cd dev && GALOY_QUICKSTART_PATH="dev/vendor/galoy-quickstart" tilt up
cd dev && tilt up

tilt-down:
cd dev && GALOY_QUICKSTART_PATH="dev/vendor/galoy-quickstart" tilt down
cd dev && tilt down
2 changes: 2 additions & 0 deletions dev/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALICE_PHONE="+919876540001"
BOB_PHONE="+919876540002"
18 changes: 18 additions & 0 deletions dev/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ for service in bitcoin_services:

dc_resource('otel-agent', labels = ["otel"])
dc_resource('quickstart-test', labels = ['quickstart'], auto_init=False)

local_resource(
name='init-setup',
labels = ['dev-setup'],
cmd='bin/setup.sh',
resource_deps = galoy_services + [
"init-lightning"
]
)

local_resource(
name='blocks',
labels = ['dev-setup'],
serve_cmd='bin/blocks.sh',
resource_deps = [
"init-setup"
]
)
12 changes: 12 additions & 0 deletions dev/bin/blocks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

REPO_ROOT=$(git rev-parse --show-toplevel)

source ${REPO_ROOT}/dev/vendor/galoy-quickstart/bin/helpers.sh

while true; do
bitcoin_cli -generate 1
sleep 2
done
25 changes: 25 additions & 0 deletions dev/bin/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -e

REPO_ROOT=$(git rev-parse --show-toplevel)

source ${REPO_ROOT}/dev/vendor/galoy-quickstart/bin/helpers.sh
source ${REPO_ROOT}/dev/.env

login_user "alice" "$ALICE_PHONE" "000000"
echo "alice logged in"
ALICE_TOKEN=$(read_value "alice")
receive_onchain
echo "alice funded"

login_user "alice" "$BOB_PHONE" "000000"
echo "bob logged in"
BOB_TOKEN=$(read_value "alice")
receive_onchain
echo "bob funded"

cat <<EOF > .env.tmp.ci
ALICE_TOKEN="$ALICE_TOKEN"
BOB_TOKEN="$BOB_TOKEN"
EOF
2 changes: 2 additions & 0 deletions dev/vendor/galoy-quickstart/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ services:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-agent:4318
ports:
- 6685:6685
links:
- notifications-pg:notifications-pg
notifications-pg:
image: postgres:14.1
environment:
Expand Down

0 comments on commit d443ed2

Please sign in to comment.