Skip to content

Commit

Permalink
Enhancement: Synchronize with ergebnis/php-package-template
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Nov 18, 2024
1 parent bfe6dca commit fdcf78f
Show file tree
Hide file tree
Showing 21 changed files with 593 additions and 946 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ indent_size = 2
[*.md]
indent_size = 2

[*.neon]
indent_style = tab

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

Expand Down
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
/composer.lock export-ignore
/infection.json export-ignore
/Makefile export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon export-ignore
/rector.php export-ignore
46 changes: 46 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at am@localheinz.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CONTRIBUTING
# Contributing

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

Expand Down Expand Up @@ -84,7 +84,7 @@ to run a security analysis.

## Static Code Analysis

We use [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code.
We use [`phpstan/phpstan`](https://github.com/phpstan/phpstan) to statically analyze the code.

Run

Expand All @@ -94,15 +94,15 @@ make static-code-analysis

to run a static code analysis.

We also use the baseline feature of [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file).
We also use the baseline feature of [`phpstan/phpstan`](https://phpstan.org/user-guide/baseline).

Run

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

to regenerate the baseline in [`../psalm-baseline.xml`](../psalm-baseline.xml).
to regenerate the baseline in [`../phpstan-baseline.neon`](../phpstan-baseline.neon).

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

Expand Down
5 changes: 5 additions & 0 deletions .github/FUNDING.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository

github:
- "ergebnis"
- "localheinz"
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

-
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This pull request

- [x]

Follows #.
Related to #.
Fixes #.
4 changes: 2 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
interval: "weekly"
versioning-strategy: "increase"

- commit-message:
Expand All @@ -26,4 +26,4 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
interval: "weekly"
38 changes: 28 additions & 10 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down Expand Up @@ -102,14 +105,16 @@ jobs:
coverage: "none"
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 root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand All @@ -125,13 +130,8 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Install dependencies with phive"
uses: "ergebnis/.github/actions/phive/install@1.9.2"
with:
trust-gpg-keys: "0xC00543248C87FB13,0x033E5F8D801A2F8D"

- name: "Run ergebnis/composer-normalize"
run: ".phive/composer-normalize --ansi --dry-run"
run: "composer normalize --ansi --dry-run"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v4.1.2"
Expand Down Expand Up @@ -178,6 +178,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand All @@ -196,7 +199,7 @@ jobs:
- name: "Install dependencies with phive"
uses: "ergebnis/.github/actions/phive/install@1.9.2"
with:
trust-gpg-keys: "0xC00543248C87FB13,0x033E5F8D801A2F8D"
trust-gpg-keys: "0x033E5F8D801A2F8D"

- name: "Run maglnet/composer-require-checker"
run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose"
Expand Down Expand Up @@ -233,6 +236,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down Expand Up @@ -285,6 +291,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down Expand Up @@ -344,6 +353,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down Expand Up @@ -394,6 +406,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand All @@ -409,8 +424,8 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run vimeo/psalm"
run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4"
- name: "Run phpstan/phpstan"
run: "vendor/bin/phpstan --ansi --configuration=phpstan.neon --memory-limit=-1"

tests:
name: "Tests"
Expand Down Expand Up @@ -454,6 +469,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/renew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"

- name: "Determine composer root version"
uses: "ergebnis/.github/actions/composer/determine-root-version@1.9.2"

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2"

Expand Down
3 changes: 1 addition & 2 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-normalize" version="^2.42.0" installed="2.42.0" location="./.phive/composer-normalize" copy="false"/>
<phar name="composer-require-checker" version="^3.8.0" installed="3.8.0" location="./.phive/composer-require-checker" copy="false"/>
<phar name="composer-require-checker" version="^3.8.0" installed="3.8.0" location="./.phive/composer-require-checker" copy="false"/>
</phive>
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
it: refactoring coding-standards security-analysis static-code-analysis tests ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, and tests targets

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

.PHONY: coding-standards
coding-standards: phive vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
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 .
.phive/composer-normalize
composer normalize
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --show-progress=dots --verbose

.PHONY: dependency-analysis
Expand All @@ -25,7 +25,7 @@ mutation-tests: vendor ## Runs mutation tests with infection/infection

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

.PHONY: refactoring
refactoring: vendor ## Runs automated refactoring with rector/rector
Expand All @@ -36,14 +36,14 @@ security-analysis: vendor ## Runs a security analysis with composer
composer audit

.PHONY: static-code-analysis
static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1

.PHONY: static-code-analysis-baseline
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm
vendor/bin/psalm --config=psalm.xml --clear-cache
vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml
static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with phpstan/phpstan
vendor/bin/phpstan clear-result-cache --configuration=phpstan.neon
vendor/bin/phpstan --allow-empty-baseline --configuration=phpstan.neon --generate-baseline=phpstan-baseline.neon --memory-limit=-1

.PHONY: tests
tests: vendor ## Runs unit tests with phpunit/phpunit
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[![Renew](https://github.com/ergebnis/json-schema-validator/workflows/Renew/badge.svg)](https://github.com/ergebnis/json-schema-validator/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/json-schema-validator/branch/main/graph/badge.svg)](https://codecov.io/gh/ergebnis/json-schema-validator)
[![Type Coverage](https://shepherd.dev/github/ergebnis/json-schema-validator/coverage.svg)](https://shepherd.dev/github/ergebnis/json-schema-validator)

[![Latest Stable Version](https://poser.pugx.org/ergebnis/json-schema-validator/v/stable)](https://packagist.org/packages/ergebnis/json-schema-validator)
[![Total Downloads](https://poser.pugx.org/ergebnis/json-schema-validator/downloads)](https://packagist.org/packages/ergebnis/json-schema-validator)
Expand Down
17 changes: 13 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@
"justinrainbow/json-schema": "^5.2.12"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.44.0",
"ergebnis/data-provider": "^3.3.0",
"ergebnis/license": "^2.5.0",
"ergebnis/php-cs-fixer-config": "^6.37.0",
"ergebnis/phpunit-slow-test-detector": "^2.16.1",
"fakerphp/faker": "^1.24.0",
"infection/infection": "~0.26.6",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^1.12.10",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpstan/phpstan-phpunit": "^1.4.0",
"phpstan/phpstan-strict-rules": "^1.6.1",
"phpunit/phpunit": "^9.6.20",
"psalm/plugin-phpunit": "~0.19.0",
"rector/rector": "^1.2.10",
"vimeo/psalm": "^5.26.1"
"rector/rector": "^1.2.10"
},
"autoload": {
"psr-4": {
Expand All @@ -52,7 +56,9 @@
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
"ergebnis/composer-normalize": true,
"infection/extension-installer": true,
"phpstan/extension-installer": true
},
"audit": {
"abandoned": "report"
Expand All @@ -64,6 +70,9 @@
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-main": "4.3-dev"
},
"composer-normalize": {
"indent-size": 2,
"indent-style": "space"
Expand Down
Loading

0 comments on commit fdcf78f

Please sign in to comment.