From 1d947119ae14958cf8a6eb5a662325eb73c8b8a1 Mon Sep 17 00:00:00 2001 From: Prince D Rusweka Rwabongoya Date: Wed, 23 Apr 2025 20:05:57 -0400 Subject: [PATCH] Update backend-ci.yml --- backend/.github/workflows/backend-ci.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/backend/.github/workflows/backend-ci.yml b/backend/.github/workflows/backend-ci.yml index 607d9b2..e387e6b 100644 --- a/backend/.github/workflows/backend-ci.yml +++ b/backend/.github/workflows/backend-ci.yml @@ -1,6 +1,5 @@ name: Backend CI Pipeline -# Trigger workflow on push or pull request to develop and main branches on: push: branches: @@ -22,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.11' # Adjust Python version if needed + python-version: '3.11' - name: Install dependencies run: | @@ -33,11 +32,11 @@ jobs: - name: Run pylint on Python code run: | source venv/bin/activate - pylint backend/main.py backend/db.py backend/init_db.py # Add more files as needed + pylint backend/main.py backend/db.py backend/init_db.py test: runs-on: self-hosted - needs: lint # Ensure this job runs after linting + needs: lint steps: - name: Checkout repository @@ -54,15 +53,15 @@ jobs: source venv/bin/activate pip install -r backend/requirements.txt - - name: Start the API server + - name: Start API server in background run: | - # Start the API server in the background - nohup python backend/main.py & # Replace with the command to start your API - sleep 5 # Wait for the server to be ready (adjust this if needed) + source venv/bin/activate + nohup python backend/main.py > server.log 2>&1 & + sleep 5 - name: Run tests with pytest env: - BASE_URL: http://127.0.0.1:5000 # Assuming your API is running on this address + BASE_URL: http://127.0.0.1:5000 run: | source venv/bin/activate pytest backend/tests --maxfail=1 --disable-warnings -q