40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
name: PROMPT Docker CI and deployment
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
verify-and-deploy:
|
|
runs-on: ces-control
|
|
timeout-minutes: 45
|
|
env:
|
|
PROMPT_IMAGE: prompt:${{ gitea.sha }}
|
|
PROMPT_TEST_IMAGE: prompt-tests:${{ gitea.sha }}
|
|
RELEASE_SHA: ${{ gitea.sha }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Prepare Docker Engine and Compose
|
|
run: |
|
|
set -eu
|
|
if [ "$(id -u)" -eq 0 ]; then SUDO=""; else SUDO="sudo -n"; fi
|
|
if ! command -v docker >/dev/null || ! docker compose version >/dev/null 2>&1; then
|
|
$SUDO apt-get update -qq
|
|
$SUDO apt-get install -y docker.io docker-compose-v2
|
|
fi
|
|
$SUDO systemctl enable --now docker
|
|
- name: Validate the Compose configuration
|
|
run: docker compose --env-file .env.example config --quiet
|
|
- name: Type check, unit tests, production build and smoke test inside Docker
|
|
run: docker build --target integration -t "$PROMPT_TEST_IMAGE" .
|
|
- name: Build non-root production image with bundled FFmpeg
|
|
run: docker build --target runtime -t "$PROMPT_IMAGE" .
|
|
- name: Test the complete isolated Docker stack
|
|
run: bash scripts/integration.sh
|
|
- name: Deploy the persistent Docker Compose stack
|
|
if: gitea.ref == 'refs/heads/main' && (gitea.event_name == 'push' || gitea.event_name == 'workflow_dispatch')
|
|
run: bash scripts/deploy.sh "$RELEASE_SHA"
|