Skip to content

Fixed flak8 erros

Fixed flak8 erros #6

Workflow file for this run

name: Python CI Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run linter
- name: Lint with flake8
run: |
pip install flake8
flake8 .
# Run tests with coverage
- name: Run tests with coverage
run: |
pip install pytest pytest-cov
pytest --cov=. --maxfail=5 --disable-warnings
# Upload coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # Add this token in your GitHub repository secrets
database:
runs-on: ubuntu-latest
steps:
# Set up SQLite test database
- name: Setup SQLite test database
run: |
sqlite3 test.db ".databases"
env:
DATABASE_URL: sqlite:///test.db
security:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3
# Run security checks with Bandit
- name: Run Bandit for security checks
run: |
pip install bandit
bandit -r ./ -o bandit-output.json -f json || true
- name: Fail on High Severity Bandit Issues
run: |
cat bandit-output.json | jq '.results[] | select(.issue_severity == "HIGH")' | grep . && exit 1 || true