Skip to content

Commit a223875

Browse files
authored
added postsql config
1 parent a2025fb commit a223875

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/django.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@ name: Django CI
33
on:
44
push:
55
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
86

97
jobs:
108
build:
119

1210
runs-on: ubuntu-latest
11+
services:
12+
postgres: # we need a postgres docker image to be booted a side car service to run the tests that needs a db
13+
image: postgres
14+
env: # the environment variable must match with app/settings.py if block of DATBASES variable otherwise test will fail due to connectivity issue.
15+
POSTGRES_USER: postgres
16+
POSTGRES_PASSWORD: postgres
17+
POSTGRES_DB: github-actions
18+
ports:
19+
- 5432:5432 # exposing 5432 port for application to use
20+
# needed because the postgres container does not provide a healthcheck
21+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
22+
1323
strategy:
1424
max-parallel: 4
1525
matrix:
@@ -25,6 +35,11 @@ jobs:
2535
run: |
2636
python -m pip install --upgrade pip
2737
pip install -r requirements.txt
38+
- name: Lint with flake8
39+
run: |
40+
pip install flake8
41+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
42+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2843
- name: Run Tests
2944
run: |
3045
python manage.py test

0 commit comments

Comments
 (0)