Skip to content

Create test.yml

Create test.yml #4

Workflow file for this run

name: test
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: prepare .env
run: cp env.sample .env
- name: Build the Docker image
run: docker compose up -d
- name: Wait for HTTP 200 response
run: |
URL="https://localhost:7007"
TIMEOUT=240
SLEEP=5
start_time=$(date +%s)
while [ $(( $(date +%s) - start_time )) -lt $TIMEOUT ]; do
if [ "$(curl -o /dev/null -s -w '%{http_code}' $URL)" -eq 200 ]; then
echo "HTTP 200 OK"
exit 0
fi
curl $URL
echo "Waiting for HTTP 200..."
sleep $SLEEP
done
echo "Timeout exceeded"
exit 1