/
.gitlab-ci.yaml
70 lines (60 loc) · 1.72 KB
/
.gitlab-ci.yaml
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
# # as well as the Ruby container and available within each.
stages:
- test
- build
build:
stage: build
image:
name: docker:latest
services:
- name: docker:dind
variables:
TEST_IMAGE: 192.168.1.249:5050/h.kiptoo/samar-insurance:$CI_COMMIT_REF_NAME
RELEASE_IMAGE: 192.168.1.249:5050/h.kiptoo/samar-insurance:latest
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" 192.168.1.249:5050 --password-stdin
script:
- docker build --pull -t $TEST_IMAGE -f docker/Dockerfile .
- docker push $TEST_IMAGE
only:
- develop
- master
test:
stage: test
image:
name: python:3.7
variables:
LC_ALL: "C.UTF-8"
LANG: "C.UTF-8"
WORKON_HOME: .pipenv/venvs
PIPENV_CACHE_DIR: .pipenv/pipcache
POSTGRES_DB: "my_custom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "example"
DB_NAME: "my_custom_db"
DB_USER: "postgres"
DB_HOST: "db"
DB_PASSWORD: "example"
PGDATA: "/var/lib/postgresql/data"
SECRET_KEY: "very-secret-key"
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums"
services:
- name: postgres:12
alias: db
# Make sure gitlab-ci knows to always cache the .pipenv path
cache:
key: pipenv
paths:
- .pipenv
before_script:
- pip install pipenv
- pip install --user pipenv
- pipenv install
script:
- pipenv run coverage run --source=app manage.py test --verbosity=2
- pipenv run coverage report -m
- pipenv run coverage-badge
coverage: "/TOTAL.+ ([0-9]{1,3}%)/"
artifacts:
reports:
codequality: gl-code-quality-report.json