-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.38 KB
/
Copy pathtest-getting-started.yml
File metadata and controls
76 lines (65 loc) · 2.38 KB
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
name: Test Getting Started
on:
pull_request:
branches:
- main
paths:
- 'docker/self-managed/**'
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate license secret
run: |
if [ -z "${{ secrets.DASH_LICENSE }}" ]; then
echo "Error: DASH_LICENSE secret is not set"
exit 1
fi
- name: Run Getting Started Script
env:
DASH_LICENSE: ${{ secrets.DASH_LICENSE }}
run: |
cd docker/self-managed
cp .env.example .env
sed -i "s|TYK_LICENSE_KEY=|TYK_LICENSE_KEY=${DASH_LICENSE}|" .env
sed -i "s|TYK_PORTAL_LICENSE=|TYK_PORTAL_LICENSE=${DASH_LICENSE}|" .env
cd ../getting-started
chmod +x start.sh
./start.sh
- name: Wait for services to be ready
run: |
echo "Waiting for Portal to be ready..."
for i in $(seq 1 20); do
if curl -sf http://localhost:3001/ready > /dev/null 2>&1; then
echo "Portal is ready"
break
fi
echo "Attempt $i/20 - Portal not ready yet, waiting 5s..."
sleep 5
done
- name: Verify containers are running
run: |
cd docker/getting-started
docker compose -p tyk-getting-started -f ../self-managed/docker-compose.yml -f docker-compose.yml ps
if docker compose -p tyk-getting-started -f ../self-managed/docker-compose.yml -f docker-compose.yml ps --format json | grep -q '"State":"exited"'; then
echo "Some containers failed to start or exited unexpectedly."
docker compose -p tyk-getting-started -f ../self-managed/docker-compose.yml -f docker-compose.yml logs
exit 1
fi
- name: Smoke test services
run: |
echo "Testing Gateway..."
curl -sf http://localhost:8080/hello
echo "Testing Dashboard..."
curl -sf http://localhost:3000/hello
echo "Testing Portal..."
curl -sf http://localhost:3001/ready
- name: Cleanup
if: always()
run: |
cd docker/getting-started
docker compose -p tyk-getting-started -f ../self-managed/docker-compose.yml -f docker-compose.yml down -v --remove-orphans || true