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 824bc9c commit 1d94711
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions backend/.github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Backend CI Pipeline

# Trigger workflow on push or pull request to develop and main branches
on:
push:
branches:
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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

0 comments on commit 1d94711

Please sign in to comment.