Readiness Probe on AlphaGomoku Server #30067
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Readiness Probe on AlphaGomoku Server | |
on: | |
schedule: | |
- cron: '*/10 * * * *' # Run every 10 minutes | |
workflow_dispatch: | |
jobs: | |
readiness_probe: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Readiness | |
run: | | |
timeout 10s curl -s -o /dev/null -w "%{http_code}" ${{ env.ALPHAGOMOKU_ENDPOINT_READY }} | |
response_code=$? | |
if [ $response_code -eq 0 ]; then | |
echo "Readiness check passed." | |
expected_response=$(curl -s ${{ env.ALPHAGOMOKU_ENDPOINT_READY }}) | |
expected_json='{"message":"alphagomoku","status":"200"}' | |
if [[ "$expected_response" == *"$expected_json"* ]]; then | |
echo "Expected response received." | |
else | |
echo "Unexpected response received." | |
exit 1 | |
fi | |
elif [ $response_code -eq 124 ]; then | |
echo "Readiness check timed out after 1 minute." | |
exit 1 | |
else | |
echo "Readiness check failed. Status code: $response_code" | |
exit 1 | |
fi | |
env: | |
ALPHAGOMOKU_ENDPOINT_READY: https://alphagomoku.onrender.com/ready |