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

fix: move colima logic to script file #1415

Closed
wants to merge 6 commits into from
Closed
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
34 changes: 7 additions & 27 deletions .github/workflows/e2e-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
uses: douglascamata/setup-docker-macos-action@v1-alpha
id: docker1
continue-on-error: true
with:
upgrade-qemu: true

- name: Setup Docker Colima 2
if: steps.docker1.outcome != 'success'
Expand All @@ -36,37 +38,15 @@ jobs:
uses: docker-practice/[email protected]
timeout-minutes: 30

- name: Run regtest setup
run: cd docker && mkdir lnd && chmod 777 lnd && docker-compose up --quiet-pull -d

- name: Install AppleSimulatorUtils
run: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && brew install applesimutils

- name: Run regtest setup
run: cd docker && mkdir lnd && chmod 777 lnd && docker-compose up -d

- name: Wait for electrum server
- name: Wait for docker testing environment
timeout-minutes: 20
run: |
while true
do
for i in {1..60}; do
nc -z '127.0.0.1' 60001
if [ $? -eq 0 ]; then
echo "port is open"
exit 0
fi
echo "port is closed, attempt $i"
sleep 1
done
echo "colima restart"
colima restart
done

# - name: Wait for bitcoind
# timeout-minutes: 2
# run: while ! nc -z '127.0.0.1' 43782; do sleep 1; done

# - name: Wait for electrum server
# timeout-minutes: 2
# run: while ! nc -z '127.0.0.1' 60001; do sleep 1; done
run: ./.github/workflows/wait-for-env.sh

- name: Setup Node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fetch-depth: 1

- name: Run regtest setup
run: cd docker && docker compose up -d
run: cd docker && docker compose up --quiet-pull -d

- name: Wait for bitcoind
run: |
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/wait-for-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
# wait for the colima env to be ready, restart if not ready after 60 seconds

ATTEMPTS=60

while true
do
docker-compose -f docker/docker-compose.yml ps

echo "::group::check ports"

echo -n "Bitcoin port 43782 "
bitcoin=false
for i in $(seq 1 $ATTEMPTS)
do
nc -z '127.0.0.1' 43782 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo " success!"
bitcoin=true
break
fi
echo -n "."
sleep 1
done

if [ "$bitcoin" = true ] ; then
echo -n "electrum port 60001 "
for i in $(seq 1 $ATTEMPTS)
do
nc -z '127.0.0.1' 60001 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo " success!"
echo "::endgroup::"
exit 0
fi
echo -n "."
sleep 1
done
fi

echo " failed!"
echo "::endgroup::"

echo "::group::docker-compose ps"
docker-compose -f docker/docker-compose.yml ps
echo "::endgroup::"

echo "::group::colima restart"
colima restart
docker-compose -f docker/docker-compose.yml ps down -t 60
docker-compose -f docker/docker-compose.yml ps up -d
sleep 10
echo "::endgroup::"

echo "::group::docker-compose ps"
docker-compose -f docker/docker-compose.yml ps
echo "::endgroup::"
done