-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (64 loc) · 2.11 KB
/
ci:build:compose.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
name: ci:build:compose
on:
push:
branches:
- main
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: Continuous integration (build compose)
strategy:
matrix:
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
timeout-minutes: 18
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Wait for image build workflow to succeed
uses: ArcticLampyrid/[email protected]
with:
workflow: ci:build:image.yml
sha: ${{ github.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Bake 🧑🍳
uses: docker/bake-action@v4
with:
load: true
files: |
compose.yaml
set: |
patient-web.cache-from=type=gha
patient-web.cache-to=type=gha,mode=max
- name: Start
run: |
docker compose up --detach
- name: Wait for database container to be healthy
run: |
timeout 60 bash -c \
'until docker inspect --format "{{json .State.Health }}" "$(docker compose ps -q patient-db)" | jq -e ".Status == \"healthy\"" ; do sleep 1; done'
- name: Wait for server port to be available
run: |
timeout 60 bash -c \
'until nc -z -v -w5 127.0.0.1 3000 ; do sleep 1; done'
- name: Wait for web container to be healthy
run: |
timeout 60 bash -c \
'until docker inspect --format "{{json .State.Health }}" "$(docker compose ps -q patient-web)" | jq -e ".Status == \"healthy\"" ; do sleep 1; done'
- name: Call healthcheck endpoint
run: |
timeout 60 bash -c \
'curl -f http://localhost:3000/api/healthcheck'
- name: Run healthcheck script
run: |
timeout 60 bash -c \
'node scripts/healthcheck.cjs http://localhost:3000/api/healthcheck'
- name: Stop
run: |
docker compose down