Skip to content

Commit 8e41ae5

Browse files
authored
Merge pull request #12 from weswil07/ci-config
Add github actions config, remove travis config.
2 parents 128bba5 + 7c32517 commit 8e41ae5

4 files changed

Lines changed: 62 additions & 28 deletions

File tree

.github/workflows/tests.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
# TODO: See if we want to limit this scope to specified repos/forks
4+
on: [push, pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
10+
services:
11+
postgres:
12+
# Docker hub postgres image
13+
image: postgres
14+
# Postgres env vars
15+
env:
16+
POSTGRES_USER: postgres
17+
POSTGRES_PASSWORD: postgres
18+
POSTGRES_DB: test_jsonate
19+
# map port on service container to port on docker host
20+
ports:
21+
- 5432:5432
22+
# Set health checks to wait until postgres has started
23+
options: >-
24+
--health-cmd pg_isready
25+
--health-interval 10s
26+
--health-timeout 5s
27+
--health-retries 5
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
32+
- name: Set up Python
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: 3.8
36+
37+
- name: psycopg2 prerequisites
38+
run: sudo apt-get install libpq-dev
39+
40+
- name: install python dependencies
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install -r requirements.txt
44+
45+
- name: execute tests
46+
run: |
47+
python test_project/manage.py makemigrations --dry-run --check
48+
python test_project/manage.py test test_app

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
/jsonate.egg-info/
77
/dist/
88
.idea
9-
build
9+
build
10+
*~

.travis.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

test_project/settings.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
}
1818
}
1919

20+
if os.environ.get('GITHUB_WORKFLOW'):
21+
DATABASES = {
22+
'default': {
23+
'ENGINE': 'django.db.backends.postgresql',
24+
'NAME': 'test_jsonate',
25+
'USER': 'postgres',
26+
'PASSWORD': 'postgres',
27+
'HOST': '127.0.0.1',
28+
'PORT': '5432',
29+
}
30+
}
31+
2032
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
2133
MEDIA_URL = '/media/'
2234

0 commit comments

Comments
 (0)