-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (88 loc) · 3.22 KB
/
docker-compose-build.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
name: Docker Compose Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test-docker:
runs-on: ubuntu-latest
services:
docker:
image: docker:26.0.0
options: --privileged
steps:
- uses: actions/checkout@v2
- name: Set permissions and run install.sh
run: |
chmod +x install.sh
./install.sh build --verbose
- name: Set up Docker Compose
run: |
sed -i 's/25\:25/2525\:25/g' docker-compose.yml
docker compose -f docker-compose.yml up -d
- name: Test if services are responding
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 5
command: |
sleep 15
# Array of endpoints to test
declare -A endpoints=(
["WASM"]="https://localhost:443"
["WebApi"]="https://localhost:443/api"
["Admin"]="https://localhost:443/admin/user/login"
)
failed=false
# Test HTTP endpoints
for name in "${!endpoints[@]}"; do
url="${endpoints[$name]}"
echo "Testing $name at $url"
# Store both response body and HTTP code
response=$(curl -k -s -w "\nHTTP_CODE=%{http_code}" "$url")
http_code=$(echo "$response" | grep "HTTP_CODE=" | cut -d= -f2)
body=$(echo "$response" | sed '$d') # Remove the last line (HTTP_CODE)
if [ "$http_code" -ne 200 ]; then
echo "❌ $name failed with HTTP $http_code at $url"
echo "Response body:"
echo "$body"
failed=true
else
echo "✅ $name responded with HTTP 200"
fi
done
# Test SMTP
echo "Testing SmtpService at localhost:2525"
if ! nc -zv localhost 2525 2>&1 | grep -q 'succeeded'; then
echo "❌ SmtpService failed to respond on port 2525"
failed=true
else
echo "✅ SmtpService responded successfully"
fi
# Exit with error if any service failed
if [ "$failed" = true ]; then
# Get container logs
echo "Container Logs admin:"
docker compose logs admin
echo "Container Logs api:"
docker compose logs api
echo "Container Logs client:"
docker compose logs client
echo "Container Logs smtp:"
docker compose logs smtp
echo "Container Logs reverse-proxy:"
docker compose logs reverse-proxy
# Restart containers for next test in case of failure
docker compose restart
exit 1
fi
- name: Test install.sh reset-password output
run: |
output=$(./install.sh reset-password)
if ! echo "$output" | grep -E '.*New admin password: [A-Za-z0-9+/=]{8,}.*'; then
echo "Password reset output format is incorrect"
echo "Expected: 'New admin password: <at least 8 base64 chars>'"
echo "Actual: $output"
exit 1
fi