Skip to content

Commit

Permalink
Update backend-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pdr21001 authored Apr 24, 2025
1 parent 1d94711 commit 8294fba
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions backend/.github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
test:
runs-on: self-hosted
needs: lint
needs: lint # Ensure this job runs after linting

steps:
- name: Checkout repository
Expand All @@ -53,15 +53,22 @@ jobs:
source venv/bin/activate
pip install -r backend/requirements.txt
- name: Start API server in background
- name: Start the API server
run: |
source venv/bin/activate
nohup python backend/main.py > server.log 2>&1 &
sleep 5
nohup python backend/main.py & # Start the API server in the background
# Wait for the server to be ready
for i in {1..10}; do
if curl --silent --fail http://127.0.0.1:5000/; then
echo "Server is up and running."
break
fi
echo "Waiting for server to start... Attempt $i/10"
sleep 3
done
- name: Run tests with pytest
env:
BASE_URL: http://127.0.0.1:5000
BASE_URL: http://127.0.0.1:5000 # Assuming your API is running on this address
run: |
source venv/bin/activate
pytest backend/tests --maxfail=1 --disable-warnings -q

0 comments on commit 8294fba

Please sign in to comment.