forked from shopware5/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
212 lines (192 loc) · 6.54 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
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
stages:
- Static analysis
- Unit
- Elasticsearch
- E2E
- Security
default:
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3
before_script:
- sed -i -e "s;__ROOT__;$CI_PROJECT_DIR;g" /etc/nginx/sites-enabled/shopware.conf
- cat /etc/nginx/sites-enabled/shopware.conf
- /usr/bin/supervisord -c /etc/supervisord.conf &>/dev/null &
- sleep 1
# Stage: static
PHP analyze:
stage: Static analysis
script:
- ./psh.phar init
- chown -R www-data:www-data .
- composer req --dev phpunit/phpunit:~8.0 --update-with-all-dependencies
- ./psh.phar check-code
services:
- name: mysql:5.7
alias: mysql
artifacts:
reports:
junit: php-cs-fixer.xml
Code Coverage:
stage: Static analysis
script:
- ./psh.phar init --SW_HOST="localhost"
- chown -R www-data:www-data .
- composer req --dev phpunit/phpunit:~8.0 --update-with-all-dependencies
- 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-html build/artifacts/phpunit-coverage-html
--coverage-text=build/artifacts/phpunit-coverage-text
- cat build/artifacts/phpunit-coverage-text | sed -e '/\\Shopware\\.*/d' -e '/\s*Methods:\s*\d*/d'
coverage: '/^\s*Lines:\s*(\d+(?:\.\d+)?%)/'
services:
- name: mysql:5.7
alias: mysql
artifacts:
paths:
- build/artifacts/*
reports:
junit: build/artifacts/phpunit.junit.xml
# stage: Unit
.phpunit_base:
stage: Unit
services:
- name: mysql:5.7
alias: mysql
script:
- ./psh.phar init --SW_HOST="localhost"
- chown -R www-data:www-data .
- composer req --dev phpunit/phpunit:~8.0 --update-with-all-dependencies
- ./psh.phar unit-fast --SW_HOST="localhost"
artifacts:
reports:
junit: build/artifacts/test-log.xml
.phpunit_es_base:
extends: .phpunit_base
stage: Elasticsearch
script:
- ./psh.phar init --SW_HOST="localhost"
- chown -R www-data:www-data .
- composer req --dev phpunit/phpunit:~8.0 --update-with-all-dependencies
- ./psh.phar unit-elasticsearch --SW_HOST="localhost"
artifacts:
reports:
junit: build/artifacts/test-log.xml
PHP 7.2:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.2
stage: Unit
services:
- name: mysql:5.7
alias: mysql
PHP 7.3:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3
stage: Unit
services:
- name: mysql:5.7
alias: mysql
PHP 7.4:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.4
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
alias: mysql
command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]
MariaDB 10.1:
extends: .phpunit_base
stage: Unit
services:
- name: mariadb:10.1
alias: mysql
MariaDB 10.4:
extends: .phpunit_base
stage: Unit
services:
- name: mariadb:10.4
alias: mysql
# stage: Elasticsearch
Elasticsearch 6:
extends: .phpunit_es_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.2
stage: Elasticsearch
services:
- name: mysql:8.0
alias: mysql
command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]
- name: elastic/elasticsearch:6.3.0
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
Elasticsearch 7:
extends: .phpunit_es_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3
stage: Elasticsearch
services:
- name: mysql:8.0
alias: mysql
command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]
- name: elastic/elasticsearch:7.0.0
alias: elasticsearch
command: [ "bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node" ]
Mink:
extends: .phpunit_base
image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3
stage: E2E
artifacts:
when: always
paths:
- build/artifacts/**
- build/logs/**
reports:
junit: build/artifacts/mink/*.xml
script:
- curl -v localhost
- ./psh.phar init --SW_HOST="$(hostname -i)"
- chown -R www-data:www-data .
- ./psh.phar mink --SW_HOST="$(hostname -i)"
services:
- name: selenium/standalone-chrome:3.8.1
alias: selenium
- name: mailhog/mailhog
alias: smtp
- name: mysql:8.0
alias: mysql
command: ["mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password"]
RIPS security:
stage: Security
image: php:7.3-alpine
before_script: []
only:
variables:
- $RIPS_SCAN == "1"
script:
- apk add --no-cache libzip-dev && docker-php-ext-configure zip --with-libzip=/usr/include && docker-php-ext-install zip
- wget https://github.com/rips/rips-cli/releases/download/3.2.0/rips-cli.phar -O /usr/bin/rips-cli
- chmod 755 /usr/bin/rips-cli
- rips-cli rips:scan:start -p . -C 20 -a ${RIPS_APP_ID} -T ${CI_COMMIT_REF_NAME} --progress