-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitbucket-pipelines.yml
226 lines (221 loc) · 10.9 KB
/
bitbucket-pipelines.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
image: heptacom/heptaconnect-pipeline:php83-8.0.0
definitions:
partials:
- step: &php84-image
# TODO wait for PHP 8.4 and provide the actual image
image: heptacom/heptaconnect-pipeline:php83-8.0.0
services:
mysql:
image: mysql:8.0
variables:
MYSQL_DATABASE: 'pipelines'
MYSQL_ROOT_PASSWORD: 'let_me_in'
MYSQL_USER: 'test_user'
MYSQL_PASSWORD: 'let_me_in_as_well'
steps:
- step: &default-step
caches:
- composer
services:
- mysql
after-script:
- cp -a .build test-results
- find test-results -type f -name '*.xml' -exec sed -i .bak -e "s|`pwd`/||" {} +
- 'test ${BITBUCKET_EXIT_CODE} -eq 0 || composer config --list'
- step: &github-keyword-gate-step
<<: *default-step
name: Github Keyword Gate
script:
- 'test $(git --no-pager log --full-history "--grep=${GITHUB_GREP_DENY_PATTERN}" | wc -l) -eq 0'
- 'test $(git --no-pager log --full-history -S "${GITHUB_GREP_DENY_PATTERN}" --pickaxe-all --pickaxe-regex --oneline | wc -l) -eq 0'
after-script:
- 'test ${BITBUCKET_EXIT_CODE} -eq 0 || git --no-pager log --full-history "--grep=${GITHUB_GREP_DENY_PATTERN}"'
- 'test ${BITBUCKET_EXIT_CODE} -eq 0 || git --no-pager log --full-history -S "${GITHUB_GREP_DENY_PATTERN}" --pickaxe-all --pickaxe-regex --oneline'
- step: &github-mirror-branch
<<: *default-step
name: Mirror to Github
script:
- git fetch --unshallow origin
- git remote add github "[email protected]:HEPTACOM/${BITBUCKET_REPO_SLUG}.git"
- git push --force github ${BITBUCKET_BRANCH}
- step: &github-mirror-tag
<<: *default-step
name: Mirror tags to Github
script:
- git remote add github "[email protected]:HEPTACOM/${BITBUCKET_REPO_SLUG}.git"
- git push --force github tag "${BITBUCKET_TAG}"
- step: &composer-high-install
<<: *default-step
name: Install (High dependencies)
artifacts:
- .build/**
- composer.lock
- setup-vendor.sh
script:
- make clean
- COMPOSER_EXTRA_ARGS=-vvv make -e vendor
- make .build
- mv vendor .build/vendor-high
- echo 'mkdir -p vendor; rm -rf vendor; mv .build/vendor-high vendor' > setup-vendor.sh
- step: &composer-low-install
<<: *default-step
name: Install (Low dependencies)
artifacts:
- .build/**
- composer.lock
- setup-vendor.sh
script:
- make clean
- composer update --prefer-lowest --prefer-stable
- COMPOSER_EXTRA_ARGS=-vvv make -e vendor
- make .build
- mv vendor .build/vendor-low
- echo 'mkdir -p vendor; rm -rf vendor; mv .build/vendor-low vendor' > setup-vendor.sh
- step: &test-coverage-high-install-84
<<: *php84-image
name: Install and Unit test (8.4 + High dependencies)
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO [email protected] IDENTIFIED BY "let_me_in_as_well";'
- mysql -utest_user -plet_me_in_as_well -h127.0.0.1 -e 'CREATE DATABASE pipelines_high81;'
- make clean
- GLOBAL_REPOSITORIES_DIR=`pwd`/.build/private-composer composer-repository
- DATABASE_URL='mysql://root:[email protected]/pipelines_high81' COMPOSER_EXTRA_ARGS=-vvv make -e coverage
- step: &test-coverage-low-install-84
<<: *php84-image
name: Install and Unit test (8.4 + Low dependencies)
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO [email protected] IDENTIFIED BY "let_me_in_as_well";'
- mysql -utest_user -plet_me_in_as_well -h127.0.0.1 -e 'CREATE DATABASE pipelines_low81;'
- make clean
- GLOBAL_REPOSITORIES_DIR=`pwd`/.build/private-composer composer-repository
- composer update --prefer-lowest --prefer-stable
- DATABASE_URL='mysql://root:[email protected]/pipelines_low81' COMPOSER_EXTRA_ARGS=-vvv make -e coverage
- step: &test-coverage
<<: *default-step
name: Test coverage
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO [email protected] IDENTIFIED BY "let_me_in_as_well";'
- mysql -utest_user -plet_me_in_as_well -h127.0.0.1 -e 'CREATE DATABASE pipelines_covr;'
- bash setup-vendor.sh
- DATABASE_URL='mysql://root:[email protected]/pipelines_covr' XDEBUG_MODE=coverage COMPOSER_EXTRA_ARGS=-vvv make -e coverage
- step: &test-code-style-php
<<: *default-step
name: ECS (Code style)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-php
- step: &test-code-style-phpstan
<<: *default-step
name: PHPStan (Static code analysis)
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-phpstan
- step: &test-code-style-phpmd
<<: *default-step
name: PHP Mess Detector (Static code analysis)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-phpmd
- step: &test-code-style-phpcpd
<<: *default-step
name: PHP Copy Paste Detector (Static code analysis)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-phpcpd
- step: &test-code-style-soft-require
<<: *default-step
name: Composer soft requirements (Requirement analysis)
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-soft-require
- step: &test-code-style-composer-unused
<<: *default-step
name: Composer unused (Requirement analysis)
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-composer-unused
- step: &test-code-style-composer-normalize
<<: *default-step
name: composer.json (Code style)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-composer-normalize
- step: &test-code-style-json
<<: *default-step
name: '*.json (Code style)'
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-json
- step: &test-infection-full
<<: *default-step
name: Test infection (all)
script:
- bash setup-vendor.sh
- INFECTION_EXTRA_ARGS="--min-covered-msi=50 --min-msi=50" XDEBUG_MODE=coverage COMPOSER_EXTRA_ARGS=-vvv make -e infection
- step: &test-infection-diff
<<: *default-step
name: Test infection (diff)
script:
- bash setup-vendor.sh
- git fetch origin "${BITBUCKET_PR_DESTINATION_BRANCH}"
- INFECTION_EXTRA_ARGS="--min-covered-msi=100 --min-msi=100 --git-diff-filter=AM --git-diff-base=origin/${BITBUCKET_PR_DESTINATION_BRANCH}" XDEBUG_MODE=coverage COMPOSER_EXTRA_ARGS=-vvv make -e infection
pipelines:
branches:
master:
- step: *github-keyword-gate-step
- step: *github-mirror-branch
- parallel: &non-vendor-steps
- step: *test-code-style-composer-normalize
- step: *test-code-style-json
- step: *test-code-style-php
- step: *test-code-style-phpcpd
- step: *test-code-style-phpmd
- step: *composer-high-install
- parallel: &steps-blocking-tests
- step: *test-coverage
- step: *test-code-style-composer-unused
- step: *composer-low-install
- parallel: &steps-blocking-low-tests
- step: *test-coverage
- step: *test-code-style-composer-unused
- parallel: &steps-blocking-non-min-php-version-tests
- step: *test-coverage-high-install-84
- step: *test-coverage-low-install-84
- step: *composer-high-install
- parallel: &steps-non-blocking-tests
- step: *test-code-style-soft-require
- step: *test-code-style-phpstan
- step: *test-infection-full
- step: *composer-low-install
- parallel: &steps-non-blocking-low-tests
- step: *test-code-style-phpstan
'*.*.x':
- step: *github-keyword-gate-step
- step: *github-mirror-branch
tags:
'*':
- step: *composer-low-install
- step: *composer-high-install
- step: *github-keyword-gate-step
- step: *github-mirror-tag
pull-requests:
'*':
- parallel: *non-vendor-steps
- step: *composer-high-install
- parallel: *steps-blocking-tests
- step: *composer-low-install
- parallel: *steps-blocking-low-tests
- parallel: *steps-blocking-non-min-php-version-tests
- step: *composer-high-install
- parallel:
- step: *test-code-style-soft-require
- step: *test-code-style-phpstan
- step: *test-infection-diff
- step: *composer-low-install
- parallel: *steps-non-blocking-low-tests
default:
- parallel: *non-vendor-steps
- step: *composer-high-install
- parallel: *steps-blocking-tests
- step: *composer-low-install
- parallel: *steps-blocking-low-tests
- parallel: *steps-blocking-non-min-php-version-tests
- step: *composer-high-install
- parallel: *steps-non-blocking-tests
- step: *composer-low-install
- parallel: *steps-non-blocking-low-tests