-
Notifications
You must be signed in to change notification settings - Fork 1
98 lines (95 loc) · 2.5 KB
/
django.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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