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 Jan 19, 2020
1 parent 5889668 commit ec4c041
Show file tree
Hide file tree
Showing 23 changed files with 210 additions and 52 deletions.
2 changes: 2 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ repository:
allow_merge_commit: true
allow_rebase_merge: false
allow_squash_merge: false
archived: false
default_branch: "master"
delete_branch_on_merge: true
description: ":musical_note: Provides a composer plugin for normalizing composer.json."
has_downloads: true
has_issues: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "none"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "none"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "none"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down Expand Up @@ -202,7 +202,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "none"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "xdebug"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down Expand Up @@ -311,7 +311,7 @@ jobs:
uses: "actions/checkout@v2.0.0"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@1.7.1"
uses: "shivammathur/setup-php@1.7.3"
with:
coverage: "none"
extensions: "${{ env.REQUIRED_PHP_EXTENSIONS }}"
Expand Down Expand Up @@ -367,8 +367,8 @@ jobs:
- name: "Run composer-normalize.phar with argument and options"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --dry-run composer.json"

approve:
name: "Approve"
review:
name: "Review"

runs-on: "ubuntu-latest"

Expand All @@ -386,3 +386,9 @@ jobs:
if: "(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') && github.event_name == 'pull_request' && startsWith(github.event.pull_request.title, 'Build(deps-dev)')"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"

- name: "Approve pull requests created by @ergebnis-bot that update the license year"
uses: "hmarr/auto-approve-action@v2.0.0"
if: "github.actor == 'ergebnis-bot' && github.event_name == 'pull_request' && github.event.pull_request.title == 'Enhancement: Update license year'"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
85 changes: 85 additions & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

name: "License"

on:
schedule:
- cron: "1 0 1 1 *"

env:
REQUIRED_PHP_EXTENSIONS: "mbstring"

jobs:
license:
name: "License"

runs-on: "ubuntu-latest"

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

dependencies:
- "locked"

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

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

- name: "Validate composer.json and composer.lock"
run: "composer validate --strict"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

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

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

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

- name: "Create cache directory for friendsofphp/php-cs-fixer"
run: "mkdir -p .build/php-cs-fixer"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v1.0.3"
with:
path: ".build/php-cs-fixer"
key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-"

- name: "Run friendsofphp/php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose"

- name: "Open pull request updating license year"
uses: "gr2m/create-or-update-pull-request-action@v1.2.9"
with:
author: "ergebnis-bot <bot@ergebn.is>"
branch: "feature/license-year"
body: |
This PR
* [x] updates the license year
commit-message: "Enhancement: Update license year"
path: "."
title: "Enhancement: Update license year"
env:
GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
24 changes: 14 additions & 10 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,30 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/

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

$header = <<<'EOF'
Copyright (c) 2018 Andreas Möller
$license = License\Type\MIT::markdown(
__DIR__ . '/LICENSE.md',
License\Range::since(
License\Year::fromString('2018'),
new \DateTimeZone('UTC')
),
License\Holder::fromString('Andreas Möller'),
License\Url::fromString('https://github.com/ergebnis/composer-normalize')
);

For the full copyright and license information, please view
the LICENSE file that was distributed with this source code.
$license->save();

@see https://github.com/ergebnis/composer-normalize
EOF;

$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($header));
$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($license->header()));

$config->getFinder()
->ignoreDotFiles(false)
Expand Down
8 changes: 4 additions & 4 deletions LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
The MIT License (MIT)
# The MIT License (MIT)

Copyright (c) 2018 Andreas Möller
Copyright (c) 2018-2020 Andreas Möller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
documentation files (the _Software_), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
THE SOFTWARE IS PROVIDED **AS IS**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
[![Continuous Deployment](https://github.com/ergebnis/composer-normalize/workflows/Continuous%20Deployment/badge.svg)](https://github.com/ergebnis/composer-normalize/actions)
[![Continuous Integration](https://github.com/ergebnis/composer-normalize/workflows/Continuous%20Integration/badge.svg)](https://github.com/ergebnis/composer-normalize/actions)
[![Schema](https://github.com/ergebnis/composer-normalize/workflows/Schema/badge.svg)](https://github.com/ergebnis/composer-normalize/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/composer-normalize/branch/master/graph/badge.svg)](https://codecov.io/gh/ergebnis/composer-normalize)
[![Type Coverage](https://shepherd.dev/github/ergebnis/composer-normalize/coverage.svg)](https://shepherd.dev/github/ergebnis/composer-normalize)

[![Latest Stable Version](https://poser.pugx.org/ergebnis/composer-normalize/v/stable)](https://packagist.org/packages/ergebnis/composer-normalize)
[![Total Downloads](https://poser.pugx.org/ergebnis/composer-normalize/downloads)](https://packagist.org/packages/ergebnis/composer-normalize)

Expand Down Expand Up @@ -532,7 +534,7 @@ Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github

## License

This package is licensed using the MIT License.
This package is licensed using the [MIT License](LICENSE.md).

## GitHub Action

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"require-dev": {
"composer/composer": "^1.7.0",
"ergebnis/license": "~0.1.0",
"ergebnis/php-cs-fixer-config": "^1.1.3",
"ergebnis/phpstan-rules": "~0.14.2",
"ergebnis/test-util": "~0.9.1",
Expand Down
60 changes: 59 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions phar/composer-normalize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Command/NormalizeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ShouldNotHappen.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

/**
* Copyright (c) 2018 Andreas Möller
* Copyright (c) 2018-2020 Andreas Möller
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* the LICENSE.md file that was distributed with this source code.
*
* @see https://github.com/ergebnis/composer-normalize
*/
Expand Down
Loading

0 comments on commit ec4c041

Please sign in to comment.