forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 1
451 lines (358 loc) · 11.6 KB
/
build.yml
File metadata and controls
451 lines (358 loc) · 11.6 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Build"
on:
pull_request:
push:
branches:
- "master"
env:
COMPOSER_ROOT_VERSION: "0.12.x-dev"
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
if: ${{ false }}
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Validate Composer"
run: "composer validate"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0'
run: php bin/transform-source.php
- name: "Lint"
run: "make lint"
coding-standards:
name: "Coding Standard"
runs-on: "ubuntu-latest"
if: ${{ false }}
strategy:
matrix:
php-version:
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Validate Composer"
run: "composer validate"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Lint"
run: "make lint"
- name: "Coding Standard"
run: "make cs"
dependency-analysis:
name: "Dependency Analysis"
runs-on: "ubuntu-latest"
if: ${{ false }}
strategy:
matrix:
php-version:
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Composer Require Checker"
run: "make composer-require-checker"
tests:
name: "Tests"
runs-on: ${{ matrix.operating-system }}
if: ${{ false }}
strategy:
fail-fast: false
matrix:
php-version:
- "7.3"
- "7.4"
- "8.0"
operating-system: [ubuntu-latest, windows-latest]
script:
- "make tests"
- "make tests-static-reflection"
- "make tests-integration"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl
extensions: ds,mbstring
ini-values: memory_limit=640M
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0'
run: php bin/transform-source.php
- name: "Tests"
run: "${{ matrix.script }}"
tests-old-phpunit:
name: "Tests with old PHPUnit"
runs-on: ${{ matrix.operating-system }}
if: ${{ false }}
strategy:
fail-fast: false
matrix:
php-version:
- "7.1"
- "7.2"
operating-system: [ubuntu-latest, windows-latest]
script:
- "make tests-coverage"
- "make tests-static-reflection-coverage"
- "make tests-integration-coverage"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: pecl
extensions: ds,mbstring
ini-values: memory_limit=640M
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Downgrade PHPUnit"
run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies"
- name: "Transform source code"
run: php bin/transform-source.php
- name: "Tests"
run: "${{ matrix.script }}"
tests-code-coverage:
name: "Tests with code coverage"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "7.4"
tools: pecl
extensions: ds
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Tests"
continue-on-error: true
run: |
php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit
- name: "Coveralls"
if: ${{ false }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer require twinh/php-coveralls --dev && \
vendor/bin/php-coveralls --verbose --coverage_clover=tests/tmp/clover.xml --json_path=tests/tmp/coveralls-upload.json
- name: "DeepSource"
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
run: |
curl https://deepsource.io/cli | sh && \
./bin/deepsource report --analyzer test-coverage --key php --value-file tests/tmp/clover.xml
static-analysis:
name: "PHPStan"
runs-on: ${{ matrix.operating-system }}
if: ${{ false }}
strategy:
fail-fast: false
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
operating-system: [ubuntu-latest, windows-latest]
script:
- "make phpstan"
- "make phpstan-static-reflection"
- "make phpstan-validate-stub-files"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: mbstring
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.1' || matrix.php-version == '7.2'
run: "composer require --dev phpunit/phpunit:^7.5.20 brianium/paratest:^4.0 --update-with-dependencies"
- name: "Transform source code"
if: matrix.php-version != '7.4' && matrix.php-version != '8.0'
run: php bin/transform-source.php
- name: "PHPStan"
run: ${{ matrix.script }}
static-analysis-with-result-cache:
name: "PHPStan with result cache"
if: ${{ false }}
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: mbstring
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Cache Result cache"
uses: actions/cache@v2
with:
path: ./tmp
key: "result-cache-v4"
- name: "PHPStan with result cache"
run: |
make phpstan-result-cache
bin/phpstan clear-result-cache -c build/phpstan.neon
make phpstan-result-cache
echo -e "\n\n" >> src/TrinaryLogic.php
make phpstan-result-cache
make phpstan-result-cache
- name: "Upload result cache artifact"
uses: actions/upload-artifact@v2
with:
name: resultCache-ubuntu-latest.php
path: tmp/resultCache.php
result-cache-e2e-tests:
name: "Result cache E2E tests"
runs-on: ${{ matrix.operating-system }}
if: ${{ false }}
strategy:
matrix:
php-version:
- "7.4"
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: mbstring
ini-values: memory_limit=256M
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Tests"
run: |
git clone https://github.com/nikic/PHP-Parser.git tests/e2e/PHP-Parser && git -C tests/e2e/PHP-Parser checkout v3.1.5 && composer install --working-dir tests/e2e/PHP-Parser && vendor/bin/phpunit tests/e2e/ResultCacheEndToEndTest.php
compiler-tests:
name: "Compiler Tests"
if: ${{ false }}
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.3"
- name: "Install dependencies"
run: "composer install --no-dev --no-interaction --no-progress --no-suggest"
- name: "Transform source code"
run: php bin/transform-source.php
- name: "Tests"
run: |
cd compiler && \
composer install --no-interaction && \
vendor/bin/phpunit -c tests/phpunit.xml tests && \
../bin/phpstan analyse -l 8 src tests && \
php bin/compile && \
../tmp/phpstan.phar list
generate-baseline:
name: "Generate baseline"
if: ${{ false }}
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Generate baseline"
run: |
cp phpstan-baseline.neon phpstan-baseline-orig.neon && \
make phpstan-generate-baseline && \
diff phpstan-baseline.neon phpstan-baseline-orig.neon
e2e-tests:
name: "E2E tests"
runs-on: "ubuntu-latest"
if: ${{ false }}
strategy:
matrix:
include:
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/timecop.php tests/e2e/data/timecop.php"
tools: "pecl"
extensions: "timecop-beta"
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php tests/e2e/data/soap.php"
extensions: "soap"
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php tests/e2e/data/soap.php"
extensions: ""
- script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php"
extensions: ""
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.4"
tools: ${{ matrix.tools }}
extensions: ${{ matrix.extensions }}
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Test"
run: ${{ matrix.script }}