add CI quality gates

This commit is contained in:
2026-09-06 18:34:15 +03:00
parent efd5f7cce1
commit b10546b81a
2 changed files with 43 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
name: Quality gates
on:
push:
pull_request:
jobs:
test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
- run: npm run build
container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build production image
run: docker build --tag ihaleist:ci .
- name: Validate nginx configuration
run: docker run --rm ihaleist:ci nginx -t
- name: Validate container health
run: |
set -eu
cid=$(docker run -d -p 18080:80 -e NODE_ENV=production -e AUTH_SECRET=$(openssl rand -hex 32) ihaleist:ci)
cleanup() { docker rm -f "$cid" >/dev/null 2>&1 || true; }
trap cleanup EXIT
for attempt in $(seq 1 30); do
if curl --fail --silent http://127.0.0.1:18080/api/health; then exit 0; fi
sleep 1
done
echo 'Container health endpoint did not become ready' >&2
exit 1