-
Notifications
You must be signed in to change notification settings - Fork 17
173 lines (153 loc) · 5.37 KB
/
interactive-install-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Test Interactive Install
on:
push: # on push to any
pull_request: # on any PR
workflow_dispatch: # manual trigger
jobs:
install_and_test:
runs-on: ubuntu-22.04
env:
TEST_DASHBOARD_PASSWORD: ${{ secrets.TEST_DASHBOARD_PASSWORD }}
steps:
# 1. Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# 2. Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
driver: docker-container
buildkitd-flags: --allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
use: true
cache-binary: true
cleanup: true
# 3. Install Core Prerequisites
- name: Install Core Prerequisites
run: |
sudo apt-get update
sudo apt-get install -y expect curl git openssl
shell: bash
# 4. Install Docker Compose
- name: Install Docker Compose
run: |
# Download Docker Compose binary
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Apply executable permissions to the binary
sudo chmod +x /usr/local/bin/docker-compose
# Verify installation
/usr/local/bin/docker-compose --version
shell: bash
# 5. Add /usr/local/bin to PATH
- name: Add /usr/local/bin to PATH
run: echo "/usr/local/bin" >> $GITHUB_PATH
shell: bash
# 6. Verify Installations
- name: Verify Installations
run: |
set -x # Enable verbose logging for debugging
echo "Verifying installations..."
git --version
docker --version
docker-compose --version
openssl version
which expect
expect -v
curl --version
echo "PATH: $PATH"
shell: bash
# 7. List /usr/local/bin for Debugging (Optional)
- name: List /usr/local/bin for Debugging
run: ls -la /usr/local/bin
shell: bash
# 8. Verify Docker Daemon is Running
- name: Verify Docker Daemon
run: docker info
shell: bash
# 9. Make installer.sh Executable
- name: Make installer.sh executable
run: chmod +x ./installer.sh
# 10. Run installer.sh with Expect to Handle Interactive Prompts
- name: Run installer.sh with expect
run: |
# set -x # Enable verbose logging for debugging
expect << 'EOF'
set timeout -1
spawn ./installer.sh
expect {
"Would you like to install openssl? (y/n) " {
send "y\r"
exp_continue
}
"By running this installer, you agree to allow the Shardeum team to collect this data. (Y/n)?" {
send "y\r"
exp_continue
}
"What base directory should the node use (default ~/.shardeum): " {
send "\r"
exp_continue
}
"Do you want to run the web based Dashboard? (Y/n): " {
send "y\r"
exp_continue
}
"Set the password to access the Dashboard:" {
send "$env(TEST_DASHBOARD_PASSWORD)\r"
exp_continue
}
"Enter the port (1025-65536) to access the web based Dashboard (default 8080): " {
send "\r"
exp_continue
}
"If you wish to set an explicit external IP, enter an IPv4 address (default=auto): " {
send "auto\r"
exp_continue
}
"If you wish to set an explicit internal IP, enter an IPv4 address (default=auto): " {
send "auto\r"
exp_continue
}
"Enter the first port (1025-65536) for p2p communication (default 9001): " {
send "\r"
exp_continue
}
"Enter the second port (1025-65536) for p2p communication (default 10001): " {
send "\r"
exp_continue
}
eof
}
EOF
shell: bash
- name: Wait for Services to Start
run: |
sleep 30 # Wait for services to fully boot.
- name: Verify Docker Container is Running
run: |
cd ~/.shardeum
docker compose ps
if [ $(docker compose ps -q | wc -l) -eq 0 ]; then
echo "No containers running"
exit 1
fi
if [ $(docker compose ps | grep -c "Up") -eq 0 ]; then
echo "Containers are not running"
exit 1
fi
- name: Check for GUI to be up
run: |
for i in {1..12}; do
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -k https://localhost:8080)
if [ $HTTP_STATUS -eq 200 ]; then
echo "GUI response successful!"
break
else
echo "GUI response failed with status code: $HTTP_STATUS. Retrying in 5 seconds..."
sleep 5
fi
done
if [ $i -eq 12 ]; then
echo "GUI response check failed after 1 minute."
curl -k https://localhost:8080
exit 1
fi