forked from api-platform/core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.yml
287 lines (280 loc) · 9.17 KB
/
config.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
version: 2
reusable-steps:
- &clear-test-app-cache
run:
name: Clear test app cache
command: tests/Fixtures/app/console cache:clear
- &disable-php-memory-limit
run:
name: Disable PHP memory limit
command: echo 'memory_limit=-1' | sudo tee -a /usr/local/etc/php/php.ini
- &disable-xdebug-php-extension
run:
name: Disable Xdebug PHP extension
command: sudo rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- &install-php-extensions
run:
name: Install PHP extensions
command: |
sudo pecl install mongodb
echo 'extension=mongodb.so' | sudo tee /usr/local/etc/php/conf.d/mongodb.ini
- &restore-composer-cache
restore_cache:
keys:
- composer-cache-{{ .Revision }}
- composer-cache-{{ .Branch }}
- composer-cache
- &restore-npm-cache
restore_cache:
keys:
- npm-cache-{{ .Revision }}
- npm-cache-{{ .Branch }}
- npm-cache
- &restore-php-cs-fixer-cache
restore_cache:
keys:
- php-cs-fixer-cache-{{ .Revision }}
- php-cs-fixer-cache-{{ .Branch }}
- php-cs-fixer-cache
- &restore-phpstan-cache
restore_cache:
keys:
- phpstan-cache-{{ .Revision }}
- phpstan-cache-{{ .Branch }}
- phpstan-cache
- &save-composer-cache-by-branch
save_cache:
paths:
- ~/.composer/cache
key: composer-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-composer-cache-by-revision
save_cache:
paths:
- ~/.composer/cache
key: composer-cache-{{ .Revision }}-{{ .BuildNum }}
- &save-npm-cache-by-branch
save_cache:
paths:
- ~/.npm
key: npm-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-npm-cache-by-revision
save_cache:
paths:
- ~/.npm
key: npm-cache-{{ .Revision }}-{{ .BuildNum }}
- &save-php-cs-fixer-cache-by-branch
save_cache:
paths:
- .php_cs.cache
key: php-cs-fixer-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-php-cs-fixer-cache-by-revision
save_cache:
paths:
- .php_cs.cache
key: php-cs-fixer-cache-{{ .Revision }}-{{ .BuildNum }}
- &save-phpstan-cache-by-branch
save_cache:
paths:
- /tmp/phpstan/cache
key: phpstan-cache-{{ .Branch }}-{{ .BuildNum }}
- &save-phpstan-cache-by-revision
save_cache:
paths:
- /tmp/phpstan/cache
key: phpstan-cache-{{ .Revision }}-{{ .BuildNum }}
- &update-composer
run:
name: Update Composer
command: sudo composer self-update
- &update-project-dependencies
run:
name: Update project dependencies
command: composer update --prefer-dist --no-progress --no-suggest --ansi
jobs:
php-cs-fixer:
docker:
- image: circleci/php:7.2-node-browsers
environment:
PHP_CS_FIXER_FUTURE_MODE: 1
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-php-cs-fixer-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *update-composer
- run:
name: Install PHP-CS-Fixer
command: composer global require friendsofphp/php-cs-fixer:^2.14
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- run:
name: Run PHP-CS-Fixer
command: |-
export PATH="$PATH:$HOME/.composer/vendor/bin"
php-cs-fixer fix --dry-run --diff --ansi
- *save-php-cs-fixer-cache-by-revision
- *save-php-cs-fixer-cache-by-branch
phpstan:
docker:
- image: circleci/php:7.2-node-browsers
environment:
# https://github.com/phpstan/phpstan-symfony/issues/37
APP_DEBUG: 1
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-phpstan-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *install-php-extensions
- *update-composer
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- *clear-test-app-cache
- run:
name: Run PHPStan
command: vendor/bin/phpstan analyse --ansi
- *save-phpstan-cache-by-revision
- *save-phpstan-cache-by-branch
phpunit-coverage:
docker:
- image: circleci/php:7.2-node-browsers
environment:
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
parallelism: 2
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *install-php-extensions
- *update-composer
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- *clear-test-app-cache
- run:
name: Run PHPUnit tests
command: |-
mkdir -p build/logs/parallel build/logs/tmp build/cov
split_tests=$(find tests -name '*Test.php' -not -path 'tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php' | circleci tests split --split-by=timings)
export PARALLEL='-j10% --joblog build/logs/parallel/jobs.log --rpl {_}\ s/\\//_/g;'
phpunit_cmd='phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-{_}.cov --log-junit build/logs/tmp/{_}.xml --colors=always {}'
echo "$split_tests" | parallel "$phpunit_cmd" || echo "$split_tests" | parallel --retry-failed "$phpunit_cmd"
- run:
name: Merge PHPUnit test reports
command: |-
mkdir -p build/logs/phpunit
npx junit-merge --out build/logs/phpunit/junit.xml --dir build/logs/tmp
rm -r build/logs/tmp
- store_test_results:
path: build/logs
- store_artifacts:
path: build/logs/phpunit/junit.xml
destination: build/logs/phpunit/junit.xml
- store_artifacts:
path: build/logs/parallel/jobs.log
destination: build/logs/parallel/jobs.log
- persist_to_workspace:
root: build
paths:
- cov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch
behat-coverage:
docker:
- image: circleci/php:7.2-node-browsers
parallelism: 2
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-composer-cache
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- *install-php-extensions
- *update-composer
- *update-project-dependencies
- *save-composer-cache-by-revision
- *save-composer-cache-by-branch
- *clear-test-app-cache
- run:
name: Run Behat tests
command: |-
mkdir -p build/logs/tmp build/cov
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature' -not -path 'features/elasticsearch/*' -not -path 'features/mongodb/*' | circleci tests split --split-by=timings); do
_f=${f//\//_}
FEATURE="${_f}" phpdbg -qrr vendor/bin/behat --profile=coverage --suite=default --format=progress --out=std --format=junit --out=build/logs/tmp/"${_f}" --no-interaction "$f"
done
- run:
name: Merge Behat test reports
command: |-
mkdir -p build/logs/behat
npx junit-merge --out build/logs/behat/junit.xml --dir build/logs/tmp --recursive
rm -r build/logs/tmp
- store_test_results:
path: build/logs
- store_artifacts:
path: build/logs/behat/junit.xml
destination: build/logs/behat/junit.xml
- persist_to_workspace:
root: build
paths:
- cov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch
merge-and-upload-coverage:
docker:
- image: circleci/php:7.2-node-browsers
working_directory: ~/api-platform/core
steps:
- checkout
- *restore-npm-cache
- *disable-xdebug-php-extension
- *disable-php-memory-limit
- run:
name: Download phpcov
command: wget https://phar.phpunit.de/phpcov.phar
- attach_workspace:
at: build
- run:
name: Merge code coverage reports
command: |-
mkdir -p build/logs
phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov
- store_artifacts:
path: build/logs/clover.xml
destination: build/logs/clover.xml
- run:
name: Upload code coverage report to Coveralls
command: |-
if [ ! -z "$COVERALLS_REPO_TOKEN" ]; then
npx @cedx/coveralls build/logs/clover.xml
else
echo 'Skipped'
fi
- run:
name: Upload code coverage report to Codecov
command: npx codecov --file=build/logs/clover.xml --disable=gcov
- *save-npm-cache-by-revision
- *save-npm-cache-by-branch
workflows:
version: 2
lint:
jobs:
- php-cs-fixer
- phpstan
test-with-coverage:
jobs:
- phpunit-coverage
- behat-coverage
- merge-and-upload-coverage:
requires:
- phpunit-coverage
- behat-coverage