forked from shopware5/SwagImportExport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
111 lines (102 loc) · 3.71 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
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: swagimportexporttest
CHECKOUT_SHOPWARE_BRANCH: "5.7"
PLUGIN_NAME: SwagImportExport
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
interruptible: true
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}
- unzip -q plugin.zip -d shopware/custom/plugins/${PLUGIN_NAME}
- (cd shopware/custom/plugins/${PLUGIN_NAME} && composer install)
- cd shopware
- cp .env.dist .env
- composer update laminas/laminas-code
- composer config --no-plugins allow-plugins.phpstan/extension-installer true
- 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 ${PLUGIN_NAME}
- 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.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.2:
extends: .SW 5.7 default
image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.2
SW 5.7.4:
variables:
CHECKOUT_SHOPWARE_BRANCH: v5.7.4
extends: .SW 5.7 default