diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 64ce6d6..214a10e 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -135,19 +135,25 @@ jobs: docker build -f docker/Dockerfile --build-arg VERSION=0.0.0-ci --build-arg GIT_SHA="$(git rev-parse --short HEAD)" \ --label khaemhat-ci.job="$(hostname)" -t "$NAME:image" . - - name: Smoke test (/health/live, non-root user, PUID/PGID) + - name: Smoke test (start-up, login page, non-root user, PUID/PGID) run: | docker network create --label khaemhat-ci.job="$(hostname)" "$NAME" docker network connect "$NAME" "$(hostname)" + # Since M2 the instance needs a key, a super user and a first company; the key is thrown away with the run. docker run -d --name "$NAME-app" --network "$NAME" --label khaemhat-ci.job="$(hostname)" \ - -e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test -e PUID=99 -e PGID=100 "$NAME:image" - for i in $(seq 1 30); do - if curl -fsS --max-time 5 "http://$NAME-app:8080/health/live"; then echo; break; fi + -e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test \ + -e KHAEMHAT_SECRET_KEY="$(head -c 32 /dev/urandom | base64)" \ + -e KHAEMHAT_SUPERUSER=root -e KHAEMHAT_SUPERUSER_PASSWORD=Ci-Smoke-Test-2026 -e KHAEMHAT_COMPANY_CODE=CI \ + -e PUID=99 -e PGID=100 "$NAME:image" + for i in $(seq 1 60); do + if curl -fsS --max-time 5 "http://$NAME-app:8080/health/ready"; then echo; break; fi sleep 2 done curl -fsS --max-time 5 "http://$NAME-app:8080/health" echo - curl -fsS --max-time 5 "http://$NAME-app:8080/" | grep -q "in costruzione" + test "$(curl -s -o /dev/null -w '%{http_code}' --max-time 5 "http://$NAME-app:8080/")" = "302" + curl -fsS --max-time 5 "http://$NAME-app:8080/login" | grep -q "Accedi" + curl -fsS -D - -o /dev/null --max-time 5 "http://$NAME-app:8080/login" | grep -qi "content-security-policy" test "$(docker exec "$NAME-app" sh -c 'stat -c %u:%g /proc/1')" = "99:100" test "$(docker exec "$NAME-app" stat -c %u:%g /data)" = "99:100" docker exec "$NAME-app" pg_dump --version diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index df92991..0cefb8a 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -113,15 +113,18 @@ jobs: --label khaemhat-ci.job="$(hostname)" \ -t "$IMAGE:$VERSION" . - - name: Smoke test (/health/live) + - name: Smoke test (/health/ready) if: env.PUBLISHED != 'true' run: | docker network create --label khaemhat-ci.job="$(hostname)" "$NAME" docker network connect "$NAME" "$(hostname)" docker run -d --name "$NAME-app" --network "$NAME" --label khaemhat-ci.job="$(hostname)" \ - -e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test "$IMAGE:$VERSION" - for i in $(seq 1 30); do - if curl -fsS --max-time 5 "http://$NAME-app:8080/health/live"; then echo; break; fi + -e KHAEMHAT_SYSTEM_DB=sqlite:///data/system.db -e KHAEMHAT_LICENSE_MODE=test \ + -e KHAEMHAT_SECRET_KEY="$(head -c 32 /dev/urandom | base64)" \ + -e KHAEMHAT_SUPERUSER=root -e KHAEMHAT_SUPERUSER_PASSWORD=Ci-Smoke-Test-2026 -e KHAEMHAT_COMPANY_CODE=CI \ + "$IMAGE:$VERSION" + for i in $(seq 1 60); do + if curl -fsS --max-time 5 "http://$NAME-app:8080/health/ready"; then echo; break; fi sleep 2 done report="$(curl -fsS --max-time 5 "http://$NAME-app:8080/health")"