-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
94 lines (88 loc) · 1.91 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
90
91
92
93
94
stages:
- test
- lint
- deploy
variables:
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: normal
test:
stage: test
image: python:3.8
variables:
DJANGO_SETTINGS_MODULE: swp.settings.test
ENVIRONMENT: test
SECRET_KEY: this-is-not-a-secret-key
DATABASE_HOST: postgres
ELASTICSEARCH_HOSTNAME: elasticsearch
ELASTICSEARCH_PORT: 9200
ELASTICSEARCH_PASSWORD: elastic
ELASTICSEARCH_VERIFY_CERTS: f
tags:
- docker
services:
- name: postgres:11
variables:
POSTGRES_DB: swp
POSTGRES_USER: swp
POSTGRES_PASSWORD: swp
- name: elasticsearch:8.4.3
variables:
discovery.type: single-node
ELASTIC_PASSWORD: elastic
before_script:
- apt update && apt install -y gettext
- pip install -U pip coverage
- pip install -Ur requirements.txt
- python manage.py search_index --create
script:
- python manage.py generate-schemes
- coverage run manage.py test --noinput
- coverage report
artifacts:
paths:
- swp/assets/schemes
expire_in: 30 minutes
lint:
stage: lint
image: node:10
tags:
- docker
dependencies:
- test
before_script:
- npm install
script:
- npm run eslint
- npm run stylelint
.deploy_template: &deploy_definition
stage: deploy
image: registry.cosmocode.de/cosmocode/fabfileng:latest
tags:
- docker
before_script:
- mkdir ~/.ssh; chmod 0700 ~/.ssh
- echo "$PRIVATE_DEPLOY_KEY" > ~/.ssh/id_rsa && chmod 0400 ~/.ssh/id_rsa
- cp /fabfile.py $PWD
script:
- fab deploy
deploy_production:
<<: *deploy_definition
environment:
name: production
url: https://production.swp.cosmoco.de
tags:
- docker
- always_on
only:
- production
deploy_staging:
<<: *deploy_definition
environment:
name: staging
url: https://staging.swp.cosmoco.de
tags:
- docker
- always_on
only:
- master
- staging