Skip to content

Commit 3b81ed4

Browse files
author
Gleb
authored
Add action.yml (#671)
* Update XDR dockerfile * Add action.yml * Add logs * Minor improvements * minor change * fix bash stuff * Increase timeout * Cleanup * PR comments * PR comments * Fix * add core ports * rename missing quickstart -> stellar
1 parent d487a85 commit 3b81ed4

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

action.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: 'Run quickstart'
2+
description: 'Runs quickstart docker image'
3+
inputs:
4+
tag:
5+
description: "Image tag of quickstart image to use"
6+
required: true
7+
default: "latest"
8+
image:
9+
description: "Image for the quickstart image to use"
10+
required: true
11+
default: "docker.io/stellar/quickstart"
12+
enable:
13+
description: "Services to enable"
14+
default: "core,horizon,rpc"
15+
network:
16+
description: "Network to run"
17+
default: "local"
18+
enable_logs:
19+
description: "Boolean flag enabling the logs"
20+
default: "true"
21+
health_interval:
22+
description: "Time between running the check (in seconds)"
23+
default: "10"
24+
health_timeout:
25+
description: "Maximum time to allow one check to run (in seconds)"
26+
default: "5"
27+
health_retries:
28+
description: "Consecutive failures needed to report unhealthy"
29+
default: "50"
30+
runs:
31+
using: "composite"
32+
steps:
33+
- name: "Check if Windows (unsupported)"
34+
if: runner.os == 'Windows'
35+
shell: powershell
36+
run: |
37+
echo "Windows runners are not supported"
38+
exit 1
39+
- name: "Check if macOS Apple Silicon (unsupported)"
40+
if: runner.os == 'macOS' && (runner.arch == 'ARM' || runner.arch == 'ARM64')
41+
shell: bash
42+
run: |
43+
echo "ARM MacOS runner is not yet supported, see https://github.com/douglascamata/setup-docker-macos-action"
44+
exit 1
45+
- name: Setup Colima and Docker (macOS only)
46+
shell: bash
47+
if: runner.os == 'macos'
48+
run: |
49+
brew install docker
50+
brew install colima
51+
colima start
52+
- run: >
53+
docker run -d --name stellar
54+
-p 8000:8000
55+
-p 11626:11626
56+
-p 11726:11726
57+
-p 11826:11826
58+
-e ENABLE_LOGS="${{ inputs.enable_logs }}"
59+
-e ENABLE_LOGS="${{ inputs.enable }}"
60+
-e NETWORK="${{ inputs.network }}"
61+
--health-cmd "curl --no-progress-meter -X POST -H 'Content-Type: application/json' -d
62+
'{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"getHealth\"}' 'http://localhost:8000/rpc'
63+
| grep 'healthy'
64+
&& curl --no-progress-meter \"http://localhost:8000/friendbot\" |
65+
grep '\"invalid_field\": \"addr\"'"
66+
--health-interval ${{ inputs.health_interval }}s
67+
--health-timeout ${{ inputs.health_timeout }}s
68+
--health-retries ${{ inputs.health_retries }}
69+
${{ inputs.image }}:${{ inputs.tag }}
70+
shell: bash
71+
- name: "Wait for container to be healthy"
72+
run: |
73+
i=0
74+
while true; do
75+
status=`docker inspect -f {{.State.Health.Status}} stellar`
76+
echo "stellar image status: $status"
77+
if [ "$status" == "healthy" ]; then
78+
break
79+
fi
80+
sleep 1;
81+
i=$((i + 1))
82+
if (( $i > 300 )); then
83+
echo "stellar image is slow to start, printing logs:"
84+
i=$((i - 300))
85+
docker logs stellar
86+
fi
87+
done;
88+
shell: bash

0 commit comments

Comments
 (0)