Skip to content

Fixed issues detected by SonarQube in the backend #57

Fixed issues detected by SonarQube in the backend

Fixed issues detected by SonarQube in the backend #57

name: Backend Development
on:
push:
branches: ["backend"]
pull_request:
branches: ["main"]
workflow_dispatch:
jobs:
build:
name: Django tests
runs-on: ubuntu-latest
env:
POSTGRES_DB: aqbbtesting
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
services:
postgres_main:
image: postgres:13
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
max-parallel: 4
matrix:
python-version: [3.12, 3.13]
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- run: cat .env.github >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
env:
BACKEND_SERVICE_DEBUG_ENABLED: "0"
DB_NAME: ${{ env.POSTGRES_DB }}
DB_USER: ${{ env.POSTGRES_USER }}
DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
DB_HOST: ${{ env.POSTGRES_HOST }}
DB_PORT: ${{ env.POSTGRES_PORT }}
run: |
python manage.py collectstatic
python manage.py test