Skip to content

Commit 851bb20

Browse files
authored
Merge pull request #6 from localheinz/feature/merge
Enhancement: Merge upstream/master
2 parents b2af13a + 9ba3441 commit 851bb20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1308
-905
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.github/ export-ignore
22
/tests/ export-ignore
3+
/tools/ export-ignore
34
/.editorconfig export-ignore
45
/.gitattributes export-ignore
56
/.gitignore export-ignore

.github/CONTRIBUTING.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ For details, take a look at the following workflow configuration files:
1111

1212
## Coding Standards
1313

14+
We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.
15+
1416
We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.
1517

1618
If you do not have `yamllint` installed yet, run
@@ -21,13 +23,27 @@ $ brew install yamllint
2123

2224
to install `yamllint`.
2325

26+
We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards in PHP files.
27+
2428
Run
2529

2630
```sh
2731
$ make coding-standards
2832
```
2933

30-
to detect coding standard violations.
34+
to automatically fix coding standard violations.
35+
36+
## Static Code Analysis
37+
38+
We are using [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.
39+
40+
Run
41+
42+
```sh
43+
$ make static-code-analysis
44+
```
45+
46+
to run a static code analysis.
3147

3248
## Tests
3349

@@ -49,7 +65,7 @@ Run
4965
$ make
5066
```
5167

52-
to detect coding standard violations and run tests!
68+
to enforce coding standards, run a static code analysis, and run tests!
5369

5470
## Help
5571

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
patreon: "s_bergmann"
1+
github: "sebastianbergmann"

.github/settings.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ branches:
1414
required_approving_review_count: 1
1515
required_status_checks:
1616
contexts:
17-
- "Coding Standards"
17+
- "Code Coverage (7.4, highest)"
18+
- "Coding Standards (7.1)"
1819
- "Tests (7.1, highest)"
20+
- "Tests (7.1, lowest)"
1921
- "Tests (7.2, highest)"
22+
- "Tests (7.2, lowest)"
2023
- "Tests (7.3, highest)"
24+
- "Tests (7.3, lowest)"
25+
- "Tests (7.4, highest)"
26+
- "Tests (7.4, lowest)"
27+
- "Tests (8.0, highest)"
28+
- "Tests (8.0, lowest)"
2129
strict: false
2230
restrictions: null
2331

.github/workflows/integrate.yaml

+233-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ jobs:
1414

1515
runs-on: "ubuntu-latest"
1616

17+
strategy:
18+
matrix:
19+
php-version:
20+
- "7.1"
21+
1722
steps:
1823
- name: "Checkout"
1924
uses: "actions/[email protected]"
@@ -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+
uses: "actions/[email protected]"
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+
uses: "actions/[email protected]"
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+
uses: "actions/[email protected]"
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

.github/workflows/prune.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
with:
1919
days-before-close: 5
2020
days-before-stale: 60
21-
repo-token: "${{ secrets.GITHUB_TOKEN }}"
21+
repo-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
2222
stale-issue-label: "stale"
2323
stale-issue-message: |
2424
Since this issue has not had any activity within the last sixty days, I have marked it as stale.

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: "Create release"
2222
uses: "actions/[email protected]"
2323
env:
24-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
24+
ERGEBNIS_BOT_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
2525
with:
2626
draft: false
2727
prerelease: false

.github/workflows/triage.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: "Add labels based on branch name"
1818
uses: "actions/github-script@v2"
1919
with:
20-
github-token: "${{ secrets.GITHUB_TOKEN }}"
20+
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
2121
script: |
2222
const branchPrefixLabels = {
2323
feature: "enhancement",

0 commit comments

Comments
 (0)