From a76044409c27613ef93a9b68fcddd824401bea05 Mon Sep 17 00:00:00 2001 From: github-ops Date: Tue, 16 Jun 2026 18:53:43 +0000 Subject: [PATCH] ci: harden gitea test jobs --- .gitea/workflows/ci.yml | 45 +++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2a57446..2cabe00 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -11,22 +11,9 @@ jobs: rust: name: Rust Checks runs-on: ubuntu-latest - services: - postgres: - image: postgres:16-alpine - env: - POSTGRES_DB: crank_test - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - ports: - - 5432:5432 - options: >- - --health-cmd "pg_isready -U postgres -d crank_test" - --health-interval 10s - --health-timeout 5s - --health-retries 5 env: - TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/crank_test + TEST_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:55432/crank_test + CRANK_CI_POSTGRES: crank-ci-postgres steps: - name: Checkout @@ -38,6 +25,21 @@ jobs: cargo --version rustfmt --version cargo clippy --version + docker --version + + - name: Start test Postgres + run: | + docker rm -f "$CRANK_CI_POSTGRES" >/dev/null 2>&1 || true + docker run -d --rm \ + --name "$CRANK_CI_POSTGRES" \ + -e POSTGRES_DB=crank_test \ + -e POSTGRES_USER=postgres \ + -e POSTGRES_PASSWORD=postgres \ + -p 127.0.0.1:55432:5432 \ + postgres:16-alpine >/dev/null + until docker exec "$CRANK_CI_POSTGRES" pg_isready -U postgres -d crank_test >/dev/null 2>&1; do + sleep 1 + done - name: Check formatting run: cargo fmt --all --check @@ -51,6 +53,10 @@ jobs: - name: Run tests run: cargo test --workspace --all-targets + - name: Stop test Postgres + if: always() + run: docker rm -f "$CRANK_CI_POSTGRES" >/dev/null 2>&1 || true + ui: name: UI Checks runs-on: ubuntu-latest @@ -90,6 +96,7 @@ jobs: cargo --version node --version npm --version + docker --version - name: Install UI dependencies working-directory: apps/ui @@ -99,10 +106,18 @@ jobs: working-directory: apps/ui run: npx playwright install --with-deps chromium + - name: Prebuild e2e services + run: cargo build -p admin-api -p mcp-server + - name: Run Playwright e2e working-directory: apps/ui run: npx playwright test + - name: Show Playwright stack logs + if: failure() + run: | + find .tmp/ui-e2e/logs -maxdepth 1 -type f -print -exec sed -n '1,220p' {} \; || true + deployment: name: Deployment Manifests runs-on: ubuntu-latest