This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
122 lines (112 loc) · 4.38 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
stages:
- setup
- test
- deploy
- package
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
variables:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: shopware
MYSQL_USER: shopware
MYSQL_PASSWORD: shopware
SHOPWARE_VERSION: "v5.6.0" # Tag
COMPOSER_COMMAND: "composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader"
setup:
stage: setup
image: "edbizarro/gitlab-ci-pipeline-php:7.2"
script:
- mkdir -p /tmp/opt
- git clone -b ${SHOPWARE_VERSION} https://github.com/shopware/shopware "/tmp/opt/shopware"
- cd /tmp/opt/shopware && ${COMPOSER_COMMAND}
- cp -r ${CI_PROJECT_DIR} /tmp/opt/shopware/custom/plugins/${CI_PROJECT_NAME} && cd /tmp/opt/shopware/custom/plugins/${CI_PROJECT_NAME} && ${COMPOSER_COMMAND}
- cd /tmp/opt/shopware && composer dump-autoload -d custom/plugins/${CI_PROJECT_NAME}
- cp -r /tmp/opt/shopware ${CI_PROJECT_DIR}/sw_dir
artifacts:
paths:
- "sw_dir"
expire_in: 1 days
when: always
codestyle:
stage: test
image: "edbizarro/gitlab-ci-pipeline-php:7.2"
needs:
- job: setup
artifacts: true
script:
- cd ${CI_PROJECT_DIR}/sw_dir/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/php-cs-fixer fix -v --dry-run
cache:
key: global
paths:
- .php_cs.cache
k10r-phpstan:
stage: test
image: "edbizarro/gitlab-ci-pipeline-php:7.2"
needs:
- job: setup
artifacts: true
script:
- cd ${CI_PROJECT_DIR}/sw_dir/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/phpstan analyse .
sw-phpstan:
stage: test
image: "edbizarro/gitlab-ci-pipeline-php:7.2"
needs:
- job: setup
artifacts: true
before_script:
- cd /tmp && git clone https://github.com/shopwareLabs/store-plugin-codereview.git && store-plugin-codereview && ${COMPOSER_COMMAND}
- cp -r /tmp/store-plugin-codereview/configs/phpstan/phpstan.neon.sw5 ${CI_PROJECT_DIR}/sw_dir/custom/plugins/${CI_PROJECT_NAME}/phpstan_sw.neon
script:
- cd ${CI_PROJECT_DIR}/sw_dir/custom/plugins/${CI_PROJECT_NAME} && vendor/bin/phpstan analyse -c phpstan_sw.neon -a vendor/autoload.php -a ../../../vendor/autoload.php .
shopware-validate:
allow_failure: true
image:
name: friendsofshopware/plugin-uploader:0.3.5
entrypoint: [ "/bin/sh", "-c" ]
stage: test
only:
- tags
- master
- /^fix.*$/
needs:
- job: setup
artifacts: true
before_script:
- rm -rf sw_dir
script:
- php /app/bin/pluginupload ext:zip . $CI_COMMIT_SHA
- php /app/bin/pluginupload ext:validate *$CI_COMMIT_SHA.zip
staging:
image: "edbizarro/gitlab-ci-pipeline-php:7.2"
stage: deploy
environment:
name: staging
url: https://unzer-sw5.kellerkinder.io
only:
- master
before_script:
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh -A [email protected] 'cd /var/www/share/unzer-sw5.kellerkinder.io/htdocs/custom/plugins/HeidelPayment && git pull && /var/www/share/unzer-sw5.kellerkinder.io/htdocs/bin/console sw:cache:clear && /var/www/share/unzer-sw5.kellerkinder.io/htdocs/bin/console sw:plugin:refresh && /var/www/share/unzer-sw5.kellerkinder.io/htdocs/bin/console sw:plugin:uninstall HeidelPayment && /var/www/share/unzer-sw5.kellerkinder.io/htdocs/bin/console sw:plugin:install --activate HeidelPayment && /var/www/share/unzer-sw5.kellerkinder.io/htdocs/bin/console sw:theme:cache:generate'
package:
image: kellerkinder/shopware-package-plugin:latest
stage: package
needs: []
only:
- tags
- master
- /^fix.*$/
script:
- package-plugin
artifacts:
paths:
- ${CI_PROJECT_NAME}.zip