Skip to content

Commit

Permalink
Implement laminas#194: remove latest composer deps from default gen…
Browse files Browse the repository at this point in the history
…erated 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.
  • Loading branch information
Ocramius committed Mar 3, 2023
1 parent 753ed73 commit 80449e9
Show file tree
Hide file tree
Showing 35 changed files with 92 additions and 104 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ The package can include a configuration file in its root, `.laminas-ci.json`, wh
}
```

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

### Providing specific checks to run

If you do not want to autodiscover checks to run, you can provide the "checks" configuration.
Expand Down Expand Up @@ -206,7 +215,7 @@ The easiest way to exclude a single job is via the `name` parameter:
{
"exclude": [
{
"name": "PHPUnit on PHP 8.0 with latest dependencies"
"name": "PHPUnit on PHP 8.0 with lowest dependencies"
}
]
}
Expand Down
10 changes: 5 additions & 5 deletions laminas-ci.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"exclude": [
{
"name": "Codeception [8.2, latest]"
"name": "Codeception [8.2, lowest]"
}
],
"ignore_php_platform_requirements": {
Expand Down Expand Up @@ -281,7 +281,7 @@
"examples": [
[
{
"name": "Codeception [8.2, latest]"
"name": "Codeception [8.2, lowest]"
}
]
],
Expand All @@ -290,7 +290,7 @@
"title": "The job description to be excluded",
"examples": [
{
"name": "Codeception [8.2, latest]"
"name": "Codeception [8.2, lowest]"
}
],
"required": [
Expand All @@ -303,7 +303,7 @@
"description": "The name of the job to be excluded. Must be an exact match.",
"minLength": 1,
"examples": [
"Codeception [8.2, latest]"
"Codeception [8.2, lowest]"
]
}
},
Expand Down Expand Up @@ -368,7 +368,7 @@
"type": "string",
"enum": ["latest", "lowest", "locked", "*"],
"title": "The composer dependencies to be used",
"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.",
"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.",
"default": "locked"
},
"command": {
Expand Down
20 changes: 4 additions & 16 deletions src/config/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const ACTION = 'laminas/laminas-continuous-integration-action@v1';
export enum ComposerDependencySet {
LOWEST = 'lowest',
LOCKED = 'locked',
LATEST = 'latest',
}

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

function discoverComposerDependencySetsForJob(job: JobDefinitionFromFile, config: Config): ComposerDependencySet[] {
const dependencySetFromConfig = job.dependencies
?? (config.lockedDependenciesExists ? ComposerDependencySet.LOCKED : ComposerDependencySet.LATEST);
?? (config.lockedDependenciesExists ? ComposerDependencySet.LOCKED : ComposerDependencySet.LOWEST);

if (isAnyComposerDependencySet(dependencySetFromConfig)) {
return [ ComposerDependencySet.LOWEST, ComposerDependencySet.LATEST ];
return [ ComposerDependencySet.LOWEST ];
}

return [ dependencySetFromConfig ];
Expand Down Expand Up @@ -295,7 +294,7 @@ function createJobsForTool(
if (tool.executionType === ToolExecutionType.STATIC) {
const lockedOrLatestDependencySet: ComposerDependencySet = config.lockedDependenciesExists
? ComposerDependencySet.LOCKED
: ComposerDependencySet.LATEST;
: ComposerDependencySet.LOWEST;

return [
createJob(
Expand Down Expand Up @@ -343,18 +342,7 @@ function createJobsForTool(
config.ignorePhpPlatformRequirements[version] ?? false,
config.additionalComposerArguments,
beforeScript,
), tool) as JobFromTool,

createJob(tool.name, createJobDefinition(
tool.command,
version,
ComposerDependencySet.LATEST,
config.phpExtensions,
config.phpIni,
config.ignorePhpPlatformRequirements[version] ?? false,
config.additionalComposerArguments,
beforeScript,
), tool) as JobFromTool,
), tool) as JobFromTool
));
}

Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-codeception-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Codeception [8.2, latest]",
"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\":[]}",
"name": "Codeception [8.2, lowest]",
"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\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-codeception-nodist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Codeception [8.2, latest]",
"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\":[]}",
"name": "Codeception [8.2, lowest]",
"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\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-composer-require-checker/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Composer Require Checker [8.2, latest]",
"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\":[]}",
"name": "Composer Require Checker [8.2, lowest]",
"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\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
},
{
"name": "PHPUnit on PHP 8.2 with locked dependencies"
},
{
"name": "PHPUnit on PHP 8.2 with latest dependencies"
}
]
}
3 changes: 0 additions & 3 deletions tests/code-check-exclusion-via-config/.laminas-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
},
{
"name": "PHPUnit [8.2, locked]"
},
{
"name": "PHPUnit [8.2, latest]"
}
]
}
4 changes: 2 additions & 2 deletions tests/code-check-infection-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Infection [8.2, latest]",
"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\":[]}",
"name": "Infection [8.2, lowest]",
"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\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-infection-nodist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Infection [8.2, latest]",
"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\":[]}",
"name": "Infection [8.2, lowest]",
"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\":[]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Infection [8.1, latest]",
"job": "{\"command\":\"./vendor/bin/roave-infection-static-analysis-plugin\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"name": "Infection [8.1, lowest]",
"job": "{\"command\":\"./vendor/bin/roave-infection-static-analysis-plugin\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "Infection [8.1, latest]",
"job": "{\"command\":\"./vendor/bin/roave-infection-static-analysis-plugin\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"name": "Infection [8.1, lowest]",
"job": "{\"command\":\"./vendor/bin/roave-infection-static-analysis-plugin\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"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
4 changes: 2 additions & 2 deletions tests/code-check-phpbench/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "PHPBench [8.2, latest]",
"job": "{\"command\":\"./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"name": "PHPBench [8.2, lowest]",
"job": "{\"command\":\"./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"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
4 changes: 2 additions & 2 deletions tests/code-check-phpcs-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "PHPCodeSniffer [8.2, latest]",
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist\"]}",
"name": "PHPCodeSniffer [8.2, lowest]",
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-phpcs-nodist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "PHPCodeSniffer [8.2, latest]",
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml\"]}",
"name": "PHPCodeSniffer [8.2, lowest]",
"job": "{\"command\":\"./vendor/bin/phpcs -q --report=checkstyle | cs2pr\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/code-check-phpcsfixer-php-dist/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "PHP CS Fixer [8.2, latest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"name": "PHP CS Fixer [8.2, lowest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"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
4 changes: 2 additions & 2 deletions tests/code-check-phpcsfixer-php/matrix.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"include": [
{
"name": "PHP CS Fixer [8.2, latest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[]}",
"name": "PHP CS Fixer [8.2, lowest]",
"job": "{\"command\":\"./vendor/bin/php-cs-fixer fix -v --diff --dry-run\",\"php\":\"8.2\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"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
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml.dist\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
},
{
"name": "PHPUnit [8.1, latest]",
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml.dist\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
6 changes: 0 additions & 6 deletions tests/code-check-phpunit-dist/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml.dist\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
},
{
"name": "PHPUnit [8.1, latest]",
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml.dist\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
6 changes: 0 additions & 6 deletions tests/code-check-phpunit-nodist/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"lowest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
},
{
"name": "PHPUnit [8.1, latest]",
"job": "{\"command\":\"./vendor/bin/phpunit\",\"php\":\"8.1\",\"extensions\":[],\"ini\":[],\"dependencies\":\"latest\",\"ignore_platform_reqs_8\":false,\"ignore_php_platform_requirement\":false,\"additional_composer_arguments\":[],\"before_script\":[\"xmllint --schema vendor/phpunit/phpunit/phpunit.xsd phpunit.xml\"]}",
"operatingSystem": "ubuntu-latest",
"action": "laminas/laminas-continuous-integration-action@v1"
}
]
}
Loading

0 comments on commit 80449e9

Please sign in to comment.