-
Notifications
You must be signed in to change notification settings - Fork 2
107 lines (88 loc) · 2.81 KB
/
ci:test:deploy.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
name: ci:test:deploy
on:
push:
branches:
- main
pull_request:
merge_group:
workflow_run:
workflows:
- ci:build:image
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: Continuous integration (test deploy)
strategy:
matrix:
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
timeout-minutes: 30
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Fail job if triggering workflow did not succeed
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success'
uses: actions/github-script@v7
with:
script: |
core.setFailed('ci:build:image did not succeed')
- name: Wait for image build workflow to succeed
if: github.event_name != 'workflow_run'
uses: ArcticLampyrid/[email protected]
with:
workflow: ci:build:image.yml
sha: auto
- name: Log in to GitHub Packages registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Start
env:
ROOT_URL: http://localhost
IMAGE_TAG: sha-${{ github.sha }}
run: |
docker compose \
--env-file .env -f compose.yaml \
--env-file .deploy/ghcr.io/.env -f .deploy/ghcr.io/compose.yaml \
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