Refactor project structure #101
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: Django CI | |
on: [ push, pull_request ] | |
jobs: | |
# | |
# Security | |
# | |
bandit: | |
name: Check for security issues with Bandit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
pip install -r requirements/ci.txt | |
- name: Run Bandit | |
run: | | |
bandit -r src/articles/ -x tests | |
bandit -r src/scraper/ -x tests | |
# | |
# Tests | |
# | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: ['3.11'] | |
services: | |
db: | |
image: postgres | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
--name postgres | |
steps: | |
- uses: actions/checkout@v3 | |
- 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/ci.txt | |
- name: Run tests | |
env: | |
SECRET_KEY: dummy | |
DJANGO_ENV: BASE | |
SECURE_SSL_REDIRECT: False | |
run: | | |
pytest src/articles/tests/unit/ | |
pytest src/articles/tests/integration/ | |
pytest src/scraper/tests/ | |
# | |
# Migrations | |
# | |
migrations: | |
name: Check for model changes not present in the migrations | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
--name postgres | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
pip install -r requirements/ci.txt | |
- name: Run manage.py makemigrations --check --dry-run | |
run: | | |
python manage.py makemigrations --check --dry-run | |
env: | |
SECRET_KEY: dummy | |
DJANGO_ENV: BASE |