This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.gitlab-ci.yml
89 lines (84 loc) · 2.46 KB
/
.gitlab-ci.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
variables:
DOCKER_DRIVER: overlay2
PROJECT_NAME: reango
POSTGRES_DB: reango_db
POSTGRES_USER: reango_db_user
POSTGRES_PASSWORD: dbpassword
stages:
- test
- deploy
- post_deploy
test:
stage: test
image: ncrmro/adbase:alpine
services:
- postgres:9.6-alpine
- selenium/standalone-chrome:3.5.3
#- rabbitmq:3.6.10
variables:
DJANGO_SETTINGS_MODULE: reango.settings.testing
#DATABASE_URL: sqlite:///db.sqlite3
DATABASE_URL: postgres://reango_db_user:dbpassword@postgres:5432/reango_db
SELENIUM_HOST: http://selenium__standalone-chrome:4444/wd/hub
before_script:
- export DOCKER_CONTAINER_IP=`awk 'END{print $1}' /etc/hosts`
- pip3 install --cache-dir ./python_packages -r ./lib/deps/base.txt -r ./lib/deps/testing.txt
- yarn config set cache-folder ./yarn_cache
- yarn install
script:
# $(getconf _NPROCESSORS_ONLN) number of threads on alpine
#- yarn run test
#- coverage run manage.py test --noinput -v 3 --parallel=$(getconf _NPROCESSORS_ONLN) --tag=unit $LOCAL_APPS
- coverage run manage.py test --noinput -v 3 --parallel=$(getconf _NPROCESSORS_ONLN) --liveserver=$DOCKER_CONTAINER_IP:8081-8179 $LOCAL_APPS
after_script:
- coverage combine
- coverage report
coverage: '/TOTAL\s+\d+\s+\d+\s+\d+\s+\d+\s+(\d{1,3}\%)/'
artifacts:
paths:
- screenshots/
when: always
expire_in: 1 week
cache:
paths:
- yarn_cache/
- python_packages/
deploy_staging:
image: ruby:2.2
stage: deploy
environment:
name: staging
url: https://staging-reango.herokuapp.com/
script:
- gem install dpl
- dpl --provider=heroku --app=staging-reango --api-key=$HEROKU_API_KEY
post_deploy_staging:
image: node:8.3.0
stage: post_deploy
environment:
name: staging
url: https://staging-reango.herokuapp.com/
script:
- yarn config set cache-folder ./yarn_cache
- yarn global add heroku-cli
# - npm install heroku-cli -g
- heroku pg:reset --app staging-reango -c staging-reango
- heroku run --app staging-reango python3 ./manage.py migrate
- heroku run --app staging-reango python3 ./manage.py stagedata --noinput --staging
cache:
paths:
- yarn_cache/
deploy_prod:
image: ruby:2.2
stage: deploy
script:
- echo "Deploy to production server"
environment:
name: production
url: https://jtronics.exchange
script:
- gem install dpl
- dpl --provider=heroku --app=reango --api-key=$HEROKU_API_KEY
#when: manual
only:
- master