Skip to content

Commit 6d71ad6

Browse files
committed
Implement #194: remove latest composer deps from default generated pipelines
This change removes `latest` from default composer dependencies in the generated CI matrix. The rationale is that `latest` dependencies tend to break our builds, and we usually run @renovate-bot or @dependabot on our repositories, keeping both `composer.json` and `composer.lock` fairly updated. Because of this kind of disciplined approach, we can assume that `latest` dependencies are already regularly tested by refreshing `composer.lock` regularly, and further testing with explicit `composer update` is considered risky, because it moves into unexplored land, breaking builds that are otherwise quite stable. We also don't want to break builds by contributors, or builds that upgrade perfectly safe to upgrade dependencies, just because a specific `latest` upstream dependency broke, and we didn't really touch it. The final objective is that CI can break, but only in commits that change `composer.json` and `composer.lock`, and those are handled every day by automation. Therefore, the default testing approach will cover `lowest` and `locked` dependencies, which both move much less than `latest`, and don't cause instability.
1 parent 753ed73 commit 6d71ad6

File tree

35 files changed

+92
-104
lines changed

35 files changed

+92
-104
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ The "job" element will have the following elements, but is not restricted to the
119119
}
120120
```
121121

122+
Note: Configuring jobs to run with `latest` composer dependencies is not endorsed.
123+
The default generated matrix will contain entries for `lowest` and `locked` dependencies.
124+
This action operates under the assumption that you do your due diligence, and keep `composer.json`
125+
and `composer.lock` updated.
126+
By operating on locked dependencies, you will be able to pinpoint the exact dependency
127+
change that caused a test regression.
128+
We endorse regularly updating dependencies with automation like [renovate](https://github.com/renovatebot) or
129+
[dependabot](https://github.com/dependabot).
130+
122131
## Configuration
123132

124133
The package can include a configuration file in its root, `.laminas-ci.json`, which can provide the following:
@@ -206,7 +215,7 @@ The easiest way to exclude a single job is via the `name` parameter:
206215
{
207216
"exclude": [
208217
{
209-
"name": "PHPUnit on PHP 8.0 with latest dependencies"
218+
"name": "PHPUnit on PHP 8.0 with lowest dependencies"
210219
}
211220
]
212221
}

laminas-ci.schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
],
2525
"exclude": [
2626
{
27-
"name": "Codeception [8.2, latest]"
27+
"name": "Codeception [8.2, lowest]"
2828
}
2929
],
3030
"ignore_php_platform_requirements": {
@@ -281,7 +281,7 @@
281281
"examples": [
282282
[
283283
{
284-
"name": "Codeception [8.2, latest]"
284+
"name": "Codeception [8.2, lowest]"
285285
}
286286
]
287287
],
@@ -290,7 +290,7 @@
290290
"title": "The job description to be excluded",
291291
"examples": [
292292
{
293-
"name": "Codeception [8.2, latest]"
293+
"name": "Codeception [8.2, lowest]"
294294
}
295295
],
296296
"required": [
@@ -303,7 +303,7 @@
303303
"description": "The name of the job to be excluded. Must be an exact match.",
304304
"minLength": 1,
305305
"examples": [
306-
"Codeception [8.2, latest]"
306+
"Codeception [8.2, lowest]"
307307
]
308308
}
309309
},
@@ -368,7 +368,7 @@
368368
"type": "string",
369369
"enum": ["latest", "lowest", "locked", "*"],
370370
"title": "The composer dependencies to be used",
371-
"description": "The composer dependencies to be used. If the wildcard `*` is passed, a list of checks is created containing each `lowest` and `latest` composer dependencies.",
371+
"description": "The composer dependencies to be used. If the wildcard `*` is passed, a list of checks is created containing each `lowest` and `locked` composer dependencies.",
372372
"default": "locked"
373373
},
374374
"command": {

src/config/app.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export const ACTION = 'laminas/laminas-continuous-integration-action@v1';
1313
export enum ComposerDependencySet {
1414
LOWEST = 'lowest',
1515
LOCKED = 'locked',
16-
LATEST = 'latest',
1716
}
1817

1918
export function gatherVersions(composerJson: ComposerJson): InstallablePhpVersionType[] {
@@ -111,10 +110,10 @@ function discoverPhpVersionsForJob(job: JobDefinitionFromFile, config: Config):
111110

112111
function discoverComposerDependencySetsForJob(job: JobDefinitionFromFile, config: Config): ComposerDependencySet[] {
113112
const dependencySetFromConfig = job.dependencies
114-
?? (config.lockedDependenciesExists ? ComposerDependencySet.LOCKED : ComposerDependencySet.LATEST);
113+
?? (config.lockedDependenciesExists ? ComposerDependencySet.LOCKED : ComposerDependencySet.LOWEST);
115114

116115
if (isAnyComposerDependencySet(dependencySetFromConfig)) {
117-
return [ ComposerDependencySet.LOWEST, ComposerDependencySet.LATEST ];
116+
return [ ComposerDependencySet.LOWEST ];
118117
}
119118

120119
return [ dependencySetFromConfig ];
@@ -295,7 +294,7 @@ function createJobsForTool(
295294
if (tool.executionType === ToolExecutionType.STATIC) {
296295
const lockedOrLatestDependencySet: ComposerDependencySet = config.lockedDependenciesExists
297296
? ComposerDependencySet.LOCKED
298-
: ComposerDependencySet.LATEST;
297+
: ComposerDependencySet.LOWEST;
299298

300299
return [
301300
createJob(
@@ -343,18 +342,7 @@ function createJobsForTool(
343342
config.ignorePhpPlatformRequirements[version] ?? false,
344343
config.additionalComposerArguments,
345344
beforeScript,
346-
), tool) as JobFromTool,
347-
348-
createJob(tool.name, createJobDefinition(
349-
tool.command,
350-
version,
351-
ComposerDependencySet.LATEST,
352-
config.phpExtensions,
353-
config.phpIni,
354-
config.ignorePhpPlatformRequirements[version] ?? false,
355-
config.additionalComposerArguments,
356-
beforeScript,
357-
), tool) as JobFromTool,
345+
), tool) as JobFromTool
358346
));
359347
}
360348

tests/code-check-codeception-dist/matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
33
{
4-
"name": "Codeception [8.2, latest]",
5-
"job": "{\"command\":\"./vendor/bin/codecept run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
4+
"name": "Codeception [8.2, lowest]",
5+
"job": "{\"command\":\"./vendor/bin/codecept run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-codeception-nodist/matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
33
{
4-
"name": "Codeception [8.2, latest]",
5-
"job": "{\"command\":\"./vendor/bin/codecept run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
4+
"name": "Codeception [8.2, lowest]",
5+
"job": "{\"command\":\"./vendor/bin/codecept run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-composer-require-checker/matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
33
{
4-
"name": "Composer Require Checker [8.2, latest]",
5-
"job": "{\"command\":\"./vendor/bin/composer-require-checker check --config-file=composer-require-checker.json -n -v composer.json\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
4+
"name": "Composer Require Checker [8.2, lowest]",
5+
"job": "{\"command\":\"./vendor/bin/composer-require-checker check --config-file=composer-require-checker.json -n -v composer.json\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-deprecated-exclusion-via-config/.laminas-ci.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
},
77
{
88
"name": "PHPUnit on PHP 8.2 with locked dependencies"
9-
},
10-
{
11-
"name": "PHPUnit on PHP 8.2 with latest dependencies"
129
}
1310
]
1411
}

tests/code-check-exclusion-via-config/.laminas-ci.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
},
77
{
88
"name": "PHPUnit [8.2, locked]"
9-
},
10-
{
11-
"name": "PHPUnit [8.2, latest]"
129
}
1310
]
1411
}

tests/code-check-infection-dist/matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
33
{
4-
"name": "Infection [8.2, latest]",
5-
"job": "{\"command\":\"./vendor/bin/infection\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
4+
"name": "Infection [8.2, lowest]",
5+
"job": "{\"command\":\"./vendor/bin/infection\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

tests/code-check-infection-nodist/matrix.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"include": [
33
{
4-
"name": "Infection [8.2, latest]",
5-
"job": "{\"command\":\"./vendor/bin/infection\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
4+
"name": "Infection [8.2, lowest]",
5+
"job": "{\"command\":\"./vendor/bin/infection\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
66
"operatingSystem": "ubuntu-latest",
77
"action": "laminas/laminas-continuous-integration-action@v1"
88
}

0 commit comments

Comments
 (0)