-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
90 lines (82 loc) · 2.66 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
stages:
- setup
- test
- ship
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
variables:
MYSQL_ROOT_PASSWORD: shopware
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: shopware
MYSQL_USER: shopware
MYSQL_PASSWORD: shopware
composer:
stage: setup
image: "edbizarro/gitlab-ci-pipeline-php:7.3"
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader
artifacts:
paths:
- vendor/
expire_in: 1 days
when: always
cache:
paths:
- vendor/
phpstan:
stage: test
image: "edbizarro/gitlab-ci-pipeline-php:7.3"
dependencies:
- composer
script:
- vendor/bin/phpstan analyse -l 3 -c phpstan.neon Test
codestyle:
stage: test
image: "edbizarro/gitlab-ci-pipeline-php:7.3"
dependencies:
- composer
script:
- vendor/bin/php-cs-fixer fix -v --dry-run
cache:
key: global
paths:
- .php_cs.cache
phpcpd:
stage: test
image: edbizarro/gitlab-ci-pipeline-php:7.2
script:
- test -f phpcpd.phar || curl -L https://phar.phpunit.de/phpcpd.phar -o phpcpd.phar
- php phpcpd.phar Test --min-lines=50
dependencies: []
cache:
paths:
- phpcpd.phar
phpunit:
image: "edbizarro/gitlab-ci-pipeline-php:7.3"
stage: test
services:
- mysql:5.7
dependencies:
- composer
script:
- sudo apt-get update && sudo apt-get install mysql-client -y
- git clone https://github.com/shopware/development "${CI_PROJECT_DIR}/opt/shopware"
- mv ${CI_PROJECT_DIR}/opt /tmp/opt
- cp -r ${CI_PROJECT_DIR} /tmp/opt/shopware/custom/plugins/${CI_PROJECT_NAME}
- mv /tmp/opt ${CI_PROJECT_DIR}/opt
- 'printf "const:\n APP_ENV: \"dev\"\n APP_URL: \"http://localhost\"\n DB_HOST: \"mysql\"\n DB_PORT: \"3306\"\n DB_NAME: \"${MYSQL_DATABASE}\"\n DB_USER: \"root\"\n DB_PASSWORD: \"${MYSQL_ROOT_PASSWORD}\"" > "${CI_PROJECT_DIR}/opt/shopware/.psh.yaml.override"'
- cd ${CI_PROJECT_DIR}/opt/shopware && php ${CI_PROJECT_DIR}/opt/shopware/psh.phar init
- cd ${CI_PROJECT_DIR}/opt/shopware && php ${CI_PROJECT_DIR}/opt/shopware/psh.phar demo-data
- php ${CI_PROJECT_DIR}/opt/shopware/bin/console plugin:refresh
- php ${CI_PROJECT_DIR}/opt/shopware/bin/console plugin:install --activate ${CI_PROJECT_NAME}
- cd ${CI_PROJECT_DIR}/opt/shopware/custom/plugins/${CI_PROJECT_NAME} && ${CI_PROJECT_DIR}/opt/shopware/vendor/bin/phpunit
zip:
stage: ship
image: "edbizarro/gitlab-ci-pipeline-php:7.3"
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader --no-dev
- zip -r ${CI_PROJECT_NAME}.zip . -x *.git*
artifacts:
paths:
- ${CI_PROJECT_NAME}.zip
expire_in: 1 week