Merge pull request 'CI: Wegwerf-Postgres je Lauf fuer DB-Tests (A-08) und CODEOWNERS fuer common/ (A-09)' (#398) from feat/ci-db-cluster into main
CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (push) Canceled after 0s
CI / Core-Modul (Build/Vet/Test) (push) Successful in 58s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (push) Successful in 4s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (push) Successful in 3s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (push) Failing after 17s
CI / Web (dms-browser) (push) Failing after 1m22s
CI / Web (pdf-viewer) (push) Failing after 1m0s
CI / Web (shl) (push) Failing after 14s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (push) Failing after 2s
CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (push) Canceled after 0s
CI / Core-Modul (Build/Vet/Test) (push) Successful in 58s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (push) Successful in 4s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (push) Successful in 3s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (push) Failing after 17s
CI / Web (dms-browser) (push) Failing after 1m22s
CI / Web (pdf-viewer) (push) Failing after 1m0s
CI / Web (shl) (push) Failing after 14s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (push) Failing after 2s
This commit was merged in pull request #398.
This commit is contained in:
commit
c22ad6e8ca
3 files changed
+59
-9
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
# common/ ist modulübergreifend: Änderungen brauchen Review (Auswirkungsliste im PR)
|
||||||
|
/common/ @patrick
|
||||||
@@ -4,25 +4,34 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- "common/**"
|
- "common/**"
|
||||||
- "dms/**"
|
|
||||||
- "mail/**"
|
|
||||||
- "archive/**"
|
- "archive/**"
|
||||||
- "ai/**"
|
- "ai/**"
|
||||||
- "connect/**"
|
- "connect/**"
|
||||||
- "workflow/**"
|
- "scripts/ci-pg-cluster.sh"
|
||||||
- "internal/**"
|
- ".gitea/workflows/db-tests.yml"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
db-tests:
|
db-tests:
|
||||||
runs-on: nexarch-test
|
runs-on: nexarch-test
|
||||||
env:
|
|
||||||
TEST_ADMIN_DSN: ${{ secrets.TEST_ADMIN_DSN }}
|
|
||||||
REQUIRE_DB: "1"
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: "1.25"
|
go-version: "1.25"
|
||||||
- name: Tests (common)
|
- name: Wegwerf-Postgres starten
|
||||||
|
run: scripts/ci-pg-cluster.sh start
|
||||||
|
- name: common
|
||||||
working-directory: common
|
working-directory: common
|
||||||
run: go test ./testdb/... ./migrate/... -count=1 -p 1
|
run: go test ./... -count=1 -p 1
|
||||||
|
- name: archive
|
||||||
|
working-directory: archive
|
||||||
|
run: go test ./... -count=1 -p 1
|
||||||
|
- name: ai
|
||||||
|
working-directory: ai
|
||||||
|
run: go test ./... -count=1 -p 1
|
||||||
|
- name: connect
|
||||||
|
working-directory: connect
|
||||||
|
run: go test ./... -count=1 -p 1
|
||||||
|
- name: Wegwerf-Postgres stoppen
|
||||||
|
if: always()
|
||||||
|
run: scripts/ci-pg-cluster.sh stop
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Startet/stoppt einen Wegwerf-Postgres fuer CI-DB-Tests (kein Secret, keine feste DB).
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PGBIN=${PGBIN:-/usr/lib/postgresql/17/bin}
|
||||||
|
PREFIX=/tmp/nexarch-ci-pg.
|
||||||
|
|
||||||
|
case "${1:-}" in
|
||||||
|
start)
|
||||||
|
dir=$(mktemp -d "${PREFIX}XXXXXX")
|
||||||
|
chown postgres:postgres "$dir"
|
||||||
|
port=$((55000 + RANDOM % 1000))
|
||||||
|
while ss -ltn | grep -q ":$port "; do port=$((55000 + RANDOM % 1000)); done
|
||||||
|
runuser -u postgres -- "$PGBIN/initdb" -D "$dir/data" -A trust -U postgres >/dev/null
|
||||||
|
runuser -u postgres -- "$PGBIN/pg_ctl" -D "$dir/data" -l "$dir/log" -w \
|
||||||
|
-o "-p $port -c listen_addresses=127.0.0.1 -c unix_socket_directories=$dir" start >/dev/null
|
||||||
|
for db in tenant_a tenant_b; do
|
||||||
|
"$PGBIN/psql" -h 127.0.0.1 -p "$port" -U postgres -qc "create database $db"
|
||||||
|
done
|
||||||
|
base="postgres://postgres@127.0.0.1:$port"
|
||||||
|
{
|
||||||
|
echo "NEXARCH_CI_PGDIR=$dir"
|
||||||
|
echo "TEST_ADMIN_DSN=$base/postgres?sslmode=disable"
|
||||||
|
echo "TEST_TENANT_DSN=$base/tenant_a?sslmode=disable"
|
||||||
|
echo "TEST_TENANT_DSN_B=$base/tenant_b?sslmode=disable"
|
||||||
|
echo "REQUIRE_DB=1"
|
||||||
|
} >> "${GITHUB_ENV:-/dev/stdout}"
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
dir=${NEXARCH_CI_PGDIR:-}
|
||||||
|
case "$dir" in "$PREFIX"*) ;; *) echo "kein CI-Cluster zu stoppen" ; exit 0 ;; esac
|
||||||
|
runuser -u postgres -- "$PGBIN/pg_ctl" -D "$dir/data" -m fast stop >/dev/null || true
|
||||||
|
rm -rf "$dir"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Aufruf: $0 start|stop" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in new issue
Block a user