Skip to content

Commit

Permalink
Improve build-health-check action
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov committed Nov 23, 2024
1 parent 61e896c commit 3061147
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/build-health-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,10 @@ jobs:
steps:
- uses: actions/[email protected]

- name: Build Docker image
run: docker build --tag n8n-shortlink:ci .
- name: Build test Docker image
run: docker build --tag n8n-shortlink:test .

# TODO: Replace `sleep 10`
- name: Run Docker container
- name: Run Docker container until health check
run: |
docker run --detach --publish 3001:3001 --name n8n-shortlink-ci n8n-shortlink:ci
sleep 10 # wait for container to start up
- name: Check health endpoint
run: |
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3001/health)
if [ $response -eq 200 ]; then
echo "Health check passed"
exit 0
else
echo "Health check failed with status code: $response"
exit 1
fi
docker run --detach --publish 3001:3001 --name test-container n8n-shortlink:test
timeout 20 bash -c 'until curl -s http://localhost:3001/health > /dev/null; do sleep 1; done'

0 comments on commit 3061147

Please sign in to comment.