-
Notifications
You must be signed in to change notification settings - Fork 39
/
.gitlab-ci.yml
133 lines (124 loc) · 4.87 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
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: "tcp://docker:2375"
DOCKER_TLS_CERTDIR: "/certs"
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: app
MYSQL_PASSWORD: app
MYSQL_DATABASE: shopware
WEB_DOCUMENT_ROOT: $CI_PROJECT_DIR/
GIT_STRATEGY: clone
SHOPWARE_ENV: swagbackendordertest
CHECKOUT_SHOPWARE_BRANCH: "5.7"
PLUGIN_NAME: SwagBackendOrder
stages:
- Code Analysis
- PHPUnit
default:
tags:
- t3.medium
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4
services:
- name: mysql:5.7
alias: mysql
before_script:
- zip -rq plugin.zip .
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/5/product/shopware.git shopware --depth=1 -b ${CHECKOUT_SHOPWARE_BRANCH}
- curl --output ./SwagB2bPlugin.zip --location --header "PRIVATE-TOKEN:${BOT_API_TOKEN}" "https://gitlab.shopware.com/api/v4/projects/452/jobs/artifacts/minor-3.0/raw/build/SwagB2bPlugin.zip?job=Package%20Build"
- unzip -q plugin.zip -d shopware/custom/plugins/${PLUGIN_NAME}
- unzip -q SwagB2bPlugin.zip -d shopware/custom/plugins
- cd shopware
- cp .env.dist .env
- make init
- cp -r custom/plugins/${PLUGIN_NAME}/Tests/config_gitlab.php config.php
- php bin/console sw:plugin:refresh
- php bin/console sw:plugin:list
- php bin/console sw:plugin:install --activate cron
- php bin/console sw:plugin:install --activate ${PLUGIN_NAME}
- php bin/console sw:plugin:install --activate SwagB2bPlugin
- php bin/console sw:cache:clear
- /entrypoint supervisord &>/dev/null &
JavaScript analyze:
stage: Code Analysis
image: node:alpine
services: []
before_script:
- apk add --no-cache make bash zip unzip git
- zip -rq plugin.zip .
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/5/product/shopware.git shopware --depth=1 -b ${CHECKOUT_SHOPWARE_BRANCH}
- unzip -q plugin.zip -d shopware/custom/plugins/${PLUGIN_NAME}
script:
- cd shopware
- make .make.install.npm-dependencies
- cd custom/plugins/${PLUGIN_NAME}
- make check-eslint-backend
PHP analyze:
stage: Code Analysis
script:
- php bin/console -e production
- cd custom/plugins/${PLUGIN_NAME}
- >
if [ $CI_PIPELINE_SOURCE == "schedule" ]; then
sed -i "s|reportUnmatchedIgnoredErrors: true|reportUnmatchedIgnoredErrors: false|g" phpstan.neon
fi
- make fix-cs-dry
- make phpstan
Code Coverage:
stage: PHPUnit
needs: [ PHP analyze ]
script:
- cd custom/plugins/${PLUGIN_NAME}
- php -d pcov.enabled=1 -d pcov.directory=$CI_PROJECT_DIR
../../../vendor/bin/phpunit
--configuration phpunit.xml.dist
--log-junit build/artifacts/phpunit.junit.xml
--colors=never
--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+)?%)/'
artifacts:
paths:
- shopware/custom/plugins/${PLUGIN_NAME}/build/artifacts/*
reports:
junit: shopware/custom/plugins/${PLUGIN_NAME}/build/artifacts/phpunit.junit.xml
SW 5.6:
stage: PHPUnit
needs: [ PHP analyze ]
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.2
variables:
CHECKOUT_SHOPWARE_BRANCH: "5.6"
before_script: [ ]
script:
- zip -rq plugin.zip .
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.shopware.com/shopware/5/product/shopware.git shopware --depth=1 -b ${CHECKOUT_SHOPWARE_BRANCH}
- unzip -q plugin.zip -d shopware/custom/plugins/${PLUGIN_NAME}
- cd shopware
- ./psh.phar init --SW_HOST="localhost"
- cp -r custom/plugins/${PLUGIN_NAME}/Tests/config_gitlab.php config.php
- php bin/console sw:plugin:refresh
- php bin/console sw:plugin:list
- php bin/console sw:plugin:install --activate ${PLUGIN_NAME}
- php bin/console sw:cache:clear
- /entrypoint supervisord &>/dev/null &
- cd custom/plugins/${PLUGIN_NAME}
- php ../../../vendor/bin/phpunit
--configuration phpunit.xml.dist
--colors=never
services:
- name: mysql:5.7
alias: mysql
.SW 5.7 default:
stage: PHPUnit
needs: [PHP analyze]
script:
- cd custom/plugins/${PLUGIN_NAME}
- php ../../../vendor/bin/phpunit
--configuration phpunit.xml.dist
--colors=never
SW 5.7 PHP 7.4:
extends: .SW 5.7 default
only:
- master
SW 5.7 PHP 8.0:
extends: .SW 5.7 default
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.0