1414
1515 runs-on : " ubuntu-latest"
1616
17+ strategy :
18+ matrix :
19+ php-version :
20+ - " 7.1"
21+
1722 steps :
1823 - name : " Checkout"
1924@@ -25,6 +30,115 @@ jobs:
2530 file_or_dir : " ."
2631 strict : true
2732
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+
28142 tests :
29143 name : " Tests"
30144
@@ -36,8 +150,11 @@ jobs:
36150 - " 7.1"
37151 - " 7.2"
38152 - " 7.3"
153+ - " 7.4"
154+ - " 8.0"
39155
40156 dependencies :
157+ - " lowest"
41158 - " highest"
42159
43160 steps :
@@ -76,12 +193,73 @@ jobs:
76193 - name : " Run tests with phpunit/phpunit"
77194 run : " vendor/bin/phpunit --configuration=phpunit.xml"
78195
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+
79253 merge :
80254 name : " Merge"
81255
82256 runs-on : " ubuntu-latest"
83257
84258 needs :
259+ - " backward-compatibility"
260+ - " code-coverage"
261+ - " coding-standards"
262+ - " static-code-analysis"
85263 - " tests"
86264
87265 if : >
@@ -97,10 +275,64 @@ jobs:
97275 )
98276
99277 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+
100332 - name : " Merge pull request"
101333 uses : " actions/github-script@v2"
102334 with :
103- github-token : " ${{ secrets.GITHUB_TOKEN }}"
335+ github-token : " ${{ secrets.ERGEBNIS_BOT_TOKEN }}"
104336 script : |
105337 const pullRequest = context.payload.pull_request
106338 const repository = context.repo
0 commit comments