Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Synchronize with ergebnis/php-library-template #232

Merged
merged 1 commit into from
Jun 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions .dependabot/config.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/.dependabot/ export-ignore
/.github/ export-ignore
/config/ export-ignore
/test/ export-ignore
Expand Down
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ For details, take a look at the following workflow configuration files:
- [`workflows/prune.yaml`](workflows/prune.yaml)
- [`workflows/release.yaml`](workflows/release.yaml)
- [`workflows/renew.yaml`](workflows/renew.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Coding Standards

We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.

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
Expand Down
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://help.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#target-branch

version: 2

updates:
- commit-message:
include: "scope"
prefix: "Build"
directory: "/"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"

- commit-message:
include: "scope"
prefix: "Build"
directory: "/"
labels:
- "dependency"
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
1 change: 0 additions & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ branches:
- "Code Coverage (7.4, locked)"
- "Coding Standards (7.2, locked)"
- "Dependency Analysis (7.4, locked)"
- "Label"
- "Mutation Tests (7.4, locked)"
- "Static Code Analysis (7.4, locked)"
- "Tests (7.2, highest)"
Expand Down
41 changes: 16 additions & 25 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand All @@ -78,7 +78,7 @@ jobs:
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -166,11 +166,11 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "${{ matrix.php-version }}-composer-locked-"
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'"
Expand All @@ -188,7 +188,7 @@ jobs:
run: "mkdir -p .build/phpstan"

- name: "Cache cache directory for phpstan/phpstan"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: ".build/phpstan"
key: "php-${{ matrix.php-version }}-phpstan-${{ github.sha }}"
Expand All @@ -201,7 +201,7 @@ jobs:
run: "mkdir -p .build/psalm"

- name: "Cache cache directory for vimeo/psalm"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: ".build/psalm"
key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}"
Expand Down Expand Up @@ -243,7 +243,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -305,7 +305,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -360,7 +360,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
Expand Down Expand Up @@ -401,14 +401,14 @@ jobs:
github.event.action == 'reopened' ||
github.event.action == 'synchronize'
) && (
(github.actor == 'dependabot-preview[bot]' && startsWith(github.event.pull_request.title, 'Build(deps-dev)')) ||
(github.actor == 'dependabot[bot]' && startsWith(github.event.pull_request.title, 'Build(deps-dev)')) ||
(github.actor == 'ergebnis-bot' && github.event.pull_request.title == 'Enhancement: Update license year') ||
(github.actor == 'localheinz' && contains(github.event.pull_request.labels.*.name, 'merge'))
)

steps:
- name: "Request review from @ergebnis-bot"
uses: "actions/github-script@0.8.0"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
Expand All @@ -426,11 +426,8 @@ jobs:
reviewers: reviewers,
})

- name: "Wait"
run: "sleep 3"

- name: "Assign @ergebnis-bot"
uses: "actions/github-script@0.8.0"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
Expand All @@ -448,11 +445,8 @@ jobs:
repo: repository.repo,
})

- name: "Wait"
run: "sleep 3"

- name: "Approve pull request"
uses: "actions/github-script@0.8.0"
uses: "actions/github-script@v2"
if: "github.actor != 'ergebnis-bot'"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
Expand All @@ -467,11 +461,8 @@ jobs:
repo: repository.repo,
})

- name: "Wait"
run: "sleep 3"

- name: "Merge pull request"
uses: "actions/github-script@0.8.0"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prune.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: "Prune issues and pull requests"
uses: "actions/stale@v2"
uses: "actions/stale@v3"
with:
days-before-close: 5
days-before-stale: 60
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
Expand All @@ -64,7 +64,7 @@ jobs:
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v1"
uses: "actions/cache@v2"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}"
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/triage.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: "Triage"

on: # yamllint disable-line rule:truthy
pull_request: null
pull_request:
types:
- "opened"

jobs:
label:
Expand All @@ -11,8 +13,7 @@ jobs:

steps:
- name: "Add labels based on branch name"
if: "github.event.action == 'opened'"
uses: "actions/github-script@0.8.0"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
Expand Down
5 changes: 2 additions & 3 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare(strict_types=1);
*/

use Ergebnis\License;
use Ergebnis\PhpCsFixer\Config;
use Ergebnis\PhpCsFixer;

$license = License\Type\MIT::markdown(
__DIR__ . '/LICENSE.md',
Expand All @@ -26,7 +26,7 @@ $license = License\Type\MIT::markdown(

$license->save();

$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($license->header()), [
$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php71($license->header()), [
'mb_str_functions' => false,
]);

Expand All @@ -35,7 +35,6 @@ $config->getFinder()
->in(__DIR__)
->exclude([
'.build/',
'.dependabot/',
'.github/',
'.notes/',
])
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ code-coverage: vendor ## Collects coverage from running unit tests with phpunit/
vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text --testsuite=unit,integration

.PHONY: coding-standards
coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize, lints YAML files with yamllint and fixes code style issues with friendsofphp/php-cs-fixer
composer normalize
yamllint -c .yamllint.yaml --strict .
mkdir -p .build/php-cs-fixer
vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose
Expand Down Expand Up @@ -57,4 +58,3 @@ tests: vendor ## Runs auto-review, unit, and integration tests with phpunit/phpu
vendor: composer.json composer.lock
composer validate --strict
composer install --no-interaction --no-progress --no-suggest
composer normalize
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ Please have a look at [`LICENSE.md`](LICENSE.md).
## Credits

This project is based on [`breerly/factory-girl-php@0e6f1b6`](https://github.com/unhashable/factory-girl-php/tree/0e6f1b6724d39108a2e7cef68a74668b7a77b856) (originally licensed under MIT by [Grayson Koonce](https://github.com/unhashable)), which is based on [`xi/doctrine`](https://github.com/xi-project/xi-doctrine) (originally licensed under MIT by [Xi](https://github.com/xi-project)), which in turn provided a port of [`factory_bot`](https://github.com/thoughtbot/factory_girl) (originally licensed under MIT by [Joe Ferris](https://github.com/jferris) and [thoughtbot, Inc.](https://github.com/thoughtbot)).

## Curious what I am building?

:mailbox_with_mail: [Subscribe to my list](https://localheinz.com/projects/), and I will occasionally send you an email to let you know what I am working on.
14 changes: 7 additions & 7 deletions infection.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"timeout": 10,
"logs": {
"text": ".build/infection/infection-log.txt"
},
"phpUnit": {
"configDir": "test"
},
"source": {
"directories": [
"src"
]
},
"phpUnit": {
"configDir": "test\/"
},
"logs": {
"text": ".build/infection/infection-log.txt"
}
"timeout": 10
}