-
Notifications
You must be signed in to change notification settings - Fork 1
/
bitbucket-pipelines.yml
213 lines (209 loc) · 10.1 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
image: heptacom/heptaconnect-pipeline:php81-8.0.0
definitions:
partials:
- step: &php82-image
image: heptacom/heptaconnect-pipeline:php82-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 "git@github.com: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 "git@github.com: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-unit-high-install-82
<<: *php82-image
name: Install and Unit test (8.2 + High dependencies)
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO test_user@127.0.0.1 IDENTIFIED BY "let_me_in_as_well";'
- mysql -utest_user -plet_me_in_as_well -h127.0.0.1 -e 'CREATE DATABASE pipelines_testhigh81;'
- make clean
- GLOBAL_REPOSITORIES_DIR=`pwd`/.build/private-composer composer-repository
- DATABASE_URL='mysql://root:let_me_in@127.0.0.1/pipelines_testhigh81' COMPOSER_EXTRA_ARGS=-vvv make -e test
- step: &test-unit-low-install-82
<<: *php82-image
name: Install and Unit test (8.2 + Low dependencies)
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO test_user@127.0.0.1 IDENTIFIED BY "let_me_in_as_well";'
- mysql -utest_user -plet_me_in_as_well -h127.0.0.1 -e 'CREATE DATABASE pipelines_testlow81;'
- make clean
- GLOBAL_REPOSITORIES_DIR=`pwd`/.build/private-composer composer-repository
- composer update --prefer-lowest --prefer-stable
- DATABASE_URL='mysql://root:let_me_in@127.0.0.1/pipelines_testlow81' COMPOSER_EXTRA_ARGS=-vvv make -e test
- step: &test-coverage
<<: *default-step
name: Test coverage
script:
- mysql -uroot -plet_me_in -h127.0.0.1 -e 'GRANT ALL ON *.* TO test_user@127.0.0.1 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:let_me_in@127.0.0.1/pipelines_covr' XDEBUG_MODE=coverage COMPOSER_EXTRA_ARGS=-vvv make -e coverage
- step: &test-code-style-php
<<: *default-step
name: ECS (Code style)
script:
- bash setup-vendor.sh
- 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-psalm
<<: *default-step
name: Psalm (Static code analysis)
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-psalm
- step: &test-code-style-phpmd
<<: *default-step
name: PHP Mess Detector (Static code analysis)
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-phpmd
- step: &test-code-style-phpcpd
<<: *default-step
name: PHP Copy Paste Detector (Static code analysis)
script:
- bash setup-vendor.sh
- 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:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-composer-normalize
- step: &test-code-style-json
<<: *default-step
name: '*.json (Code style)'
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-json
- step: &test-infection
<<: *default-step
name: Test infection
script:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e infection
pipelines:
branches:
master:
- step: *github-keyword-gate-step
- step: *github-mirror-branch
- step: *composer-high-install
- parallel: &steps-blocking-tests
- step: *test-coverage
- step: *test-code-style-composer-normalize
- step: *test-code-style-composer-unused
- step: *test-code-style-json
- step: *test-code-style-php
- step: *test-code-style-phpcpd
- 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-unit-high-install-82
- step: *test-unit-low-install-82
- step: *composer-high-install
- parallel: &steps-non-blocking-tests
- step: *test-code-style-phpmd
- step: *test-code-style-soft-require
- step: *test-code-style-phpstan
- step: *test-code-style-psalm
- step: *test-infection
- step: *composer-low-install
- parallel: &steps-non-blocking-low-tests
- step: *test-code-style-phpstan
- step: *test-code-style-psalm
'*.*.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
default:
- 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