forked from shopware/SwagPayPal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
181 lines (173 loc) · 7.05 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
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: 'tcp://docker:2375'
MYSQL_ROOT_PASSWORD: app
WEB_DOCUMENT_ROOT: $CI_PROJECT_DIR/development/public
DEVELOPMENT_BRANCH: 'master'
PLATFORM_BRANCH: 'master'
CMS_EXTENSION_BRANCH: '1.6-sw6.3.0.0'
RUN_IN_MR: 'true'
USE_DEPRECATED_PSALM_CONFIG: 'false'
stages:
- Static analysis
- Testing
default:
image: shopware/development:latest
before_script:
- zip -rq plugin.zip .
- git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/6/product/development.git --branch $DEVELOPMENT_BRANCH
- rm -rf development/platform
- git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/6/product/platform.git development/platform --branch $PLATFORM_BRANCH
- git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/6/services/cms-extensions.git development/custom/plugins/SwagCmsExtensions --branch $CMS_EXTENSION_BRANCH
- unzip -q plugin.zip -d development/custom/plugins/SwagPayPal
- cd development
- composer dump-autoload -d custom/plugins/SwagCmsExtensions
- cp -v dev-ops/gitlab/.psh.yaml.override .
- /entrypoint supervisord > /dev/null 2>&1 &
Check built JS files:
only:
refs:
- merge_requests
- master
stage: Static analysis
services:
- name: mysql:5.7
alias: mysql
script:
- ./psh.phar init
- php bin/console plugin:install --activate SwagPayPal
- ./psh.phar storefront:install-dependencies
- ./psh.phar administration:build
- ./psh.phar storefront:build
- cd $CI_PROJECT_DIR/development/custom/plugins/SwagPayPal
- >
if ! git diff --quiet --ignore-submodules HEAD --; then
echo "Built Javascript files differ. Update the dependencies and execute 'administration:build' and 'storefront:build' again";
git status;
exit 1;
else
echo "Everything ok"
exit 0;
fi
Static analyze:
stage: Static analysis
services:
- name: mysql:5.7
alias: mysql
script:
- ./psh.phar init
- php bin/console plugin:install --activate SwagPayPal
- cd $CI_PROJECT_DIR/development/custom/plugins/SwagPayPal
- >
if [ -f "../../../vendor/shopware/platform/easy-coding-standard.php" ];
then
php ../../../dev-ops/analyze/vendor/bin/ecs check --config=../../../vendor/shopware/platform/easy-coding-standard.php src tests
else
php ../../../dev-ops/analyze/vendor/bin/ecs check --config=../../../vendor/shopware/platform/easy-coding-standard.yml src tests
fi;
- php ../../../dev-ops/analyze/vendor/bin/ecs check --config=easy-coding-standard.yml
- composer dump-autoload
- php bin/phpstan-config-generator.php
- php ../../../dev-ops/analyze/vendor/bin/phpstan analyze --configuration phpstan.neon src tests
- >
if [[ $USE_DEPRECATED_PSALM_CONFIG = "false" ]];
then
php ../../../dev-ops/analyze/vendor/bin/psalm --config=psalm.xml --threads=$(nproc) --diff --show-info=false
else
php ../../../dev-ops/analyze/vendor/bin/psalm --config=psalm.deprecated.xml --threads=$(nproc) --diff --show-info=false
fi;
- cd $CI_PROJECT_DIR/development
- ./psh.phar administration:init --APP_ENV="dev"
- cd $CI_PROJECT_DIR/development/custom/plugins/SwagPayPal
- make administration-lint
- make storefront-lint
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$RUN_IN_MR == "true" && $CI_PIPELINE_SOURCE == "merge_request_event"'
parallel:
matrix:
- PLATFORM_BRANCH: '6.3.0.0'
DEVELOPMENT_BRANCH: '6.3.2.0'
USE_DEPRECATED_PSALM_CONFIG: 'true'
- PLATFORM_BRANCH: '6.3.1.0'
DEVELOPMENT_BRANCH: '6.3.2.0'
USE_DEPRECATED_PSALM_CONFIG: 'true'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: '6.3.2.0'
DEVELOPMENT_BRANCH: '6.3.2.0'
USE_DEPRECATED_PSALM_CONFIG: 'true'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: '6.3.3.0'
DEVELOPMENT_BRANCH: 'master'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: 'master'
DEVELOPMENT_BRANCH: 'master'
ToDos resolved:
only:
refs:
- merge_requests
- master
stage: Static analysis
allow_failure: true
script:
- cd $CI_PROJECT_DIR/development/custom/plugins/SwagPayPal
- if [[ -n $CI_COMMIT_BRANCH ]]; then bin/check-todos.sh $CI_COMMIT_BRANCH; else bin/check-todos.sh $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME; fi
PHPUnit Coverage (6.3.x.x dev):
only:
refs:
- merge_requests
- master
stage: Testing
services:
- name: mariadb:10.3
alias: mysql
script:
- ./psh.phar init
- php bin/console plugin:install --activate SwagPayPal
- php bin/console plugin:install --activate SwagCmsExtensions
- composer dump-autoload -d custom/plugins/SwagPayPal
- ./psh.phar init-test-databases
- php -d pcov.enabled=1 -d pcov.directory=$CI_PROJECT_DIR
vendor/bin/phpunit
--configuration custom/plugins/SwagPayPal/phpunit.xml.dist
--log-junit build/artifacts/phpunit.junit.xml
--colors=never
--coverage-clover build/artifacts/phpunit.clover.xml
--coverage-html build/artifacts/phpunit-coverage-html
--coverage-text
coverage: '/^\s*Lines:\s*(\d+(?:\.\d+)?%)/'
artifacts:
paths:
- development/build/artifacts/phpunit.clover.xml
reports:
junit: development/build/artifacts/phpunit.junit.xml
PHPUnit:
stage: Testing
services:
- name: mysql:5.7
alias: mysql
script:
- ./psh.phar init
- php bin/console plugin:install --activate SwagPayPal
- php bin/console plugin:install --activate SwagCmsExtensions
- ./psh.phar init-test-databases
- cd $CI_PROJECT_DIR/development/custom/plugins/SwagPayPal
- bin/phpunit.sh
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$RUN_IN_MR == "true" && $CI_PIPELINE_SOURCE == "merge_request_event"'
parallel:
matrix:
- PLATFORM_BRANCH: '6.3.0.0'
DEVELOPMENT_BRANCH: 'master'
- PLATFORM_BRANCH: '6.3.1.0'
DEVELOPMENT_BRANCH: 'master'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: '6.3.2.0'
DEVELOPMENT_BRANCH: '6.3.2.0'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: '6.3.3.0'
DEVELOPMENT_BRANCH: 'master'
RUN_IN_MR: 'false'
- PLATFORM_BRANCH: 'master'
DEVELOPMENT_BRANCH: 'master'