Skip to content

Commit a9db0d3

Browse files
authored
Merge pull request #327 from laminas/1.28.x-merge-up-into-2.0.x_je7Wpu2i
Merge release 1.28.0 into 2.0.x
2 parents 4b8a6bd + d0980e7 commit a9db0d3

34 files changed

+203
-108
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:21.7.3-alpine as compiler
1+
FROM node:21.7.3-alpine AS compiler
22

33
RUN mkdir -p /usr/local/source
44
WORKDIR /usr/local/source

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Currently, it identifies the following:
2626
- PHPUnit tests based on the presence of `phpunit.xml.dist` or `phpunit.xml` files.
2727
- phpcs checks based on the presence of `phpcs.xml.dist` or `phpcs.xml` files.
2828
- Psalm checks based on the presence of `psalm.xml.dist` or `psalm.xml` files.
29+
- PHPStan checks based on the presence of `phpstan.neon`, `phpstan.neon.dist` or `phpstan.dist.neon` files.
2930
- ComposerRequireChecker checks based on the presence of `composer-require-checker.json` file.
3031
- phpbench benchmarks based on the presence of a `phpbench.json`.
3132
- 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.

laminas-ci.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
"8.1",
257257
"8.2",
258258
"8.3",
259+
"8.4",
259260
"@default"
260261
]
261262
},

package-lock.json

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"dependencies": {
1515
"@actions/core": "^1.10.0",
16-
"@cfworker/json-schema": "^1.12.5",
16+
"@cfworker/json-schema": "^2.0.0",
1717
"@types/semver": "^7.3.13",
1818
"semver": "^7.3.8"
1919
},
@@ -33,7 +33,7 @@
3333
"source-map-loader": "^5.0.0",
3434
"ts-jest": "^29.0.3",
3535
"ts-node": "^10.9.1",
36-
"typescript": "~5.5.0",
36+
"typescript": "~5.7.0",
3737
"webpack": "^5.74.0",
3838
"webpack-cli": "^5.0.0"
3939
}

src/config/app.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('config/app', () => {
2424
${'~8.1'} | ${[ '8.1' ]}
2525
${'~8.1.0'} | ${[ '8.1' ]}
2626
${'~8.1.12'} | ${[ '8.1' ]}
27-
${'^8.0 || ~8.0.0 || ~8.1.12'} | ${[ '8.0', '8.1', '8.2', '8.3' ]}
27+
${'^8.0 || ~8.0.0 || ~8.1.12'} | ${[ '8.0', '8.1', '8.2', '8.3', '8.4' ]}
2828
${'<=8.1.0'} | ${[ '8.0', '8.1' ]}
2929
`('for "$constraint" === $expected', ({constraint, expected}) => {
3030
expect(gatherVersions({require: {php: constraint}})).toEqual(expected);

src/config/app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import fs, {PathLike} from 'fs';
22
import semver from 'semver';
33
import parseJsonFile from '../json';
4-
import {isToolRunningContainerDefaultPhpVersion, Tool, ToolExecutionType} from '../tools';
4+
import {isToolRunningContainerDefaultPhpVersion, Tool} from '../tools';
55
import {Logger} from '../logging';
6+
import {ToolExecutionType} from '../enum/toolExecutionType';
67
import {
78
CONTAINER_DEFAULT_PHP_VERSION,
89
CURRENT_STABLE,

src/enum/toolExecutionType.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export enum ToolExecutionType {
2+
/**
3+
* @description Executed on every supported PHP version with lowest & latest dependencies.
4+
* In case, a lock-file is present, the minimum supported PHP version will also run with LOCKED
5+
* dependencies.
6+
*/
7+
MATRIX = 'matrix',
8+
9+
/**
10+
* @description Executed on the minimum PHP version with either LOCKED or LATEST dependencies.
11+
*/
12+
STATIC = 'static',
13+
}

src/enum/toolType.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export enum ToolType {
2+
LINTER = 'linter',
3+
CODE_CHECK = 'code_check',
4+
}

src/tools.ts

Lines changed: 22 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
11
import fs, {PathLike} from 'fs';
22
import {Config} from './config/app';
3-
import {ComposerJson} from './config/composer';
4-
import parseJsonFile from './json';
53
import {CONTAINER_DEFAULT_PHP_VERSION} from './config/php';
6-
7-
export enum ToolExecutionType {
8-
/**
9-
* @description Executed on every supported PHP version with lowest & latest dependencies.
10-
* In case, a lock-file is present, the minimum supported PHP version will also run with LOCKED
11-
* dependencies.
12-
*/
13-
MATRIX = 'matrix',
14-
15-
/**
16-
* @description Executed on the minimum PHP version with either LOCKED or LATEST dependencies.
17-
*/
18-
STATIC = 'static',
19-
}
20-
21-
enum ToolType {
22-
LINTER = 'linter',
23-
CODE_CHECK = 'code_check',
24-
}
4+
import {PHPUnitTool} from './tools/phpunit';
5+
import {InfectionTool} from './tools/infection';
6+
import {PhpCodeSnifferTool} from './tools/codesniffer';
7+
import {PsalmTool} from './tools/psalm';
8+
import {ComposerRequireCheckerTool} from './tools/composerRequireChecker';
9+
import {PhpBenchTool} from './tools/phpbench';
10+
import {CodeceptionTool} from './tools/codeception';
11+
import {PhpCsFixerTool} from './tools/phpCsFixer';
12+
import {PHPStanTool} from './tools/phpstan';
13+
import {ToolExecutionType} from './enum/toolExecutionType';
14+
import {ToolType} from './enum/toolType';
2515

2616
export type Tool = {
2717
executionType: ToolExecutionType,
@@ -36,16 +26,6 @@ export type ToolRunningContainerDefaultPhpVersion = Tool & {
3626
php: typeof CONTAINER_DEFAULT_PHP_VERSION,
3727
}
3828

39-
function detectInfectionCommand(): string {
40-
const composerJson: ComposerJson = parseJsonFile('composer.json', true) as ComposerJson;
41-
42-
if (composerJson['require-dev']?.['roave/infection-static-analysis-plugin'] !== undefined) {
43-
return './vendor/bin/roave-infection-static-analysis-plugin';
44-
}
45-
46-
return './vendor/bin/infection';
47-
}
48-
4929
function backwardCompatibilityCheckTool(config: Config): ToolRunningContainerDefaultPhpVersion | null {
5030
if (!config.backwardCompatibilityCheck) {
5131
return null;
@@ -70,14 +50,14 @@ export default function createTools(config: Config): Array<Tool> {
7050
{
7151
executionType : ToolExecutionType.STATIC,
7252
name : 'Documentation Linting',
73-
command : 'markdownlint doc/book/**/*.md',
53+
command : "markdownlint 'doc/book/**/*.md'",
7454
filesToCheck : [ 'doc/book/' ],
7555
toolType : ToolType.LINTER,
7656
},
7757
{
7858
executionType : ToolExecutionType.STATIC,
7959
name : 'Documentation Linting',
80-
command : 'markdownlint docs/book/**/*.md',
60+
command : "markdownlint 'docs/book/**/*.md'",
8161
filesToCheck : [ 'docs/book/' ],
8262
toolType : ToolType.LINTER,
8363
},
@@ -95,65 +75,15 @@ export default function createTools(config: Config): Array<Tool> {
9575
filesToCheck : [ 'README.md' ],
9676
toolType : ToolType.LINTER,
9777
},
98-
{
99-
executionType : ToolExecutionType.MATRIX,
100-
name : 'PHPUnit',
101-
command : './vendor/bin/phpunit',
102-
filesToCheck : [ 'phpunit.xml.dist', 'phpunit.xml' ],
103-
toolType : ToolType.CODE_CHECK,
104-
lintConfigCommand : 'xmllint --schema vendor/phpunit/phpunit/phpunit.xsd',
105-
},
106-
{
107-
executionType : ToolExecutionType.STATIC,
108-
name : 'Infection',
109-
command : detectInfectionCommand(),
110-
filesToCheck : [ 'infection.json', 'infection.json.dist' ],
111-
toolType : ToolType.CODE_CHECK,
112-
},
113-
{
114-
executionType : ToolExecutionType.STATIC,
115-
name : 'PHPCodeSniffer',
116-
command : './vendor/bin/phpcs -q --report=checkstyle | cs2pr',
117-
filesToCheck : [ 'phpcs.xml', 'phpcs.xml.dist' ],
118-
toolType : ToolType.CODE_CHECK,
119-
lintConfigCommand : 'xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd',
120-
},
121-
{
122-
executionType : ToolExecutionType.STATIC,
123-
name : 'Psalm',
124-
command : './vendor/bin/psalm --shepherd --stats --output-format=github --no-cache',
125-
filesToCheck : [ 'psalm.xml.dist', 'psalm.xml' ],
126-
toolType : ToolType.CODE_CHECK,
127-
lintConfigCommand : 'xmllint --schema vendor/vimeo/psalm/config.xsd',
128-
},
129-
{
130-
executionType : ToolExecutionType.STATIC,
131-
name : 'Composer Require Checker',
132-
command : './vendor/bin/composer-require-checker check --config-file=composer-require-checker.json -n -v composer.json',
133-
filesToCheck : [ 'composer-require-checker.json' ],
134-
toolType : ToolType.CODE_CHECK,
135-
},
136-
{
137-
executionType : ToolExecutionType.STATIC,
138-
name : 'PHPBench',
139-
command : './vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate',
140-
filesToCheck : [ 'phpbench.json' ],
141-
toolType : ToolType.CODE_CHECK,
142-
},
143-
{
144-
executionType : ToolExecutionType.STATIC,
145-
name : 'Codeception',
146-
command : './vendor/bin/codecept run',
147-
filesToCheck : [ 'codeception.yml.dist', 'codeception.yml' ],
148-
toolType : ToolType.CODE_CHECK,
149-
},
150-
{
151-
executionType : ToolExecutionType.STATIC,
152-
name : 'PHP CS Fixer',
153-
command : './vendor/bin/php-cs-fixer fix -v --diff --dry-run',
154-
filesToCheck : [ '.php-cs-fixer.php', '.php-cs-fixer.dist.php' ],
155-
toolType : ToolType.CODE_CHECK,
156-
},
78+
PHPUnitTool,
79+
InfectionTool,
80+
PhpCodeSnifferTool,
81+
PsalmTool,
82+
ComposerRequireCheckerTool,
83+
PhpBenchTool,
84+
CodeceptionTool,
85+
PhpCsFixerTool,
86+
PHPStanTool,
15787
backwardCompatibilityCheckTool(config),
15888
].filter((tool) => tool !== null) as Tool[];
15989

0 commit comments

Comments
 (0)