-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
107 lines (97 loc) · 2.24 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
95
96
97
98
99
100
101
102
103
104
105
106
107
stages:
- test
- build_image
- system_test
- upload
- upload_tag
- clean
.gitlab_template: &gitlab_registry
before_script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
after_script:
- docker logout $CI_REGISTRY
.env_template: &prepare_env
before_script:
- yum install -y epel-release
- yum install -y python-devel python-pip mariadb-devel gcc-c++.x86_64
- pip install -r requirements.txt
test:install:
<<: *prepare_env
stage: test
image: centos:7
script:
- yum install -y wget curl locate libtool make m4 net-tools bash-completion \
openssl-devel mysql db4-devel libdb-cxx-devel \
protobuf-devel boost-devel python-devel
tags:
- docker
test:unit_test:
<<: *prepare_env
stage: test
image: centos:7
script:
- cd oss_server
- cp oss_server/settings/setting.py.default oss_server/settings/setting.py
- ./manage.py test --settings=oss_server.settings.test
tags:
- docker
test:functional_test:
stage: test
image: centos:7
script:
- echo "functional/integration test"
tags:
- docker
build_image:
stage: build_image
script:
- git clone git@gitlab.com:Cepave/DockerCompose-Gcoin.git
- bash ./DockerCompose-Gcoin/build.sh -p oss
tags:
- shell
only:
- master
- tags
system_test:
stage: system_test
script:
- echo "system test with image"
tags:
- shell
only:
- master
- tags
upload_image:
<<: *gitlab_registry
stage: upload
script:
- docker tag vchain-oss $CI_REGISTRY_IMAGE:${CI_BUILD_REF:0:8}
- docker push $CI_REGISTRY_IMAGE:${CI_BUILD_REF:0:8}
- docker rmi $CI_REGISTRY_IMAGE:${CI_BUILD_REF:0:8}
tags:
- shell
only:
- master
upload_tag_image:
<<: *gitlab_registry
stage: upload_tag
script:
- docker tag vchain-oss $CI_REGISTRY_IMAGE
- docker push $CI_REGISTRY_IMAGE
- docker rmi $CI_REGISTRY_IMAGE
- docker tag vchain-oss $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
- docker push $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
- docker rmi $CI_REGISTRY_IMAGE:$CI_BUILD_TAG
tags:
- shell
only:
- tags
clean_image:
stage: clean
script:
- docker rmi vchain-oss ; exit 0
tags:
- shell
only:
- master
- tags