Skip to content

Merge release 1.29.0 into 2.0.x #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: 2.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2e28ad6
8.4 Missing in Schema Enum
gsteel Aug 8, 2024
2edec71
Merge pull request #310 from gsteel/fix-missing-8.4-in-schema
gsteel Aug 8, 2024
faa4e11
Merge pull request #311 from laminas/1.27.x-merge-up-into-1.28.x_sfLV…
gsteel Aug 8, 2024
e1dadb8
Quote glob argument for `markdownlint`
gsteel Sep 10, 2024
b08a9a0
Merge pull request #314 from gsteel/mdlint
Xerkus Sep 10, 2024
3210518
Update dependency typescript to ~5.6.0
renovate[bot] Sep 9, 2024
ed4ff07
Merge pull request #316 from laminas/1.27.x-merge-up-into-1.28.x_6F2y…
gsteel Sep 10, 2024
792373f
Update dependency @cfworker/json-schema to v2
renovate[bot] Sep 10, 2024
c280446
qa: introduce tests for phpstan tool detection
boesing Sep 26, 2024
d3e4794
feature: introduce `phpstan` tool detection
boesing Sep 26, 2024
32b63c2
docs: add `PHPStan` detection logic to `README`
boesing Sep 26, 2024
6fcdd55
refactor: move some tools to dedicated files
boesing Sep 26, 2024
8ef33fe
Merge pull request #312 from laminas/renovate/cfworker-json-schema-2.x
boesing Sep 26, 2024
ba2409e
Update dependency typescript to ~5.7.0 (#324)
renovate[bot] Nov 23, 2024
0f1be7a
Merge pull request #318 from boesing/feature/phpstan
gsteel Dec 9, 2024
1c85e9a
QA: Fix `AS` keyword casing
gsteel Dec 9, 2024
b0bd342
Merge pull request #326 from gsteel/Fix-As-Casing
gsteel Dec 9, 2024
0b1014f
Update dependency webpack-cli to v6
renovate[bot] Dec 19, 2024
4bfb005
qa: add test to verify php-cs-fixer is executed with checkstyle format
boesing Jan 17, 2025
6c6cccd
feature: introduce `checkstyle` format for `php-cs-fixer` tool
boesing Jan 17, 2025
60b7e8c
Merge pull request #331 from boesing/feature/php-cs-fixer-checkstyle
boesing Jan 17, 2025
c23c22f
Merge pull request #330 from laminas/renovate/webpack-cli-6.x
boesing Jan 17, 2025
5ddc6ca
Update dependency @cfworker/json-schema to v4
renovate[bot] Jan 17, 2025
7f7976e
Merge pull request #325 from laminas/renovate/cfworker-json-schema-4.x
boesing Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:21.7.3-alpine as compiler
FROM node:21.7.3-alpine AS compiler

RUN mkdir -p /usr/local/source
WORKDIR /usr/local/source
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Currently, it identifies the following:
- PHPUnit tests based on the presence of `phpunit.xml.dist` or `phpunit.xml` files.
- phpcs checks based on the presence of `phpcs.xml.dist` or `phpcs.xml` files.
- Psalm checks based on the presence of `psalm.xml.dist` or `psalm.xml` files.
- PHPStan checks based on the presence of `phpstan.neon`, `phpstan.neon.dist` or `phpstan.dist.neon` files.
- ComposerRequireChecker checks based on the presence of `composer-require-checker.json` file.
- phpbench benchmarks based on the presence of a `phpbench.json`.
- Infection mutation tests based on the presence of `infection.json` or `infection.json.dist`. In case that `roave/infection-static-analysis-plugin` is installed, this will be used instead.
Expand Down
1 change: 1 addition & 0 deletions laminas-ci.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
"8.1",
"8.2",
"8.3",
"8.4",
"@default"
]
},
Expand Down
282 changes: 217 additions & 65 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@actions/core": "^1.10.0",
"@cfworker/json-schema": "^1.12.5",
"@cfworker/json-schema": "^4.0.0",
"@types/semver": "^7.3.13",
"semver": "^7.3.8"
},
Expand All @@ -33,8 +33,8 @@
"source-map-loader": "^5.0.0",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "~5.5.0",
"typescript": "~5.7.0",
"webpack": "^5.74.0",
"webpack-cli": "^5.0.0"
"webpack-cli": "^6.0.0"
}
}
3 changes: 2 additions & 1 deletion src/config/app.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import fs, {PathLike} from 'fs';
import semver from 'semver';
import parseJsonFile from '../json';
import {isToolRunningContainerDefaultPhpVersion, Tool, ToolExecutionType} from '../tools';
import {isToolRunningContainerDefaultPhpVersion, Tool} from '../tools';
import {Logger} from '../logging';
import {ToolExecutionType} from '../enum/toolExecutionType';
import {
CONTAINER_DEFAULT_PHP_VERSION,
CURRENT_STABLE,
Expand Down
13 changes: 13 additions & 0 deletions src/enum/toolExecutionType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum ToolExecutionType {
/**
* @description Executed on every supported PHP version with lowest & latest dependencies.
* In case, a lock-file is present, the minimum supported PHP version will also run with LOCKED
* dependencies.
*/
MATRIX = 'matrix',

/**
* @description Executed on the minimum PHP version with either LOCKED or LATEST dependencies.
*/
STATIC = 'static',
}
4 changes: 4 additions & 0 deletions src/enum/toolType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum ToolType {
LINTER = 'linter',
CODE_CHECK = 'code_check',
}
114 changes: 22 additions & 92 deletions src/tools.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
import fs, {PathLike} from 'fs';
import {Config} from './config/app';
import {ComposerJson} from './config/composer';
import parseJsonFile from './json';
import {CONTAINER_DEFAULT_PHP_VERSION} from './config/php';

export enum ToolExecutionType {
/**
* @description Executed on every supported PHP version with lowest & latest dependencies.
* In case, a lock-file is present, the minimum supported PHP version will also run with LOCKED
* dependencies.
*/
MATRIX = 'matrix',

/**
* @description Executed on the minimum PHP version with either LOCKED or LATEST dependencies.
*/
STATIC = 'static',
}

enum ToolType {
LINTER = 'linter',
CODE_CHECK = 'code_check',
}
import {PHPUnitTool} from './tools/phpunit';
import {InfectionTool} from './tools/infection';
import {PhpCodeSnifferTool} from './tools/codesniffer';
import {PsalmTool} from './tools/psalm';
import {ComposerRequireCheckerTool} from './tools/composerRequireChecker';
import {PhpBenchTool} from './tools/phpbench';
import {CodeceptionTool} from './tools/codeception';
import {PhpCsFixerTool} from './tools/phpCsFixer';
import {PHPStanTool} from './tools/phpstan';
import {ToolExecutionType} from './enum/toolExecutionType';
import {ToolType} from './enum/toolType';

export type Tool = {
executionType: ToolExecutionType,
Expand All @@ -36,16 +26,6 @@ export type ToolRunningContainerDefaultPhpVersion = Tool & {
php: typeof CONTAINER_DEFAULT_PHP_VERSION,
}

function detectInfectionCommand(): string {
const composerJson: ComposerJson = parseJsonFile('composer.json', true) as ComposerJson;

if (composerJson['require-dev']?.['roave/infection-static-analysis-plugin'] !== undefined) {
return 'phpdbg -qrr ./vendor/bin/roave-infection-static-analysis-plugin';
}

return 'phpdbg -qrr ./vendor/bin/infection';
}

function backwardCompatibilityCheckTool(config: Config): ToolRunningContainerDefaultPhpVersion | null {
if (!config.backwardCompatibilityCheck) {
return null;
Expand All @@ -70,14 +50,14 @@ export default function createTools(config: Config): Array<Tool> {
{
executionType : ToolExecutionType.STATIC,
name : 'Documentation Linting',
command : 'markdownlint doc/book/**/*.md',
command : "markdownlint 'doc/book/**/*.md'",
filesToCheck : [ 'doc/book/' ],
toolType : ToolType.LINTER,
},
{
executionType : ToolExecutionType.STATIC,
name : 'Documentation Linting',
command : 'markdownlint docs/book/**/*.md',
command : "markdownlint 'docs/book/**/*.md'",
filesToCheck : [ 'docs/book/' ],
toolType : ToolType.LINTER,
},
Expand All @@ -95,65 +75,15 @@ export default function createTools(config: Config): Array<Tool> {
filesToCheck : [ 'README.md' ],
toolType : ToolType.LINTER,
},
{
executionType : ToolExecutionType.MATRIX,
name : 'PHPUnit',
command : './vendor/bin/phpunit',
filesToCheck : [ 'phpunit.xml.dist', 'phpunit.xml' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/phpunit/phpunit/phpunit.xsd',
},
{
executionType : ToolExecutionType.STATIC,
name : 'Infection',
command : detectInfectionCommand(),
filesToCheck : [ 'infection.json', 'infection.json.dist' ],
toolType : ToolType.CODE_CHECK,
},
{
executionType : ToolExecutionType.STATIC,
name : 'PHPCodeSniffer',
command : './vendor/bin/phpcs -q --report=checkstyle | cs2pr',
filesToCheck : [ 'phpcs.xml', 'phpcs.xml.dist' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd',
},
{
executionType : ToolExecutionType.STATIC,
name : 'Psalm',
command : './vendor/bin/psalm --shepherd --stats --output-format=github --no-cache',
filesToCheck : [ 'psalm.xml.dist', 'psalm.xml' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/vimeo/psalm/config.xsd',
},
{
executionType : ToolExecutionType.STATIC,
name : 'Composer Require Checker',
command : './vendor/bin/composer-require-checker check --config-file=composer-require-checker.json -n -v composer.json',
filesToCheck : [ 'composer-require-checker.json' ],
toolType : ToolType.CODE_CHECK,
},
{
executionType : ToolExecutionType.STATIC,
name : 'PHPBench',
command : './vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate',
filesToCheck : [ 'phpbench.json' ],
toolType : ToolType.CODE_CHECK,
},
{
executionType : ToolExecutionType.STATIC,
name : 'Codeception',
command : './vendor/bin/codecept run',
filesToCheck : [ 'codeception.yml.dist', 'codeception.yml' ],
toolType : ToolType.CODE_CHECK,
},
{
executionType : ToolExecutionType.STATIC,
name : 'PHP CS Fixer',
command : './vendor/bin/php-cs-fixer fix -v --diff --dry-run',
filesToCheck : [ '.php-cs-fixer.php', '.php-cs-fixer.dist.php' ],
toolType : ToolType.CODE_CHECK,
},
PHPUnitTool,
InfectionTool,
PhpCodeSnifferTool,
PsalmTool,
ComposerRequireCheckerTool,
PhpBenchTool,
CodeceptionTool,
PhpCsFixerTool,
PHPStanTool,
backwardCompatibilityCheckTool(config),
].filter((tool) => tool !== null) as Tool[];

Expand Down
10 changes: 10 additions & 0 deletions src/tools/codeception.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ToolExecutionType} from '../enum/toolExecutionType';
import {ToolType} from '../enum/toolType';

export const CodeceptionTool = {
executionType : ToolExecutionType.STATIC,
name : 'Codeception',
command : './vendor/bin/codecept run',
filesToCheck : [ 'codeception.yml.dist', 'codeception.yml' ],
toolType : ToolType.CODE_CHECK,
};
11 changes: 11 additions & 0 deletions src/tools/codesniffer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PhpCodeSnifferTool = {
executionType : ToolExecutionType.STATIC,
name : 'PHPCodeSniffer',
command : './vendor/bin/phpcs -q --report=checkstyle | cs2pr',
filesToCheck : [ 'phpcs.xml', 'phpcs.xml.dist' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd',
};
10 changes: 10 additions & 0 deletions src/tools/composerRequireChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const ComposerRequireCheckerTool = {
executionType : ToolExecutionType.STATIC,
name : 'Composer Require Checker',
command : './vendor/bin/composer-require-checker check --config-file=composer-require-checker.json -n -v composer.json',
filesToCheck : [ 'composer-require-checker.json' ],
toolType : ToolType.CODE_CHECK,
};
22 changes: 22 additions & 0 deletions src/tools/infection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {ToolType} from '../enum/toolType';
import {ComposerJson} from '../config/composer';
import parseJsonFile from '../json';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const InfectionTool = {
executionType : ToolExecutionType.STATIC,
name : 'Infection',
command : detectInfectionCommand(),
filesToCheck : [ 'infection.json', 'infection.json.dist' ],
toolType : ToolType.CODE_CHECK,
};

function detectInfectionCommand(): string {
const composerJson: ComposerJson = parseJsonFile('composer.json', true) as ComposerJson;

if (composerJson['require-dev']?.['roave/infection-static-analysis-plugin'] !== undefined) {
return 'phpdbg -qrr ./vendor/bin/roave-infection-static-analysis-plugin';
}

return 'phpdbg -qrr ./vendor/bin/infection';
}
10 changes: 10 additions & 0 deletions src/tools/phpCsFixer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PhpCsFixerTool = {
executionType : ToolExecutionType.STATIC,
name : 'PHP CS Fixer',
command : './vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr',
filesToCheck : [ '.php-cs-fixer.php', '.php-cs-fixer.dist.php' ],
toolType : ToolType.CODE_CHECK,
};
10 changes: 10 additions & 0 deletions src/tools/phpbench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PhpBenchTool = {
executionType : ToolExecutionType.STATIC,
name : 'PHPBench',
command : './vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate',
filesToCheck : [ 'phpbench.json' ],
toolType : ToolType.CODE_CHECK,
};
10 changes: 10 additions & 0 deletions src/tools/phpstan.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PHPStanTool = {
executionType : ToolExecutionType.STATIC,
name : 'PHPStan',
command : './vendor/bin/phpstan analyse --error-format=github --ansi --no-progress',
filesToCheck : [ 'phpstan.neon', 'phpstan.neon.dist', 'phpstan.dist.neon' ],
toolType : ToolType.CODE_CHECK,
};
11 changes: 11 additions & 0 deletions src/tools/phpunit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PHPUnitTool = {
executionType : ToolExecutionType.MATRIX,
name : 'PHPUnit',
command : './vendor/bin/phpunit',
filesToCheck : [ 'phpunit.xml.dist', 'phpunit.xml' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/phpunit/phpunit/phpunit.xsd',
};
11 changes: 11 additions & 0 deletions src/tools/psalm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {ToolType} from '../enum/toolType';
import {ToolExecutionType} from '../enum/toolExecutionType';

export const PsalmTool = {
executionType : ToolExecutionType.STATIC,
name : 'Psalm',
command : './vendor/bin/psalm --shepherd --stats --output-format=github --no-cache',
filesToCheck : [ 'psalm.xml.dist', 'psalm.xml' ],
toolType : ToolType.CODE_CHECK,
lintConfigCommand : 'xmllint --schema vendor/vimeo/psalm/config.xsd',
};
2 changes: 1 addition & 1 deletion tests/code-check-phpcsfixer-php-dist/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": [
{
"name": "PHP CS Fixer [7.4, latest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/code-check-phpcsfixer-php/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": [
{
"name": "PHP CS Fixer [7.4, latest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run --format=checkstyle | cs2pr\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
3 changes: 3 additions & 0 deletions tests/code-check-phpstan-alternative-dist/.laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stablePHP": "7.4"
}
10 changes: 10 additions & 0 deletions tests/code-check-phpstan-alternative-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
{
"name": "PHPStan [7.4, latest]",
"job": "{\"command\":\"./vendor/bin/phpstan analyse --error-format=github --ansi --no-progress\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions tests/code-check-phpstan-dist/.laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stablePHP": "7.4"
}
10 changes: 10 additions & 0 deletions tests/code-check-phpstan-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
{
"name": "PHPStan [7.4, latest]",
"job": "{\"command\":\"./vendor/bin/phpstan analyse --error-format=github --ansi --no-progress\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions tests/code-check-phpstan-no-dist/.laminas-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stablePHP": "7.4"
}
10 changes: 10 additions & 0 deletions tests/code-check-phpstan-no-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
{
"name": "PHPStan [7.4, latest]",
"job": "{\"command\":\"./vendor/bin/phpstan analyse --error-format=github --ansi --no-progress\",\"php\":\"7.4\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
Empty file.
Empty file.
Loading
Loading