forked from shopware5/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
240 lines (218 loc) · 6.98 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: "/certs"
MYSQL_ROOT_PASSWORD: app
MYSQL_USER: app
MYSQL_PASSWORD: app
MYSQL_DATABASE: shopware
GIT_STRATEGY: clone
GIT_DEPTH: 1
DB_USER: "app"
DB_PASSWORD: "app"
DB_HOST: "mysql"
DB_PORT: 3306
DB_NAME: shopware
SW_HOST: "localhost"
SW_BASE_PATH: ""
ELASTICSEARCH_HOST: elasticsearch
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
- if: '$CI_COMMIT_BRANCH'
stages:
- Static analysis
- Unit
- End-to-end testing
- Security
default:
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4
before_script:
- sed -i -e "s;__ROOT__;$CI_PROJECT_DIR;g" /etc/nginx/sites-enabled/shopware.conf
- /usr/bin/supervisord -c /etc/supervisord.conf &>/dev/null &
# https://gitlab.com/gitlab-org/gitlab-foss/-/issues/27921#note_38132416
- eval export DB_USER DB_PASSWORD DB_HOST DB_PORT DB_NAME SW_HOST SW_BASE_PATH ELASTICSEARCH_HOST
# Stage: static
PHP analyze:
tags:
- m5.large
stage: Static analysis
script:
- make init
- make check-code
services:
- name: mysql:5.7
alias: mysql
JavaScript analyze:
tags:
- t3.nano
stage: Static analysis
image: node:alpine
before_script:
- apk add --no-cache make bash
script:
- make install-theme-depencencies
- make check-js-code
Code Coverage:
tags:
- t3.medium
stage: Static analysis
script:
- make init
- php -d pcov.enabled=1 -d pcov.directory=$CI_PROJECT_DIR
vendor/bin/phpunit
--configuration tests/phpunit.xml.dist
--log-junit build/artifacts/phpunit.junit.xml
--colors=never
--exclude-group=elasticSearch,pcovAdapterBrokenTest
--coverage-clover=build/artifacts/phpunit.clover.xml
--coverage-cobertura=build/artifacts/phpunit-coverage-cobertura.xml
services:
- name: mysql:5.7
alias: mysql
artifacts:
paths:
- build/artifacts/*
expire_in: 1 week
reports:
junit: build/artifacts/phpunit.junit.xml
cobertura: build/artifacts/phpunit-coverage-cobertura.xml
# stage: Unit
.phpunit_base:
tags:
- t3.medium
stage: Unit
services:
- name: mysql:5.7
alias: mysql
script:
- make test-phpunit
artifacts:
expire_in: 1 week
reports:
junit: build/artifacts/test-log.xml
.phpunit_es_base:
tags:
- t3.medium
extends: .phpunit_base
stage: Elasticsearch
script:
- make init
- make test-phpunit-elasticsearch
artifacts:
expire_in: 1 week
reports:
junit: build/artifacts/test-log.xml
PHP 7.4:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4
stage: Unit
services:
- name: mysql:5.7
alias: mysql
PHP 8.0:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.0
stage: Unit
services:
- name: mysql:5.7
alias: mysql
PHP 8.1:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.1
stage: Unit
services:
- name: mysql:5.7
alias: mysql
MySQL 5.7:
extends: .phpunit_base
stage: Unit
services:
- name: mysql:5.7
alias: mysql
MySQL 8.0:
extends: .phpunit_base
stage: Unit
services:
- name: mysql:8.0.19
alias: mysql
command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password", "--sql-require-primary-key=ON" ]
MariaDB 10.1:
extends: .phpunit_base
stage: Unit
services:
- name: mariadb:10.1
alias: mysql
MariaDB 10.5:
extends: .phpunit_base
stage: Unit
services:
- name: mariadb:10.5
alias: mysql
# stage: Elasticsearch
Elasticsearch 7:
extends: .phpunit_es_base
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4
stage: Unit
services:
- name: mysql:8.0.19
alias: mysql
command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password" ]
- name: docker.elastic.co/elasticsearch/elasticsearch:7.9.1
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
#Elasticsearch 8:
# extends: .phpunit_es_base
# image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.4
# stage: Elasticsearch
# allow_failure: true
# services:
# - name: mysql:8.0.19
# alias: mysql
# command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]
# - name: docker.elastic.co/elasticsearch/elasticsearch:8.0.0-SNAPSHOT
# alias: elasticsearch
# command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
.mink_base:
tags:
- m5.large
extends: .phpunit_base
stage: End-to-end testing
artifacts:
when: always
expire_in: 1 week
paths:
- build/artifacts/**
- build/logs/**
reports:
junit: build/artifacts/mink/*.xml
script:
- apk add --no-cache sudo
- export SW_HOST=$(hostname -i)
- make init
- make prepare-mink
- chown -R www-data:www-data .
- sudo -E -u www-data vendor/bin/behat -vv --config=tests/Mink/behat.yml --format=pretty --out=std --format=junit --out=build/artifacts/mink --tags ${MINK_TAG}
services:
- name: selenium/standalone-chrome:84.0
alias: selenium
- name: mailhog/mailhog
alias: smtp
- name: mysql:8.0.19
alias: mysql
command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password" ]
Mink:
extends: .mink_base
image: "gitlab.shopware.com:5005/shopware/5/product/image/continuous:$IMAGE_TAG"
parallel:
matrix:
- IMAGE_TAG: [ '7.4', '8.0' ]
MINK_TAG: [ 'account', 'checkout1', 'checkout2', 'detail', 'listing', 'note', 'sitemap', 'misc', 'backend' ]
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $IMAGE_TAG != "8.0"'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: manual
allow_failure: true