-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path.gitlab-ci.yml
120 lines (112 loc) · 2.48 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
.cache:
- .: &composer-cache
key:
prefix: composer-cache
files:
- composer.lock
paths:
- vendor/
policy: pull
stages:
- init
- lint
- analysis
- testing
# Install composer only once at the beginning, then only use the cached file
init:
image: registry.mallgroup.com/di/php:7.4-alpine
stage: init
cache:
key:
prefix: composer-cache
files:
- composer.lock
paths:
- vendor/
script:
- composer2 validate --strict
- composer2 install --prefer-dist --no-ansi --no-interaction
tags:
- docker
phpmd:
image: registry.mallgroup.com/di/php:7.4-alpine
stage: lint
needs:
- init
cache:
- *composer-cache
script:
- $(pwd)/vendor/bin/phpmd ./src text ./phpmd.xml
tags:
- docker
CS:
image: registry.mallgroup.com/di/php:7.4-alpine
stage: lint
needs:
- init
cache:
- *composer-cache
script:
- $(pwd)/vendor/bin/phpcs --standard=phpcs-ruleset.xml -d memory_limit=-1 --extensions=php --colors -sp ./src
only:
- branches
tags:
- docker
phpstan:
image: registry.mallgroup.com/di/php:7.4-alpine
stage: analysis
needs:
- init
cache:
- *composer-cache
- key: phpstan-cache
paths:
- tmp/phpstan
before_script:
- mkdir -p $(pwd)/tmp/phpstan
- touch $(pwd)/.env
script:
- $(pwd)/vendor/bin/codecept build
- $(pwd)/vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress --memory-limit=-1
only:
- branches
tags:
- docker
psalm:
image: registry.mallgroup.com/di/php:7.4-alpine
stage: analysis
needs:
- init
cache:
- *composer-cache
script:
- $(pwd)/vendor/bin/psalm
only:
- branches
tags:
- docker
unit-tests:
image: registry.mallgroup.com/di/php:7.4-extras
stage: testing
cache:
- *composer-cache
script:
- touch $(pwd)/.env # .env file must exist, even if envs are taken from environment and not .env file
- php $(pwd)/vendor/bin/codecept run unit --env dev --no-colors
only:
- branches
tags:
- docker
coverage:
image: registry.mallgroup.com/di/php:7.4-extras
stage: testing
cache:
- *composer-cache
script:
- touch $(pwd)/.env # .env file must exist, even if envs are taken from environment and not .env file
# run all codeception tests with coverage enabled
- php -d pcov.exclude="~vendor~" $(pwd)/vendor/bin/codecept run --env dev --coverage-xml --phpunit-xml --no-colors
only:
- branches
tags:
- docker