CI: Restore Postgres to services, use service name as hostname
Some checks failed
Pipeline / UI Lint (push) Successful in 57s
Pipeline / API Unit Tests (push) Successful in 13s
Pipeline / API Lint (push) Successful in 5s
Pipeline / UI Tests (push) Successful in 1m33s
Pipeline / API Integration Tests (push) Failing after 38s
Pipeline / Build & Push API Image (push) Has been skipped
Pipeline / Build & Push UI Image (push) Has been skipped

Gitea runs jobs in containers, so service containers are networked by
name (same as GitHub Actions with container:). Postgres goes back into
services: and is addressed as 'postgres', not localhost. MinIO stays
as a manual docker run with --network container:$(hostname) since it
needs `server /data` and is addressed as localhost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 22:54:05 +00:00
parent e4a77fdea3
commit 0624795370

View File

@@ -114,26 +114,31 @@ jobs:
api-integration: api-integration:
name: API Integration Tests name: API Integration Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: reactbin
POSTGRES_PASSWORD: reactbin
POSTGRES_DB: reactbin_test
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Start services - name: Start MinIO
run: | run: |
docker run -d --name ci-postgres \
--network container:$(hostname) \
-e POSTGRES_USER=reactbin \
-e POSTGRES_PASSWORD=reactbin \
-e POSTGRES_DB=reactbin_test \
postgres:16
docker run -d --name ci-minio \ docker run -d --name ci-minio \
--network container:$(hostname) \ --network container:$(hostname) \
-e MINIO_ROOT_USER=minioadmin \ -e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \ -e MINIO_ROOT_PASSWORD=minioadmin \
quay.io/minio/minio server /data quay.io/minio/minio server /data
- name: Wait for services and create bucket - name: Create MinIO bucket
run: | run: |
until docker exec ci-postgres pg_isready -U reactbin; do sleep 2; done
curl -fsSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /tmp/mc curl -fsSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /tmp/mc
chmod +x /tmp/mc chmod +x /tmp/mc
until /tmp/mc alias set local http://localhost:9000 minioadmin minioadmin; do sleep 2; done until /tmp/mc alias set local http://localhost:9000 minioadmin minioadmin; do sleep 2; done
@@ -159,8 +164,8 @@ jobs:
run: uv run pytest tests/integration/ -q run: uv run pytest tests/integration/ -q
working-directory: api working-directory: api
env: env:
TEST_DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@localhost/reactbin_test TEST_DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test
DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@localhost/reactbin_test DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test
S3_ENDPOINT_URL: http://localhost:9000 S3_ENDPOINT_URL: http://localhost:9000
S3_BUCKET_NAME: reactbin-test S3_BUCKET_NAME: reactbin-test
S3_ACCESS_KEY_ID: minioadmin S3_ACCESS_KEY_ID: minioadmin
@@ -171,9 +176,9 @@ jobs:
OWNER_USERNAME: testowner OWNER_USERNAME: testowner
OWNER_PASSWORD: testpass OWNER_PASSWORD: testpass
- name: Stop services - name: Stop MinIO
if: always() if: always()
run: docker stop ci-postgres ci-minio || true && docker rm ci-postgres ci-minio || true run: docker stop ci-minio || true && docker rm ci-minio || true
# ── Image builds (tag-only, gated on all jobs) ──────────────────────────────── # ── Image builds (tag-only, gated on all jobs) ────────────────────────────────