feat: Enhance CI workflows with health checks and update PostgreSQL image version
This commit is contained in:
@@ -53,6 +53,8 @@ jobs:
|
||||
|
||||
- name: Set up QEMU and Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
install: false
|
||||
|
||||
- name: Log in to Gitea registry
|
||||
if: ${{ steps.meta.outputs.on_default == 'true' }}
|
||||
@@ -72,3 +74,5 @@ jobs:
|
||||
tags: |
|
||||
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_ORG }}/${{ env.REGISTRY_IMAGE_NAME }}:latest
|
||||
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_ORG }}/${{ env.REGISTRY_IMAGE_NAME }}:${{ steps.meta.outputs.sha }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@@ -49,3 +49,16 @@ jobs:
|
||||
-e DATABASE_NAME=${{ secrets.DATABASE_NAME }} \
|
||||
-e DATABASE_SCHEMA=${{ secrets.DATABASE_SCHEMA }} \
|
||||
"$IMAGE_PATH:$IMAGE_SHA"
|
||||
|
||||
for attempt in {1..10}; do
|
||||
if curl -fsS http://localhost:8000/health >/dev/null; then
|
||||
echo "Deployment health check passed"
|
||||
exit 0
|
||||
fi
|
||||
echo "Health check attempt ${attempt} failed; retrying in 3s"
|
||||
sleep 3
|
||||
done
|
||||
|
||||
echo "Deployment health check failed after retries" >&2
|
||||
docker logs calminer >&2 || true
|
||||
exit 1
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
target: [unit, e2e, lint]
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_DB: calminer_ci
|
||||
POSTGRES_USER: calminer
|
||||
@@ -36,6 +36,7 @@ jobs:
|
||||
--health-retries 10
|
||||
steps:
|
||||
- name: Install Node.js runtime
|
||||
if: ${{ matrix.target == 'e2e' }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -63,8 +64,9 @@ jobs:
|
||||
- name: Prepare Python environment
|
||||
uses: ./.gitea/actions/setup-python-env
|
||||
with:
|
||||
install-playwright: ${{ matrix.target != 'e2e' }}
|
||||
install-playwright: ${{ matrix.target == 'e2e' }}
|
||||
use-system-python: 'true'
|
||||
run-db-setup: ${{ matrix.target != 'lint' }}
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user