diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml new file mode 100644 index 0000000..5e8d02b --- /dev/null +++ b/.github/workflows/backend-ci.yml @@ -0,0 +1,60 @@ +name: Backend CI Pipeline + +# Trigger workflow on push or pull request to develop and main branches +on: + push: + branches: + - develop + - main + pull_request: + branches: + - develop + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' # Adjust Python version if needed + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + + - 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 + + test: + runs-on: ubuntu-latest + needs: lint # Ensure this job runs after linting + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m venv venv + source venv/bin/activate + pip install -r requirements.txt + + - name: Run tests with pytest + run: | + source venv/bin/activate + pytest backend/tests --maxfail=1 --disable-warnings -q