-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (67 loc) · 2.25 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
name: Django CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Install Dependencies
working-directory: .
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt && pip install -r requirements-dev.txt
- name: Run Missing migrations test
working-directory: .
run: python manage.py makemigrations --check --dry-run
env:
DATABASE_URL: 'sqlite:///'
DJANGO_SETTINGS_MODULE: 'geninfo.settings.test'
- name: Generate secret key
run: echo '::set-output name=SECRET_KEY::`python -c "import uuid; print(uuid.uuid4().hex + uuid.uuid4().hex)"`'
id: secret-id-generator
shell: bash
- name: Run Prospector
working-directory: .
run: prospector -X
env:
DJANGO_SETTINGS_MODULE: 'geninfo.settings.test'
SECRET_KEY: ${{ steps.secret-id-generator.outputs.SECRET_KEY }}
- name: Run Check Deploy
run: python manage.py check --deploy --fail-level WARNING
working-directory: .
env:
SECRET_KEY: ${{ steps.secret-id-generator.outputs.SECRET_KEY }}
SENDGRID_API_KEY: foo
DEBUG: 0
SENDGRID_SANDBOX_MODE_IN_DEBUG: 0
DJANGO_SETTINGS_MODULE: 'geninfo.settings.production'
FROM_EMAIL: "teste@teste.com"
TO_EMAIL: "teste@teste.com"
shell: bash
- name: Run Tests
working-directory: .
run: python manage.py test
env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres'
DJANGO_SETTINGS_MODULE: 'geninfo.settings.test'
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5