-
Notifications
You must be signed in to change notification settings - Fork 39
56 lines (52 loc) · 1.53 KB
/
test.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
name: Tests
on: [push, pull_request]
env:
DJANGO_SETTINGS_MODULE: gymkhana.settings
DJANGO_SECRET_KEY: "q$o5mx19x9(9_^rzqf@o@s^t%t!ghix7($f9ymy49_^ryzq9x9"
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: gymkhanauser
POSTGRES_PASSWORD: password
POSTGRES_DB: gymkhanadb
ports:
# will assign a random free host port
- 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
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.6
uses: actions/setup-python@v1
with:
python-version: 3.6
- name: Setup environment variables
run: |
cp .env.example .env
- name: Install dependencies
run: |
sudo apt-get install libpq-dev
pip3 install coveralls
pip3 install pipenv
pipenv install --dev
- name: Linting
working-directory: ./src
run: |
source "$(pipenv --venv)"/bin/activate
flake8 .
- name: Migrations
working-directory: ./src
run: |
source "$(pipenv --venv)"/bin/activate
python3 manage.py makemigrations
python3 manage.py migrate
- name: Coverage
working-directory: ./src
run: |
source "$(pipenv --venv)"/bin/activate
pip3 install coverage
coverage run --source='.' manage.py test