Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
welpie21 committed Oct 14, 2024
1 parent fddcf26 commit b8e4879
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,38 @@ runs:
using: composite
steps:
- name: Install SurrealDB
shell: bash
run: curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --version ${{ inputs.surrealdb_version }}

- name: Run SurrealDB in Background
shell: bash
run: |
cd /usr/local/bin
nohup surreal start \
--u ${{ inputs.surrealdb_username }} \
--p ${{ inputs.surrealdb_password }} \
--allow-all &
- name: Wait for SurrealDB to start
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --version ${{ inputs.surrealdb_version }}
URL="http://localhost:8000/health"
MAX_ATTEMPTS=30
ATTEMPT=0
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" $URL)
if [ "$RESPONSE" -eq 200 ]; then
echo "SurrealDB instance is up and running, continuing..."
break
fi
ATTEMPT=$((ATTEMPT + 1))
sleep 1
done
if [ "$ATTEMPT" -ge "$MAX_ATTEMPTS" ]; then
echo "SurrealDB instance could not be contacted, aborting."
exit 1
fi

0 comments on commit b8e4879

Please sign in to comment.