2 Commits

Author SHA1 Message Date
69a4d5a084 CI: Try different approach to running PostgreSQL
Some checks failed
Pipeline / UI Lint (push) Successful in 57s
Pipeline / UI Tests (push) Successful in 1m35s
Pipeline / API Unit Tests (push) Successful in 41s
Pipeline / API Lint (push) Successful in 9s
Pipeline / Build & Push API Image (push) Has been cancelled
Pipeline / Build & Push UI Image (push) Has been cancelled
Pipeline / API Integration Tests (push) Has been cancelled
2026-05-10 19:19:14 -04:00
e13a81e31e CI: Run both Postgres and MinIO with --network container:$(hostname)
The Gitea runner executes jobs inside a container. Port-mapped services
bind to the host VM's interface, not to the runner container's loopback,
so localhost:<port> is always unreachable regardless of services: config.

--network container:$(hostname) joins each service to the job container's
network namespace, making both accessible on localhost. Both DB URL and
S3 endpoint use localhost accordingly.

Also adds timeout-minutes: 15 to bound runaway jobs on cancel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 23:00:46 +00:00

View File

@@ -65,18 +65,20 @@ jobs:
api-unit: api-unit:
name: API Unit Tests name: API Unit Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/astral-sh/uv:python3.12-bookworm
steps: steps:
- uses: actions/checkout@v4 - name: Install Node (for JS actions)
- name: Install uv
run: | run: |
curl -LsSf https://astral.sh/uv/install.sh | sh apt-get update -qq
echo "$HOME/.local/bin" >> $GITHUB_PATH apt-get install -y --no-install-recommends nodejs ca-certificates curl
- uses: actions/checkout@v4
- name: Cache uv store - name: Cache uv store
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.cache/uv path: /root/.cache/uv
key: uv-${{ hashFiles('api/uv.lock') }} key: uv-${{ hashFiles('api/uv.lock') }}
restore-keys: uv- restore-keys: uv-
@@ -102,18 +104,25 @@ jobs:
api-lint: api-lint:
name: API Lint name: API Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/astral-sh/uv:python3.12-bookworm
steps: steps:
- name: Install Node (for JS actions)
run: |
apt-get update -qq
apt-get install -y --no-install-recommends nodejs ca-certificates curl
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Run Ruff - name: Run Ruff
run: | run: uvx ruff check .
curl -LsSf https://astral.sh/uv/install.sh | sh
~/.local/bin/uvx ruff check .
working-directory: api working-directory: api
api-integration: api-integration:
name: API Integration Tests name: API Integration Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: ghcr.io/astral-sh/uv:python3.12-bookworm
services: services:
postgres: postgres:
image: postgres:16 image: postgres:16
@@ -126,33 +135,37 @@ jobs:
--health-interval 5s --health-interval 5s
--health-timeout 5s --health-timeout 5s
--health-retries 10 --health-retries 10
minio:
image: quay.io/minio/minio
env:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
options: >-
--entrypoint sh
--health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
--health-interval 5s
--health-timeout 5s
--health-retries 10
cmd: ["-c", "minio server /data"]
steps: steps:
- uses: actions/checkout@v4 - name: Install Node and curl (for JS actions and mc)
- name: Start MinIO
run: | run: |
docker run -d --name ci-minio \ apt-get update -qq
--network container:$(hostname) \ apt-get install -y --no-install-recommends nodejs ca-certificates curl
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \ - uses: actions/checkout@v4
quay.io/minio/minio server /data
- name: Create MinIO bucket - name: Create MinIO bucket
run: | run: |
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://minio:9000 minioadmin minioadmin; do sleep 2; done
/tmp/mc mb local/reactbin-test /tmp/mc mb local/reactbin-test --ignore-existing
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Cache uv store - name: Cache uv store
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.cache/uv path: /root/.cache/uv
key: uv-${{ hashFiles('api/uv.lock') }} key: uv-${{ hashFiles('api/uv.lock') }}
restore-keys: uv- restore-keys: uv-
@@ -166,7 +179,7 @@ jobs:
env: env:
TEST_DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test TEST_DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test
DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test DATABASE_URL: postgresql+asyncpg://reactbin:reactbin@postgres/reactbin_test
S3_ENDPOINT_URL: http://localhost:9000 S3_ENDPOINT_URL: http://minio:9000
S3_BUCKET_NAME: reactbin-test S3_BUCKET_NAME: reactbin-test
S3_ACCESS_KEY_ID: minioadmin S3_ACCESS_KEY_ID: minioadmin
S3_SECRET_ACCESS_KEY: minioadmin S3_SECRET_ACCESS_KEY: minioadmin
@@ -176,10 +189,6 @@ jobs:
OWNER_USERNAME: testowner OWNER_USERNAME: testowner
OWNER_PASSWORD: testpass OWNER_PASSWORD: testpass
- name: Stop MinIO
if: always()
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) ────────────────────────────────
build-api: build-api: