-
Notifications
You must be signed in to change notification settings - Fork 473
290 lines (265 loc) · 11.5 KB
/
e2e-tests.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
288
289
290
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "E2E Tests"
on:
pull_request:
paths-ignore:
- 'compiler/**'
- 'apigen/**'
- 'changelog-generator/**'
- 'issue-bot/**'
push:
branches:
- "1.11.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
- 'changelog-generator/**'
- 'issue-bot/**'
env:
COMPOSER_ROOT_VERSION: "1.11.x-dev"
concurrency:
group: e2e-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
cancel-in-progress: true
jobs:
result-cache-php-parser-e2e:
name: "Result cache PHP-Parser E2E test"
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
extensions: mbstring
ini-values: memory_limit=256M
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"
- 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
result-cache-e2e-tests:
name: "Result cache E2E tests"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- script: |
cd e2e/result-cache-1
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Bar.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Bar.php.orig src/Bar.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-2
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Bar.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Bar.php.orig src/Bar.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-3
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Baz.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Baz.php.orig src/Baz.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-4
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Bar.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Bar.php.orig src/Bar.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-5
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Baz.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Baz.php.orig src/Baz.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-6
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Baz.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Baz.php.orig src/Baz.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/result-cache-7
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Bar.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Bar.php.orig src/Bar.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/bug10449
../../bin/phpstan analyze
git apply patch.diff
rm phpstan-baseline.neon
mv after-phpstan-baseline.neon phpstan-baseline.neon
../../bin/phpstan analyze -vvv
- script: |
cd e2e/bug10449b
../../bin/phpstan analyze
git apply patch.diff
rm phpstan-baseline.neon
mv after-phpstan-baseline.neon phpstan-baseline.neon
../../bin/phpstan analyze -vvv
- script: |
cd e2e/bug-9622
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Foo.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Foo.php.orig src/Foo.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/bug-9622-trait
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
patch -b src/Foo.php < patch-1.patch
cat baseline-1.neon > phpstan-baseline.neon
../../bin/phpstan -vvv
mv src/Foo.php.orig src/Foo.php
echo -n > phpstan-baseline.neon
../../bin/phpstan -vvv
- script: |
cd e2e/env-parameter
export PHPSTAN_SCOPE_CLASS=MyTestScope
ACTUAL=$(../../bin/phpstan dump-parameters -c phpstan.neon --json -l 9 | jq --raw-output '.scopeClass')
[[ "$ACTUAL" == "MyTestScope" ]];
- script: |
cd e2e/result-cache-8
composer install
../../bin/phpstan
echo -en '\n' >> build/CustomRule.php
OUTPUT=$(../../bin/phpstan 2>&1)
grep 'Result cache might not behave correctly' <<< "$OUTPUT"
grep 'ResultCache8E2E\\CustomRule' <<< "$OUTPUT"
- script: |
cd e2e/env-int-key
env 1=1 ../../bin/phpstan analyse test.php
- script: |
cd e2e/trait-caching
../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/
../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/
- script: |
cd e2e/trait-caching
../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/
patch -b data/TraitOne.php < TraitOne.patch
OUTPUT=$(../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/ || true)
echo "$OUTPUT"
../bashunit -a line_count 1 "$OUTPUT"
../bashunit -a contains 'Method TraitsCachingIssue\TestClassUsingTrait::doBar() should return stdClass but returns Exception.' "$OUTPUT"
- script: |
cd e2e/trait-caching
../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/
patch -b data/TraitTwo.php < TraitTwo.patch
OUTPUT=$(../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/ || true)
echo "$OUTPUT"
../bashunit -a line_count 1 "$OUTPUT"
../bashunit -a contains 'Method class@anonymous/TestClassUsingTrait.php:20::doBar() should return stdClass but returns Exception.' "$OUTPUT"
- script: |
cd e2e/trait-caching
../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/
patch -b data/TraitOne.php < TraitOne.patch
patch -b data/TraitTwo.php < TraitTwo.patch
OUTPUT=$(../../bin/phpstan analyze --no-progress --level 8 --error-format raw data/ || true)
echo "$OUTPUT"
../bashunit -a line_count 2 "$OUTPUT"
../bashunit -a contains 'Method TraitsCachingIssue\TestClassUsingTrait::doBar() should return stdClass but returns Exception.' "$OUTPUT"
../bashunit -a contains 'Method class@anonymous/TestClassUsingTrait.php:20::doBar() should return stdClass but returns Exception.' "$OUTPUT"
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
extensions: mbstring
ini-values: memory_limit=256M
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Patch PHPStan"
run: "patch src/Analyser/Error.php < e2e/PHPStanErrorPatch.patch"
- name: "Install bashunit"
run: "curl -s https://bashunit.typeddevs.com/install.sh | bash -s e2e/ 0.13.0"
- name: "Test"
run: "${{ matrix.script }}"
e2e-tests:
name: "E2E tests"
runs-on: "ubuntu-latest"
timeout-minutes: 60
strategy:
matrix:
include:
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/timecop.php -c tests/e2e/data/empty.neon tests/e2e/data/timecop.php"
tools: "pecl"
extensions: "timecop-beta"
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php -c tests/e2e/data/empty.neon tests/e2e/data/soap.php"
extensions: "soap"
- script: "bin/phpstan analyse -l 8 -a tests/e2e/data/soap.php -c tests/e2e/data/empty.neon tests/e2e/data/soap.php"
extensions: ""
- script: "bin/phpstan analyse -l 8 tests/e2e/anon-class/Granularity.php"
extensions: ""
- script: "bin/phpstan analyse -l 8 e2e/phpstan-phpunit-190/test.php -c e2e/phpstan-phpunit-190/test.neon"
extensions: ""
- script: "bin/phpstan analyse e2e/only-files-not-analysed-trait/src -c e2e/only-files-not-analysed-trait/ignore.neon"
extensions: ""
- script: "bin/phpstan analyse e2e/only-files-not-analysed-trait/src/Foo.php e2e/only-files-not-analysed-trait/src/BarTrait.php -c e2e/only-files-not-analysed-trait/no-ignore.neon"
extensions: ""
- script: |
cd e2e/baseline-uninit-prop-trait
../../bin/phpstan analyse --debug --configuration test-no-baseline.neon --generate-baseline test-baseline.neon
../../bin/phpstan analyse --debug --configuration test.neon
- script: |
cd e2e/baseline-uninit-prop-trait
../../bin/phpstan analyse --configuration test-no-baseline.neon --generate-baseline test-baseline.neon
../../bin/phpstan analyse --configuration test.neon
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.1"
tools: ${{ matrix.tools }}
extensions: ${{ matrix.extensions }}
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Test"
run: ${{ matrix.script }}