ci: smoke-test image without binding a host port
Continuous Integration / lint-and-test (push) Successful in 13s
Continuous Integration / docker-build-and-push (push) Successful in 37s

This commit is contained in:
Lucas Winther committed 2026-09-29 19:59:20 +02:00
1 parent eea868c422
commit 4905986292
1 file changed
+20 -8
+20 -8
View File
@@ -70,12 +70,24 @@ jobs:
run: |
image="$(printf '%s\n' "$PUBLISHED_TAGS" | head -n 1)"
docker pull "$image"
docker run -d --rm -p 3000:3000 --name budget2-ci "$image"
docker run -d --rm --name budget2-ci "$image"
trap 'docker stop budget2-ci' EXIT
for i in $(seq 1 30); do
if curl -fsS http://localhost:3000/ > /dev/null; then break; fi
sleep 1
done
curl -fsS http://localhost:3000/ | grep -q "Budget"
curl -fsS http://localhost:3000/sw.js > /dev/null
curl -fsS http://localhost:3000/manifest.webmanifest > /dev/null
docker exec budget2-ci bun -e '
const base = "http://127.0.0.1:3000";
let ready = false;
for (let attempt = 0; attempt < 30; attempt++) {
try {
const response = await fetch(base + "/");
if (response.ok && (await response.text()).includes("Budget")) {
ready = true;
break;
}
} catch {}
await Bun.sleep(1000);
}
if (!ready) throw new Error("App did not serve its HTML");
for (const path of ["/sw.js", "/manifest.webmanifest"]) {
const response = await fetch(base + path);
if (!response.ok) throw new Error(`${path} returned ${response.status}`);
}
'