Update db.py #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: self-hosted | |
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 backend/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: self-hosted | |
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 backend/requirements.txt | |
- name: Run tests with pytest | |
run: | | |
source venv/bin/activate | |
pytest backend/tests --maxfail=1 --disable-warnings -q |