-
Notifications
You must be signed in to change notification settings - Fork 37
68 lines (57 loc) · 1.76 KB
/
main.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
name: Test Docker Compose Setup
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 * * 0' # Run weekly on Sundays at midnight UTC
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Start Docker Compose services
working-directory: ./setup
run: docker compose up -d
- name: Wait for services to be ready
run: sleep 30
- name: Check if services are running
working-directory: ./setup
run: |
if docker compose ps | grep -q "Up"; then
echo "Services are up and running."
else
echo "Error: Services failed to start properly."
exit 1
fi
- name: Test Jenkins service
run: |
if curl -s -o /dev/null -w "%{http_code}" http://localhost:8080 | grep -q "403"; then
echo "Jenkins service is responding (403 is expected without authentication)."
else
echo "Error: Jenkins service is not responding as expected."
exit 1
fi
- name: Test Docker service
working-directory: ./setup
run: |
if docker compose exec -T docker docker info > /dev/null 2>&1; then
echo "Docker service is functioning properly."
else
echo "Error: Docker service is not functioning as expected."
exit 1
fi
- name: Clean up
if: always()
working-directory: ./setup
run: docker compose down -v