Skip to content

Commit d17f86c

Browse files
authored
Merge pull request #7 from localheinz/feature/synchronize
Enhancement: Synchronize with ergebnis/php-library-template
2 parents bd5661d + f44dddd commit d17f86c

20 files changed

+530
-65
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
10+
[*.json]
11+
indent_size = 2
12+
13+
[*.{yaml,yml}]
14+
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.github/ export-ignore
2+
/tests/ export-ignore
3+
/.editorconfig export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.php_cs.dist export-ignore
7+
/Makefile export-ignore
8+
/phpunit.xml export-ignore

.github/CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at am@localheinz.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

.github/CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# CONTRIBUTING
2+
3+
We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system.
4+
5+
For details, take a look at the following workflow configuration files:
6+
7+
- [`workflows/integrate.yaml`](workflows/integrate.yaml)
8+
- [`workflows/prune.yaml`](workflows/prune.yaml)
9+
- [`workflows/release.yaml`](workflows/release.yaml)
10+
- [`workflows/triage.yaml`](workflows/triage.yaml)
11+
12+
## Coding Standards
13+
14+
We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.
15+
16+
If you do not have `yamllint` installed yet, run
17+
18+
```sh
19+
$ brew install yamllint
20+
```
21+
22+
to install `yamllint`.
23+
24+
Run
25+
26+
```sh
27+
$ make coding-standards
28+
```
29+
30+
to detect coding standard violations.
31+
32+
## Tests
33+
34+
We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.
35+
36+
Run
37+
38+
```sh
39+
$ make tests
40+
```
41+
42+
to run all the tests.
43+
44+
## Extra lazy?
45+
46+
Run
47+
48+
```sh
49+
$ make
50+
```
51+
52+
to detect coding standard violations and run tests!
53+
54+
## Help
55+
56+
:bulb: Run
57+
58+
```sh
59+
$ make help
60+
```
61+
62+
to display a list of available targets with corresponding descriptions.

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
patreon: s_bergmann
1+
patreon: "s_bergmann"

.github/ISSUE_TEMPLATE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#### Steps required to reproduce the problem
2+
3+
1.
4+
2.
5+
3.
6+
7+
#### Expected Result
8+
9+
*
10+
11+
#### Actual Result
12+
13+
*

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This PR
2+
3+
* [x]
4+
* [ ]
5+
6+
Follows #.
7+
Related to #.
8+
Fixes #.

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
2+
3+
version: 2
4+
5+
updates:
6+
- commit-message:
7+
include: "scope"
8+
prefix: "github-actions"
9+
directory: "/"
10+
labels:
11+
- "dependency"
12+
open-pull-requests-limit: 10
13+
package-ecosystem: "github-actions"
14+
schedule:
15+
interval: "daily"

.github/settings.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# https://github.com/probot/settings
22

33
branches:
4-
- name: master
4+
- name: "master"
5+
6+
# https://docs.github.com/en/rest/reference/repos#delete-branch-protection
7+
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
8+
59
protection:
610
enforce_admins: false
711
required_pull_request_reviews:
@@ -10,28 +14,59 @@ branches:
1014
required_approving_review_count: 1
1115
required_status_checks:
1216
contexts:
13-
- "Travis CI - Branch"
14-
- "Travis CI - Pull Request"
17+
- "Coding Standards"
18+
- "Tests (7.1, highest)"
19+
- "Tests (7.2, highest)"
20+
- "Tests (7.3, highest)"
1521
strict: false
1622
restrictions: null
1723

24+
# https://docs.github.com/en/rest/reference/issues#create-a-label
25+
# https://docs.github.com/en/rest/reference/issues#update-a-label
26+
1827
labels:
19-
- name: bug
20-
color: ee0701
28+
- name: "bug"
29+
color: "ee0701"
30+
description: ""
31+
32+
- name: "dependency"
33+
color: "0366d6"
34+
description: ""
35+
36+
- name: "enhancement"
37+
color: "0e8a16"
38+
description: ""
39+
40+
- name: "merge"
41+
color: "6f42c1"
42+
description: ""
43+
44+
- name: "question"
45+
color: "cc317c"
46+
description: ""
47+
48+
- name: "security"
49+
color: "ee0701"
50+
description: ""
51+
52+
- name: "stale"
53+
color: "eeeeee"
54+
description: ""
2155

22-
- name: enhancement
23-
color: 0e8a16
56+
# https://docs.github.com/en/rest/reference/repos#update-a-repository
2457

2558
repository:
2659
allow_merge_commit: true
2760
allow_rebase_merge: false
2861
allow_squash_merge: false
29-
default_branch: master
62+
archived: false
63+
default_branch: "master"
64+
delete_branch_on_merge: true
3065
description: ":fork_and_knife: Fork of sebastian/diff for use with ergebnis/composer-normalize."
3166
has_downloads: true
3267
has_issues: false
3368
has_pages: false
3469
has_projects: false
3570
has_wiki: false
36-
name: diff
71+
name: "diff"
3772
private: false

.github/workflows/integrate.yaml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# https://docs.github.com/en/actions
2+
3+
name: "Integrate"
4+
5+
on: # yamllint disable-line rule:truthy
6+
pull_request: null
7+
push:
8+
branches:
9+
- "main"
10+
11+
jobs:
12+
coding-standards:
13+
name: "Coding Standards"
14+
15+
runs-on: "ubuntu-latest"
16+
17+
steps:
18+
- name: "Checkout"
19+
uses: "actions/checkout@v2.3.1"
20+
21+
- name: "Lint YAML files"
22+
uses: "ibiqlik/action-yamllint@v1"
23+
with:
24+
config_file: ".yamllint.yaml"
25+
file_or_dir: "."
26+
strict: true
27+
28+
tests:
29+
name: "Tests"
30+
31+
runs-on: "ubuntu-latest"
32+
33+
strategy:
34+
matrix:
35+
php-version:
36+
- "7.1"
37+
- "7.2"
38+
- "7.3"
39+
40+
dependencies:
41+
- "highest"
42+
43+
steps:
44+
- name: "Checkout"
45+
uses: "actions/checkout@v2.3.1"
46+
47+
- name: "Install PHP with extensions"
48+
uses: "shivammathur/setup-php@v2"
49+
with:
50+
coverage: "none"
51+
php-version: "${{ matrix.php-version }}"
52+
53+
- name: "Determine composer cache directory"
54+
id: "determine-composer-cache-directory"
55+
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""
56+
57+
- name: "Cache dependencies installed with composer"
58+
uses: "actions/cache@v2"
59+
with:
60+
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
61+
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
62+
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
63+
64+
- name: "Install lowest dependencies from composer.json"
65+
if: "matrix.dependencies == 'lowest'"
66+
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"
67+
68+
- name: "Install locked dependencies from composer.lock"
69+
if: "matrix.dependencies == 'locked'"
70+
run: "composer install --no-interaction --no-progress --no-suggest"
71+
72+
- name: "Install highest dependencies from composer.json"
73+
if: "matrix.dependencies == 'highest'"
74+
run: "composer update --no-interaction --no-progress --no-suggest"
75+
76+
- name: "Run tests with phpunit/phpunit"
77+
run: "vendor/bin/phpunit --configuration=phpunit.xml"
78+
79+
merge:
80+
name: "Merge"
81+
82+
runs-on: "ubuntu-latest"
83+
84+
needs:
85+
- "tests"
86+
87+
if: >
88+
github.event_name == 'pull_request' &&
89+
github.event.pull_request.draft == false && (
90+
github.event.action == 'opened' ||
91+
github.event.action == 'reopened' ||
92+
github.event.action == 'synchronize'
93+
) && (
94+
(github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'composer(deps-dev)')) ||
95+
(github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'github-actions(deps)')) ||
96+
(github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
97+
)
98+
99+
steps:
100+
- name: "Merge pull request"
101+
uses: "actions/github-script@v2"
102+
with:
103+
github-token: "${{ secrets.GITHUB_TOKEN }}"
104+
script: |
105+
const pullRequest = context.payload.pull_request
106+
const repository = context.repo
107+
108+
await github.pulls.merge({
109+
merge_method: "merge",
110+
owner: repository.owner,
111+
pull_number: pullRequest.number,
112+
repo: repository.repo,
113+
})

0 commit comments

Comments
 (0)