-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (72 loc) · 2.76 KB
/
build-amd64.yaml
File metadata and controls
81 lines (72 loc) · 2.76 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
77
78
79
80
81
name: CI/CD with Docker Compose Linux Host
on:
push:
branches:
- main
jobs:
build-and-test:
runs-on: self-hosted
services:
docker:
image: docker:20.10.9
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build and start Docker Compose services
run: docker compose -f compose_linux_nogpu.yaml up -d --build
- name: Wait for services to be healthy (optional, but recommended)
# You can use a dedicated action or a script to wait for health checks
# Example using a simple sleep (adjust as needed for your application)
run: sleep 30
- name: Test noVNC is up
run: |
SERVICE_URL="http://localhost:3080"
EXPECTED_RESPONSE="200"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" $SERVICE_URL)
if [ "$RESPONSE" == "$EXPECTED_RESPONSE" ]; then
echo "Test Passed: Service returned expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 0
else
echo "Test Failed: Service response did not match expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 1
fi
- name: Test code-server is up
run: |
SERVICE_URL="http://localhost:3081"
EXPECTED_RESPONSE="200"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" $SERVICE_URL)
if [ "$RESPONSE" == "$EXPECTED_RESPONSE" ]; then
echo "Test Passed: Service returned expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 0
else
echo "Test Failed: Service response did not match expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 1
fi
- name: Test sshd is up
run: |
EXPECTED_RESPONSE="1"
RESPONSE=$(netstat -an | grep 0.0.0.0:3022 | grep tcp | grep LISTEN | wc -l)
if [ "$RESPONSE" == "$EXPECTED_RESPONSE" ]; then
echo "Test Passed: Service returned expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 0
else
echo "Test Failed: Service response did not match expected response."
echo "Expected: $EXPECTED_RESPONSE"
echo "Actual: $RESPONSE"
exit 1
fi
- name: Check running containers (optional for debugging)
run: docker ps -a
- name: Stop and remove containers
run: docker compose -f compose_linux_nogpu.yaml down