Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

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 Jun 14, 2020
1 parent c83d674 commit d80aa54
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 77 deletions.
14 changes: 0 additions & 14 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
/test/ export-ignore
/.editorconfig export-ignore
Expand Down
21 changes: 12 additions & 9 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ 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

```
```sh
$ brew install yamllint
```

Expand All @@ -25,7 +28,7 @@ We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-C

Run

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

Expand All @@ -37,7 +40,7 @@ We are using [`maglnet/composer-require-checker`](https://github.com/maglnet/Com

Run

```
```sh
$ make dependency-analysis
```

Expand All @@ -49,7 +52,7 @@ We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo

Run

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

Expand All @@ -59,7 +62,7 @@ We are also using the baseline features of [`phpstan/phpstan`](https://medium.co

Run

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

Expand All @@ -73,7 +76,7 @@ We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) t

Run

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

Expand All @@ -85,7 +88,7 @@ We are using [`infection/infection`](https://github.com/infection/infection) to

Enable `pcov` or `Xdebug` and run

```
```sh
$ make mutation-tests
```

Expand All @@ -95,7 +98,7 @@ to run mutation tests.

Run

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

Expand All @@ -105,7 +108,7 @@ to enforce coding standards, run a static code analysis, and run tests!

:bulb: Run

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

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"
20 changes: 10 additions & 10 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ branches:
required_approving_review_count: 1
required_status_checks:
contexts:
- "Code Coverage (7.4, locked)"
- "Coding Standards (7.1, locked)"
- "Dependency Analysis (7.4, locked)"
- "Mutation Tests (7.4, locked)"
- "Static Code Analysis (7.4, locked)"
- "Tests (7.1, lowest)"
- "Tests (7.1, locked)"
- "Tests (7.1, highest)"
- "Tests (7.2, lowest)"
- "Tests (7.2, locked)"
- "Tests (7.1, locked)"
- "Tests (7.1, lowest)"
- "Tests (7.2, highest)"
- "Tests (7.3, lowest)"
- "Tests (7.3, locked)"
- "Tests (7.2, locked)"
- "Tests (7.2, lowest)"
- "Tests (7.3, highest)"
- "Tests (7.4, lowest)"
- "Tests (7.4, locked)"
- "Tests (7.3, locked)"
- "Tests (7.3, lowest)"
- "Tests (7.4, highest)"
- "Code Coverage (7.4, locked)"
- "Mutation Tests (7.4, locked)"
- "Tests (7.4, locked)"
- "Tests (7.4, lowest)"
strict: false
restrictions:

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 @@ -119,7 +119,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 @@ -171,11 +171,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 @@ -193,7 +193,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 @@ -206,7 +206,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 @@ -249,7 +249,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 @@ -363,7 +363,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 @@ -404,14 +404,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 @@ -429,11 +429,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 @@ -451,11 +448,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 @@ -470,11 +464,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@v1"
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
43 changes: 43 additions & 0 deletions .github/workflows/triage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "Triage"

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

jobs:
label:
name: "Label"

runs-on: "ubuntu-latest"

steps:
- name: "Add labels based on branch name"
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const branchPrefixLabels = {
feature: "enhancement",
fix: "bug",
}
const pullRequest = context.payload.pull_request
const repository = context.repo
const branchName = pullRequest.head.ref
const matches = branchName.match(new RegExp('^([^/]+)\/'));
if (matches instanceof Array && branchPrefixLabels.hasOwnProperty(matches[1])) {
const label = branchPrefixLabels[matches[1]]
github.issues.addLabels({
issue_number: pullRequest.number,
labels: [
label
],
owner: repository.owner,
repo: repository.repo,
});
}
Loading

0 comments on commit d80aa54

Please sign in to comment.