Skip to content

ci:test:deploy

ci:test:deploy #1311

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