Skip to content

Commit

Permalink
Merge pull request #1415 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 authored Dec 4, 2024
2 parents ba25aed + 9f8cb22 commit 103f306
Show file tree
Hide file tree
Showing 15 changed files with 212 additions and 949 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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
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 @@ -85,7 +85,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 @@ -95,15 +95,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
4 changes: 2 additions & 2 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "composer"
schedule:
interval: "daily"
interval: "weekly"
versioning-strategy: "increase"

- commit-message:
Expand All @@ -28,4 +28,4 @@ updates:
open-pull-requests-limit: 10
package-ecosystem: "github-actions"
schedule:
interval: "daily"
interval: "weekly"
9 changes: 6 additions & 3 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ jobs:
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Remove incompatible dependencies with composer"
run: "composer remove phpstan/extension-installer --ansi --dev --no-interaction --no-progress"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@1.9.2"
with:
Expand All @@ -213,7 +216,7 @@ jobs:
run: ".phive/box compile --ansi --config=box.json"

- name: "Show info about composer-normalize.phar with humbug/box"
run: ".phive/box info ${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi"
run: ".phive/box info ${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi --list"

- name: "Run composer-normalize.phar"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi"
Expand Down Expand Up @@ -485,8 +488,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
5 changes: 4 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Remove incompatible dependencies with composer"
run: "composer remove phpstan/extension-installer --ansi --dev --no-interaction --no-progress"

- name: "Require composer/composer"
run: "composer require composer/composer:${{ env.COMPOSER_VERSION }} --ansi --no-interaction --no-progress"

Expand All @@ -72,7 +75,7 @@ jobs:
run: ".phive/box compile --ansi --config=box.json"

- name: "Show info about composer-normalize.phar with humbug/box"
run: ".phive/box info ${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi"
run: ".phive/box info ${{ env.COMPOSER_NORMALIZE_PHAR }} --ansi --list"

- name: "Run composer-normalize.phar"
run: "${{ env.COMPOSER_NORMALIZE_PHAR }}"
Expand Down
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?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-normalize" version="^2.44.0" installed="2.44.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="humbug/box" version="^3.16.0" installed="3.16.0" location="./.phive/box" copy="false"/>
</phive>
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ COMPOSER_VERSION:=2.8.3
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 and integration tests with phpunit/phpunit
code-coverage: vendor ## Collects code coverage from running unit and integration tests with phpunit/phpunit
vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-text

.PHONY: coding-standards
Expand All @@ -28,10 +28,11 @@ mutation-tests: vendor ## Runs mutation tests with infection/infection
.PHONY: phar
phar: phive vendor ## Builds a phar with humbug/box
.phive/box validate box.json
composer remove phpstan/extension-installer --dev --no-interaction
composer require composer/composer:${COMPOSER_VERSION} --no-interaction --no-progress --update-with-dependencies
.phive/box compile --config=box.json
git checkout HEAD -- composer.json composer.lock
.phive/box info .build/phar/composer-normalize.phar
.phive/box info .build/phar/composer-normalize.phar --list
.build/phar/composer-normalize.phar
.build/phar/composer-normalize.phar --dry-run composer.json
.build/phar/composer-normalize.phar --dry-run --no-ansi composer.json
Expand All @@ -54,14 +55,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 and integration 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 @@ -7,7 +7,6 @@
[![Update](https://github.com/ergebnis/composer-normalize/workflows/Update/badge.svg)](https://github.com/ergebnis/composer-normalize/actions)

[![Code Coverage](https://codecov.io/gh/ergebnis/composer-normalize/branch/main/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
15 changes: 11 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
"ergebnis/phpunit-slow-test-detector": "^2.17.0",
"fakerphp/faker": "^1.24.1",
"infection/infection": "~0.26.6",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^1.12.12",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpstan/phpstan-phpunit": "^1.4.1",
"phpstan/phpstan-strict-rules": "^1.6.1",
"phpunit/phpunit": "^9.6.20",
"psalm/plugin-phpunit": "~0.19.0",
"rector/rector": "^1.2.10",
"symfony/filesystem": "^5.4.41",
"vimeo/psalm": "^5.26.1"
"symfony/filesystem": "^5.4.41"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -60,7 +63,8 @@
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"infection/extension-installer": true
"infection/extension-installer": true,
"phpstan/extension-installer": true
},
"audit": {
"abandoned": "report"
Expand All @@ -72,6 +76,9 @@
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-main": "2.44-dev"
},
"class": "Ergebnis\\Composer\\Normalize\\NormalizePlugin",
"composer-normalize": {
"indent-size": 2,
Expand Down
Loading

0 comments on commit 103f306

Please sign in to comment.