-
Notifications
You must be signed in to change notification settings - Fork 28
/
.gitlab-ci.yml
164 lines (151 loc) · 4.04 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
image: hatsoftwares/lstu-test-ci:latest
stages:
- tags
- carton
- carton_bdd
- tests
variables:
POSTGRES_DB: lstu_db
POSTGRES_USER: lstu
POSTGRES_PASSWORD: lstu_pwd
MYSQL_DATABASE: lstu_db
MYSQL_USER: lstu
MYSQL_PASSWORD: lstu_pwd
MYSQL_ROOT_PASSWORD: root
before_script:
- if [[ $CI_JOB_NAME == "postgresql 3/3" ]]; then export PGPASSWORD=lstu_pwd; echo 'CREATE DATABASE lstu_minion WITH OWNER lstu;' | psql -h postgres -U lstu lstu_db; fi
- if [[ $CI_JOB_NAME == "mysql 3/3" ]]; then echo "CREATE DATABASE lstu_minion; GRANT ALL ON lstu_minion.* TO lstu@'%'; FLUSH PRIVILEGES;" | mysql -h mariadb -u root -proot; fi
### Jobs templates
##
#
.retry: &retry
retry: 2
except:
- tags
.carton_bdd_template: &carton_bdd_definition
<<: *retry
stage: carton_bdd
needs:
- carton
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- local/
policy: pull
artifacts:
paths:
- local.tar
expire_in: 3 hours
after_script:
- tar cf local.tar local/
.tests_template: &tests_definition
<<: *retry
stage: tests
parallel: 3
script:
- tar xf local.tar && rm local.tar
- export CI_JOB_NAME=$(echo $CI_JOB_NAME | sed -e 's@ .*@@')
- echo "Database $CI_JOB_NAME test $CI_NODE_INDEX on $CI_NODE_TOTAL"
- MOJO_CONFIG="t/${CI_JOB_NAME}${CI_NODE_INDEX}.conf" make test
- MOJO_CONFIG="t/${CI_JOB_NAME}${CI_NODE_INDEX}.conf" make cover
- MOJO_CONFIG="t/${CI_JOB_NAME}${CI_NODE_INDEX}.conf" make test-junit-output
coverage: '/Total.* (\d+\.\d+)$/'
artifacts:
reports:
junit: tap.xml
.sqlite_template: &sqlite_definition
<<: *tests_definition
needs:
- carton_sqlite
services:
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
.pg_template: &pg_definition
<<: *tests_definition
needs:
- carton_postgresql
services:
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
- name: postgres:9.6
alias: postgres
.mysql_template: &mysql_definition
<<: *tests_definition
needs:
- carton_mysql
services:
- name: rroemhild/test-openldap
alias: rroemhild-test-openldap
- name: mariadb:10.1
alias: mariadb
### Publish tag changelog
##
#
publish_changelog:
image: hatsoftwares/curl-jq:latest
stage: tags
script:
- export PROJECT_API_URL="https://framagit.org/api/v4/projects/${CI_PROJECT_ID}"
- export DESCRIPTION_URL="${PROJECT_API_URL}/repository/tags/${CI_COMMIT_TAG}/release"
- 'export HEADER="Private-Token: ${GITLAB_API_TOKEN}"'
- sed -n '/^'$CI_COMMIT_TAG'[[:space:]]/,/^[^\t]/p' CHANGELOG | sed -e 's/^[^\t].*//' -e 's/\t//g' | sed '/^[[:space:]]*$/d' > /tmp/text
- if [[ ! -z $GITLAB_API_TOKEN ]]; then curl -s --request POST --data-urlencode "description@/tmp/text" --header "${HEADER}" "${DESCRIPTION_URL}"; fi
only:
- tags
### Toot tag
##
#
pouet-it:
image: hatsoftwares/pouet-it-from-ci:latest
stage: tags
script:
- cd /opt/pouet-it-from-ci
- export project="$(echo $CI_PROJECT_NAME | perl -p -e 's/(?:^(.)|-(.))/\U$1\U$2/g')"
- export MESSAGE=$(echo -e "Je viens de sortir "'#'"${project} en version ${CI_COMMIT_TAG} !""\n${CI_PROJECT_URL}/tags/${CI_COMMIT_TAG}")
- carton exec ./pouet-it-from-ci.pl
only:
- tags
### Podcheck
##
#
podcheck:
<<: *retry
stage: carton
script:
- make podcheck
### Install common dependencies
##
#
carton:
<<: *retry
stage: carton
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- local/
script:
- carton install --deployment --without=sqlite --without=postgresql --without=mysql
### Install DB related dependencies
##
#
carton_sqlite:
<<: *carton_bdd_definition
script:
- carton install --deployment --without=postgresql --without=mysql
carton_postgresql:
<<: *carton_bdd_definition
script:
- carton install --deployment --without=sqlite --without=mysql
carton_mysql:
<<: *carton_bdd_definition
script:
- carton install --deployment --without=sqlite --without=postgresql
### Tests
##
#
sqlite:
<<: *sqlite_definition
postgresql:
<<: *pg_definition
mysql:
<<: *mysql_definition