14
14
15
15
runs-on : " ubuntu-latest"
16
16
17
+ strategy :
18
+ matrix :
19
+ php-version :
20
+ - " 7.1"
21
+
17
22
steps :
18
23
- name : " Checkout"
19
24
@@ -25,6 +30,115 @@ jobs:
25
30
file_or_dir : " ."
26
31
strict : true
27
32
33
+ - name : " Install PHP with extensions"
34
+ uses : " shivammathur/setup-php@v2"
35
+ with :
36
+ coverage : " none"
37
+ extensions : " ${{ env.PHP_EXTENSIONS }}"
38
+ php-version : " ${{ matrix.php-version }}"
39
+
40
+ - name : " Validate composer.json and composer.lock"
41
+ run : " composer validate --strict"
42
+
43
+ - name : " Run ergebnis/composer-normalize"
44
+ run : " tools/composer-normalize --dry-run"
45
+
46
+ - name : " Create cache directory for friendsofphp/php-cs-fixer"
47
+ run : " mkdir -p .build/php-cs-fixer"
48
+
49
+ - name : " Cache cache directory for friendsofphp/php-cs-fixer"
50
+ uses : " actions/cache@v2"
51
+ with :
52
+ path : " .build/php-cs-fixer"
53
+ key : " php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('tools/php-cs-fixer') }}"
54
+ restore-keys : " php-${{ matrix.php-version }}-php-cs-fixer-"
55
+
56
+ - name : " Run friendsofphp/php-cs-fixer"
57
+ run : " tools/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose"
58
+
59
+ static-code-analysis :
60
+ name : " Static Code Analysis"
61
+
62
+ runs-on : " ubuntu-latest"
63
+
64
+ strategy :
65
+ matrix :
66
+ php-version :
67
+ - " 7.4"
68
+
69
+ dependencies :
70
+ - " highest"
71
+
72
+ steps :
73
+ - name : " Checkout"
74
+
75
+
76
+ - name : " Install PHP with extensions"
77
+ uses : " shivammathur/setup-php@v2"
78
+ with :
79
+ coverage : " none"
80
+ php-version : " ${{ matrix.php-version }}"
81
+
82
+ - name : " Determine composer cache directory"
83
+ id : " determine-composer-cache-directory"
84
+ run : " echo \" ::set-output name=directory::$(composer config cache-dir)\" "
85
+
86
+ - name : " Cache dependencies installed with composer"
87
+ uses : " actions/cache@v2"
88
+ with :
89
+ path : " ${{ steps.determine-composer-cache-directory.outputs.directory }}"
90
+ key : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
91
+ restore-keys : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
92
+
93
+ - name : " Install lowest dependencies from composer.json"
94
+ if : " matrix.dependencies == 'lowest'"
95
+ run : " composer update --no-interaction --no-progress --no-suggest --prefer-lowest"
96
+
97
+ - name : " Install locked dependencies from composer.lock"
98
+ if : " matrix.dependencies == 'locked'"
99
+ run : " composer install --no-interaction --no-progress --no-suggest"
100
+
101
+ - name : " Install highest dependencies from composer.json"
102
+ if : " matrix.dependencies == 'highest'"
103
+ run : " composer update --no-interaction --no-progress --no-suggest"
104
+
105
+ - name : " Create cache directory for vimeo/psalm"
106
+ run : " mkdir -p .build/psalm"
107
+
108
+ - name : " Cache cache directory for vimeo/psalm"
109
+ uses : " actions/cache@v2"
110
+ with :
111
+ path : " .build/psalm"
112
+ key : " php-${{ matrix.php-version }}-psalm-${{ github.sha }}"
113
+ restore-keys : " php-${{ matrix.php-version }}-psalm-"
114
+
115
+ - name : " Run vimeo/psalm"
116
+ run : " tools/psalm --config=psalm.xml --diff --diff-methods --shepherd --show-info=false --stats --threads=4"
117
+
118
+ backward-compatibility :
119
+ name : " Backward Compatibility"
120
+
121
+ runs-on : " ubuntu-latest"
122
+
123
+ steps :
124
+ - name : " Checkout"
125
+
126
+ with :
127
+ fetch-depth : 0
128
+
129
+ - name : " Fetch tags"
130
+ run : " git fetch --depth=1 origin +refs/tags/*:refs/tags/*"
131
+
132
+ - name : " Install PHP with extensions"
133
+ uses : " shivammathur/setup-php@v2"
134
+ with :
135
+ php-version : " 7.4"
136
+ coverage : " none"
137
+ extensions : " intl"
138
+
139
+ - name : " Run roave/backward-compatibility-check"
140
+ run : " tools/roave-backward-compatibility-check --from=1.0.0"
141
+
28
142
tests :
29
143
name : " Tests"
30
144
@@ -36,8 +150,11 @@ jobs:
36
150
- " 7.1"
37
151
- " 7.2"
38
152
- " 7.3"
153
+ - " 7.4"
154
+ - " 8.0"
39
155
40
156
dependencies :
157
+ - " lowest"
41
158
- " highest"
42
159
43
160
steps :
@@ -76,12 +193,73 @@ jobs:
76
193
- name : " Run tests with phpunit/phpunit"
77
194
run : " vendor/bin/phpunit --configuration=phpunit.xml"
78
195
196
+ code-coverage :
197
+ name : " Code Coverage"
198
+
199
+ runs-on : " ubuntu-latest"
200
+
201
+ strategy :
202
+ matrix :
203
+ php-version :
204
+ - " 7.4"
205
+
206
+ dependencies :
207
+ - " highest"
208
+
209
+ steps :
210
+ - name : " Checkout"
211
+
212
+
213
+ - name : " Install PHP with extensions"
214
+ uses : " shivammathur/setup-php@v2"
215
+ with :
216
+ coverage : " xdebug"
217
+ php-version : " ${{ matrix.php-version }}"
218
+
219
+ - name : " Determine composer cache directory"
220
+ id : " determine-composer-cache-directory"
221
+ run : " echo \" ::set-output name=directory::$(composer config cache-dir)\" "
222
+
223
+ - name : " Cache dependencies installed with composer"
224
+ uses : " actions/cache@v2"
225
+ with :
226
+ path : " ${{ steps.determine-composer-cache-directory.outputs.directory }}"
227
+ key : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
228
+ restore-keys : " php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
229
+
230
+ - name : " Install lowest dependencies from composer.json"
231
+ if : " matrix.dependencies == 'lowest'"
232
+ run : " composer update --no-interaction --no-progress --no-suggest --prefer-lowest"
233
+
234
+ - name : " Install locked dependencies from composer.lock"
235
+ if : " matrix.dependencies == 'locked'"
236
+ run : " composer install --no-interaction --no-progress --no-suggest"
237
+
238
+ - name : " Install highest dependencies from composer.json"
239
+ if : " matrix.dependencies == 'highest'"
240
+ run : " composer update --no-interaction --no-progress --no-suggest"
241
+
242
+ - name : " Dump Xdebug filter with phpunit/phpunit"
243
+ run : " vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php"
244
+
245
+ - name : " Collect code coverage with Xdebug and phpunit/phpunit"
246
+ run : " vendor/bin/phpunit --configuration=phpunit.xml --coverage-clover=.build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php"
247
+
248
+ - name : " Send code coverage report to Codecov.io"
249
+ env :
250
+ CODECOV_TOKEN : " ${{ secrets.CODECOV_TOKEN }}"
251
+ run : " bash <(curl -s https://codecov.io/bash)"
252
+
79
253
merge :
80
254
name : " Merge"
81
255
82
256
runs-on : " ubuntu-latest"
83
257
84
258
needs :
259
+ - " backward-compatibility"
260
+ - " code-coverage"
261
+ - " coding-standards"
262
+ - " static-code-analysis"
85
263
- " tests"
86
264
87
265
if : >
@@ -97,10 +275,64 @@ jobs:
97
275
)
98
276
99
277
steps :
278
+ - name : " Request review from @ergebnis-bot"
279
+ uses : " actions/github-script@v2"
280
+ with :
281
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
282
+ script : |
283
+ const pullRequest = context.payload.pull_request
284
+ const repository = context.repo
285
+
286
+ const reviewers = [
287
+ "ergebnis-bot",
288
+ ]
289
+
290
+ await github.pulls.createReviewRequest({
291
+ owner: repository.owner,
292
+ pull_number: pullRequest.number,
293
+ repo: repository.repo,
294
+ reviewers: reviewers,
295
+ })
296
+
297
+ - name : " Assign @ergebnis-bot"
298
+ uses : " actions/github-script@v2"
299
+ with :
300
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
301
+ script : |
302
+ const pullRequest = context.payload.pull_request
303
+ const repository = context.repo
304
+
305
+ const reviewers = [
306
+ "ergebnis-bot",
307
+ ]
308
+
309
+ await github.issues.addAssignees({
310
+ assignees: reviewers,
311
+ issue_number: pullRequest.number,
312
+ owner: repository.owner,
313
+ repo: repository.repo,
314
+ })
315
+
316
+ - name : " Approve pull request"
317
+ uses : " actions/github-script@v2"
318
+ if : " github.actor != 'ergebnis-bot'"
319
+ with :
320
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
321
+ script : |
322
+ const pullRequest = context.payload.pull_request
323
+ const repository = context.repo
324
+
325
+ await github.pulls.createReview({
326
+ event: "APPROVE",
327
+ owner: repository.owner,
328
+ pull_number: pullRequest.number,
329
+ repo: repository.repo,
330
+ })
331
+
100
332
- name : " Merge pull request"
101
333
uses : " actions/github-script@v2"
102
334
with :
103
- github-token : " ${{ secrets.GITHUB_TOKEN }}"
335
+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
104
336
script : |
105
337
const pullRequest = context.payload.pull_request
106
338
const repository = context.repo
0 commit comments