Skip to content

Commit

Permalink
Merge pull request #232 from localheinz/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize with ergebnis/php-library-template
  • Loading branch information
localheinz authored Oct 24, 2020
2 parents 914c66c + 7e4d13d commit 9d18171
Show file tree
Hide file tree
Showing 35 changed files with 399 additions and 146 deletions.
6 changes: 4 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
indent_size = 2

[*.neon]
indent_style = tab


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

[Makefile]
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ test/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.yamllint.yaml export-ignore
composer.lock export-ignore
Makefile export-ignore
phpstan-with-extension-baseline.neon export-ignore
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Jan0707 @localheinz
48 changes: 39 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

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

For details, see [`workflows/continuous-integration.yml`](workflows/continuous-integration.yml).
For details, take a look at the following workflow configuration files:

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

## Coding Standards

We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards.
We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.

Run
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`.

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

Run

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

Expand All @@ -22,7 +37,7 @@ We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statical

Run

```
```sh
$ make static-code-analysis
```

Expand All @@ -32,19 +47,24 @@ We are also using the baseline feature of [`phpstan/phpstan`](https://medium.com

Run

```
```sh
$ make static-code-analysis-baseline
```

to regenerate the baselines in [`../phpstan-with-extension-baseline.neon`](../phpstan-with-extension-baseline.neon) and [`../phpstan-without-extension-baseline.neon`](../phpstan-without-extension-baseline.neon).
to regenerate the baselines in

- [`../phpstan-with-extension-baseline.neon`](../phpstan-with-extension-baseline.neon)
- [`../phpstan-without-extension-baseline.neon`](../phpstan-without-extension-baseline.neon)

:exclamation: Ideally, the baselines should shrink over time.

## Tests

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

Run

```
```sh
$ make tests
```

Expand All @@ -54,8 +74,18 @@ to run all the tests.

Run

```
```sh
$ make
```

to enforce coding standards, perform a static code analysis, and run tests!
to enforce coding standards, run a static code analysis, and run tests!

## Help

:bulb: Run

```sh
$ make help
```

to display a list of available targets with corresponding descriptions.
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 #.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
# https://getcomposer.org/doc/03-cli.md#composer-cache-dir

name: "Determine composer cache directory"

description: "Determines the composer cache directory and exports it as COMPOSER_CACHE_DIR environment variable"

runs:
using: "composite"

steps:
- name: "Determine composer cache directory"
shell: "bash"
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
22 changes: 22 additions & 0 deletions .github/actions/composer/composer/install/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions

name: "Install dependencies with composer"

description: "Installs dependencies with composer"

inputs:
dependencies:
description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\""
required: true

runs:
using: "composite"

steps:
- name: "Install ${{ inputs.dependencies }} dependencies with composer"
shell: "bash"
run: "${{ github.action_path }}/run.sh"
env:
COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}"
25 changes: 25 additions & 0 deletions .github/actions/composer/composer/install/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

dependencies="${COMPOSER_INSTALL_DEPENDENCIES}"

if [[ ${dependencies} == "lowest" ]]; then
composer update --no-interaction --no-progress --no-suggest --prefer-lowest

exit $?
fi

if [[ ${dependencies} == "locked" ]]; then
composer install --no-interaction --no-progress --no-suggest

exit $?
fi

if [[ ${dependencies} == "highest" ]]; then
composer update --no-interaction --no-progress --no-suggest

exit $?
fi

echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead."

exit 1
7 changes: 4 additions & 3 deletions .github/dependabot.yml → .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# https://help.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#target-branch
# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2

updates:
- commit-message:
include: "scope"
prefix: "Build"
prefix: "composer"
directory: "/"
ignore:
- dependency-name: "phpstan/phpstan"
Expand All @@ -17,10 +17,11 @@ updates:
package-ecosystem: "composer"
schedule:
interval: "daily"
versioning-strategy: "increase"

- commit-message:
include: "scope"
prefix: "Build"
prefix: "github-actions"
directory: "/"
labels:
- "dependency"
Expand Down
Loading

0 comments on commit 9d18171

Please sign in to comment.