-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (106 loc) · 3.24 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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: 30
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: auto
timeout-minutes: 15 # NOTE We build without a fresh cache on timeout.
continue-on-error: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Bake 🧑🍳
uses: docker/bake-action@v4
with:
files: |
compose.yaml
set: |
patient-web.cache-from=type=gha
patient-web.output=type=docker,dest=/tmp/patient-web.tar
patient-web.tags=patients-patient-web
- name: Upload image
uses: actions/upload-artifact@v4
with:
name: images-patient-web
path: /tmp/patient-web.tar
retention-days: 1
test:
name: Continuous integration (build compose test)
needs:
- build
strategy:
matrix:
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
timeout-minutes: 5
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Download image
uses: actions/download-artifact@v4
with:
name: images-patient-web
path: /tmp/images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Load image
run: |
docker image load --input /tmp/images/patient-web.tar
- name: Start
run: |
docker compose up --no-build --detach
- id: patient-db-container
uses: ./.github/actions/docker/compose/container
with:
service: patient-db
- name: Wait for database container to be healthy
uses: ./.github/actions/docker/container/is-healthy
with:
container: ${{ steps.patient-db-container.outputs.id }}
timeout: 60
- name: Wait for web port to be available
uses: ./.github/actions/network/is-reachable
with:
timeout: 60
port: 3000
- id: patient-web-container
uses: ./.github/actions/docker/compose/container
with:
service: patient-web
- name: Wait for web container to be healthy
uses: ./.github/actions/docker/container/is-healthy
with:
container: ${{ steps.patient-web-container.outputs.id }}
timeout: 60
- 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