Skip to content

Commit

Permalink
Enhancement: Synchronize with ergebnis/php-library-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jul 5, 2020
1 parent bd5661d commit f44dddd
Show file tree
Hide file tree
Showing 20 changed files with 530 additions and 65 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
indent_size = 2

[*.{yaml,yml}]
indent_size = 2

[Makefile]
indent_style = tab
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.github/ export-ignore
/tests/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/Makefile export-ignore
/phpunit.xml export-ignore
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

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.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

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.

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.

## Scope

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.

## Enforcement

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.

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.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
62 changes: 62 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# CONTRIBUTING

We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system.

For details, take a look at the following workflow configuration files:

- [`workflows/integrate.yaml`](workflows/integrate.yaml)
- [`workflows/prune.yaml`](workflows/prune.yaml)
- [`workflows/release.yaml`](workflows/release.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Coding Standards

We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files.

If you do not have `yamllint` installed yet, run

```sh
$ brew install yamllint
```

to install `yamllint`.

Run

```sh
$ make coding-standards
```

to detect coding standard violations.

## Tests

We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development.

Run

```sh
$ make tests
```

to run all the tests.

## Extra lazy?

Run

```sh
$ make
```

to detect coding standard violations and run tests!

## Help

:bulb: Run

```sh
$ make help
```

to display a list of available targets with corresponding descriptions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
patreon: s_bergmann
patreon: "s_bergmann"
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#### Steps required to reproduce the problem

1.
2.
3.

#### Expected Result

*

#### Actual Result

*
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This PR

* [x]
* [ ]

Follows #.
Related to #.
Fixes #.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2

updates:
- commit-message:
include: "scope"
prefix: "github-actions"
directory: "/"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
53 changes: 44 additions & 9 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# https://github.com/probot/settings

branches:
- name: master
- name: "master"

# https://docs.github.com/en/rest/reference/repos#delete-branch-protection
# https://docs.github.com/en/rest/reference/repos#update-branch-protection

protection:
enforce_admins: false
required_pull_request_reviews:
Expand All @@ -10,28 +14,59 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "Travis CI - Branch"
- "Travis CI - Pull Request"
- "Coding Standards"
- "Tests (7.1, highest)"
- "Tests (7.2, highest)"
- "Tests (7.3, highest)"
strict: false
restrictions: null

# https://docs.github.com/en/rest/reference/issues#create-a-label
# https://docs.github.com/en/rest/reference/issues#update-a-label

labels:
- name: bug
color: ee0701
- name: "bug"
color: "ee0701"
description: ""

- name: "dependency"
color: "0366d6"
description: ""

- name: "enhancement"
color: "0e8a16"
description: ""

- name: "merge"
color: "6f42c1"
description: ""

- name: "question"
color: "cc317c"
description: ""

- name: "security"
color: "ee0701"
description: ""

- name: "stale"
color: "eeeeee"
description: ""

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

repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
default_branch: master
archived: false
default_branch: "master"
delete_branch_on_merge: true
description: ":fork_and_knife: Fork of sebastian/diff for use with ergebnis/composer-normalize."
has_downloads: true
has_issues: false
has_pages: false
has_projects: false
has_wiki: false
name: diff
name: "diff"
private: false
113 changes: 113 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# https://docs.github.com/en/actions

name: "Integrate"

on: # yamllint disable-line rule:truthy
pull_request: null
push:
branches:
- "main"

jobs:
coding-standards:
name: "Coding Standards"

runs-on: "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.1"

- name: "Lint YAML files"
uses: "ibiqlik/action-yamllint@v1"
with:
config_file: ".yamllint.yaml"
file_or_dir: "."
strict: true

tests:
name: "Tests"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2.3.1"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies from composer.json"
if: "matrix.dependencies == 'lowest'"
run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest"

- name: "Install locked dependencies from composer.lock"
if: "matrix.dependencies == 'locked'"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Install highest dependencies from composer.json"
if: "matrix.dependencies == 'highest'"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit --configuration=phpunit.xml"

merge:
name: "Merge"

runs-on: "ubuntu-latest"

needs:
- "tests"

if: >
github.event_name == 'pull_request' &&
github.event.pull_request.draft == false && (
github.event.action == 'opened' ||
github.event.action == 'reopened' ||
github.event.action == 'synchronize'
) && (
(github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'composer(deps-dev)')) ||
(github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'github-actions(deps)')) ||
(github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
)
steps:
- name: "Merge pull request"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
await github.pulls.merge({
merge_method: "merge",
owner: repository.owner,
pull_number: pullRequest.number,
repo: repository.repo,
})

0 comments on commit f44dddd

Please sign in to comment.