-
Notifications
You must be signed in to change notification settings - Fork 10
/
bitbucket-pipelines.yml
221 lines (217 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
214
215
216
217
218
219
220
221
image: heptacom/shopware-6-plugin-pipeline:php82-node20-latest
definitions:
steps:
- step: &default-step
caches:
- composer
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: &keyword-check
<<: *default-step
name: 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: &tag-check
<<: *default-step
name: Tag Gate
script:
- '[[ "${BITBUCKET_TAG}" == *"$(jq -r composer.json .version)" ]]'
- 'grep -qe "# ${BITBUCKET_TAG}" CHANGELOG.md'
- 'grep -qe "# ${BITBUCKET_TAG}" CHANGELOG_de-DE.md'
after-script:
- 'test ${BITBUCKET_EXIT_CODE} -eq 0 || echo "Bitbucket tag: ${BITBUCKET_TAG}"'
- 'test ${BITBUCKET_EXIT_CODE} -eq 0 || (echo "composer.json version: " && jq -r composer.json .version)'
- "test ${BITBUCKET_EXIT_CODE} -eq 0 || (echo 'CHANGELOG.md versions: ' && grep -e '# ' CHANGELOG.md)'"
- "test ${BITBUCKET_EXIT_CODE} -eq 0 || (echo 'CHANGELOG_de-DE.md versions: ' && grep -e '# ' CHANGELOG_de-DE.md)'"
- 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: &build-fix-and-commit
<<: *default-step
name: Build and fix (composer.json, Pint, admin)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-fix-composer-normalize
- |
if [[ $(git add -A -n | wc -l) -ne 0 ]]; then
git add -A
git commit -m "$ make cs-fix-composer-normalize"
fi
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-fix-style
- |
if [[ $(git add -A -n | wc -l) -ne 0 ]]; then
git add -A
git commit -m "$ make cs-fix-style"
fi
- COMPOSER_EXTRA_ARGS=-vvv make -e build-assets
- |
if [[ $(git add -A -n | wc -l) -ne 0 ]]; then
git add -A
git commit -m "$ make build-assets"
fi
- |
if [[ $(git rev-parse HEAD) != "${BITBUCKET_COMMIT}" ]]; then
echo "Changes get pushed, new pipeline will run later see"
echo "https://bitbucket.org/${BITBUCKET_REPO_FULL_NAME}/commits/"$(git rev-parse HEAD)
git push
exit 1
fi
- step: &test-code-style-php
<<: *default-step
name: Pint (Code style)
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-style
- 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:
- bash setup-vendor.sh
- COMPOSER_EXTRA_ARGS=-vvv make -e cs-phpmd
- 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-code-style-translation
<<: *default-step
name: Analyse translations are complete
script:
- make -e cs-translation
- step: &test-build-assets
<<: *default-step
name: Check assets are built
script:
- COMPOSER_EXTRA_ARGS=-vvv make -e build-assets
- 'test $(git add -A -n | wc -l) -eq 0'
- step: &lint-store-readiness
<<: *default-step
name: Lint plugins store readiness
script:
- sed -i -e 's/# Unreleased/# 999.999.999/' CHANGELOG.md
- sed -i -e 's/# Unreleased/# 999.999.999/' CHANGELOG_de-DE.md
- git add CHANGELOG.md CHANGELOG_de-DE.md
- git commit -m "$ releasecheck"
- git tag 999.999.999
- make releasecheck
- step: &build-store
<<: *default-step
name: Build for store
artifacts:
- .build/store-build/*.zip
script:
- make releasecheck
pipelines:
branches:
main:
- step: *build-fix-and-commit
- parallel:
- step: *keyword-check
- step: *test-code-style-json
- step: *test-code-style-translation
- step: *composer-low-install
- step: *test-code-style-composer-unused
- step:
image: atlassian/default-image:2
name: Mirror to Github
script:
- git remote add github git@github.com:HEPTACOM/HeptacomShopwarePlatformAdminOpenAuth.git
- git push --force github main
'*.*.x':
- step: *build-fix-and-commit
- parallel:
- step: *keyword-check
- step: *test-code-style-translation
- step: *test-code-style-composer-normalize
- step: *test-code-style-php
- step: *test-code-style-json
tags:
'*':
- parallel:
- step: *tag-check
- step: *keyword-check
- step: *lint-store-readiness
- step: *test-code-style-translation
- step: *test-code-style-composer-normalize
- step: *test-build-assets
- step: *test-code-style-php
- step: *test-code-style-json
- step: *build-store
- step:
image: atlassian/default-image:2
name: Mirror tags to Github
script:
- git remote add github git@github.com:HEPTACOM/HeptacomShopwarePlatformAdminOpenAuth.git
- git push --force github tag $BITBUCKET_TAG
default:
- step: *build-fix-and-commit
- parallel:
- step: *keyword-check
- step: *lint-store-readiness
- step: *test-code-style-json
- step: *test-code-style-translation
- step: *composer-low-install
- parallel:
- step: *test-code-style-composer-unused
- step: *test-code-style-soft-require
custom:
deep-check:
- step: *composer-high-install
- parallel:
- step: *test-code-style-phpmd
- step: *test-code-style-phpstan
- step: *composer-low-install
- parallel:
- step: *test-code-style-phpmd
- step: *test-code-style-phpstan