Skip to content

Commit

Permalink
Merge pull request #651 from ergebnis/feature/synchronize
Browse files Browse the repository at this point in the history
Enhancement: Synchronize with `ergebnis/php-package-template`
  • Loading branch information
localheinz committed Jun 29, 2023
2 parents bbe631a + 5c87d71 commit e97e6de
Show file tree
Hide file tree
Showing 41 changed files with 295 additions and 237 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-size
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

* @ergebnis-bot @localheinz
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Run
make
```

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

## Help

Expand Down
17 changes: 17 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Security Policy

## Supported Versions

The following versions of `ergebnis/license` have active support:

- `^2.1.0`

## Unsupported Versions

The following versions of `ergebnis/license` have reached their end of life:

- `<2.1.0`

## Reporting a Vulnerability

If you believe that you have found a security vulnerability, please send an email to `[email protected]`. Ensure to include all details required to understand the severity of the issue.
2 changes: 2 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ repository:
description: ":briefcase: Provides an abstraction of an open-source license."
enable_automated_security_fixes: true
enable_vulnerability_alerts: true
has_discussions: false
has_downloads: true
has_issues: true
has_pages: false
has_projects: false
has_wiki: false
is_template: false
name: "license"
private: false

Expand Down
55 changes: 44 additions & 11 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "xdebug"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand All @@ -39,6 +39,9 @@ jobs:
- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand Down Expand Up @@ -93,7 +96,7 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -121,7 +124,7 @@ jobs:
run: "composer normalize --ansi --dry-run"

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

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/[email protected]"
Expand Down Expand Up @@ -156,13 +159,16 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"
tools: "phive"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand Down Expand Up @@ -207,12 +213,15 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "xdebug"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand Down Expand Up @@ -254,12 +263,15 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand All @@ -276,7 +288,7 @@ jobs:
dependencies: "${{ matrix.dependencies }}"

- name: "Create cache directory for rector/rector"
run: "mkdir -p .build/rector"
run: "mkdir -p .build/rector/"

- name: "Cache cache directory for rector/rector"
uses: "actions/[email protected]"
Expand Down Expand Up @@ -311,7 +323,7 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand All @@ -320,6 +332,21 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

- name: "Cache dependencies installed with composer"
uses: "actions/[email protected]"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/[email protected]"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Check installed packages for security vulnerability advisories"
run: "composer audit --ansi"

Expand All @@ -344,12 +371,15 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, curl, dom, json, mbstring, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand All @@ -366,7 +396,7 @@ jobs:
dependencies: "${{ matrix.dependencies }}"

- name: "Create cache directory for vimeo/psalm"
run: "mkdir -p .build/psalm"
run: "mkdir -p .build/psalm/"

- name: "Run vimeo/psalm"
run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4"
Expand Down Expand Up @@ -395,7 +425,7 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand All @@ -404,6 +434,9 @@ jobs:
- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/[email protected]"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: "shivammathur/[email protected]"
with:
coverage: "none"
extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.build/
/.notes/
/.note/
/.phive/
/vendor/
!/.phive/phars.xml
5 changes: 2 additions & 3 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
->exclude([
'.build/',
'.github/',
'.notes/',
'.note/',
])
->ignoreDotFiles(false)
->in(__DIR__)
->name('.php-cs-fixer.php');
->in(__DIR__);

$config->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php-cs-fixer.cache');

Expand Down
2 changes: 1 addition & 1 deletion .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extends: "default"

ignore: |
.build/
.notes/
.note/
vendor/
rules:
Expand Down
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ it: refactoring coding-standards security-analysis static-code-analysis tests ##

.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit
mkdir -p .build/phpunit
mkdir -p .build/phpunit/
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text

.PHONY: coding-standards
coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
yamllint -c .yamllint.yaml --strict .
composer normalize
mkdir -p .build/php-cs-fixer
mkdir -p .build/php-cs-fixer/
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose

.PHONY: dependency-analysis
Expand All @@ -23,16 +23,17 @@ help: ## Displays this list of targets with descriptions

.PHONY: mutation-tests
mutation-tests: vendor ## Runs mutation tests with infection/infection
mkdir -p .build/infection
mkdir -p .build/infection/
vendor/bin/infection --configuration=infection.json

.PHONY: phive
phive: .phive## Installs dependencies with phive
mkdir -p .build/phive
phive: .phive ## Installs dependencies with phive
mkdir -p .build/phive/
PHIVE_HOME=.build/phive phive install --trust-gpg-keys 0x033E5F8D801A2F8D

.PHONY: refactoring
refactoring: vendor ## Runs automated refactoring with rector/rector
mkdir -p .build/rector/
vendor/bin/rector process --config=rector.php

.PHONY: security-analysis
Expand All @@ -41,19 +42,19 @@ security-analysis: vendor ## Runs a security analysis with composer

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
mkdir -p .build/psalm
mkdir -p .build/psalm/
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm
mkdir -p .build/psalm
mkdir -p .build/psalm/
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml

.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
mkdir -p .build/phpunit
mkdir -p .build/phpunit/
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml

vendor: composer.json composer.lock
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ Please have a look at [`CONTRIBUTING.md`](.github/CONTRIBUTING.md).

Please have a look at [`CODE_OF_CONDUCT.md`](https://github.com/ergebnis/.github/blob/main/CODE_OF_CONDUCT.md).

## Security Policy

Please have a look at [`SECURITY.md`](.github/SECURITY.md).

## License

This package is licensed using the MIT License.
Expand Down
18 changes: 1 addition & 17 deletions composer-require-checker.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
{
"symbol-whitelist": [
"array",
"bool",
"callable",
"false",
"float",
"int",
"iterable",
"null",
"object",
"parent",
"self",
"static",
"string",
"true",
"void"
]
"symbol-whitelist": []
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ergebnis/composer-normalize": "^2.31.0",
"ergebnis/data-provider": "^2.0.0",
"ergebnis/php-cs-fixer-config": "^5.10.0",
"ergebnis/phpunit-slow-test-detector": "^2.3.0",
"fakerphp/faker": "^1.23.0",
"infection/infection": "~0.27.0",
"phpunit/phpunit": "^10.2.2",
Expand Down
Loading

0 comments on commit e97e6de

Please sign in to comment.