Skip to content

Merge pull request #43 from cztomsik/claude/audit-outdated-docs-011CU… #244

Merge pull request #43 from cztomsik/claude/audit-outdated-docs-011CU…

Merge pull request #43 from cztomsik/claude/audit-outdated-docs-011CU… #244

Workflow file for this run

name: Build
on:
- push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/[email protected]
with:
version: 0.15.2
- run: zig build test --summary all
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/[email protected]
with:
version: 0.15.2
- name: Check examples
run: |
ROOT_DIR=$(pwd)
for example in {hello,hello_app,blog,todos_orm_sqlite}; do
EXAMPLE_DIR="$ROOT_DIR/examples/$example/"
echo "Testing $example"
cd "$EXAMPLE_DIR"
zig build
./zig-out/bin/$example &
SERVER_PID=$!
timeout=15
while ! nc -z 127.0.0.1 8080; do
echo "Waiting for server..."
sleep 1
timeout=$((timeout - 1))
if [ $timeout -le 0 ]; then
echo "$EXAMPLE_DIR did not start within 15 seconds."
exit 1
fi
done
URL="http://127.0.0.1:8080"
if [[ "$example" == "todos_orm_sqlite" ]]; then
URL="http://127.0.0.1:8080/todo"
fi
echo "GET $URL"
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" $URL || echo "failed")
echo "Killing process for $example..."
kill -TERM $SERVER_PID 2>/dev/null || true
# Check the result
if [[ "$HTTP_STATUS" == "200" ]]; then
echo "$example: OK"
else
echo "$example: Failed with status $HTTP_STATUS"
exit 1
fi
done