Skip to content

Commit

Permalink
Merge pull request #28 from weierophinney/feature/disable-platform-re…
Browse files Browse the repository at this point in the history
…qs-flag

Allow toggling --ignore-platform-reqs option on PHP 8.0
  • Loading branch information
weierophinney committed Apr 20, 2021
2 parents 2f5d4f3 + 86e5fdf commit 4f21db5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ In each case, it MUST have the structure as noted above:
"e.g. 'memory_limit=-1'"
],
"dependencies": "dependencies to test against; one of lowest, locked, latest",
"ignore_platform_reqs_on_8": "(boolean; OPTIONAL) Whether or not to ignore platform requirements on PHP 8; defaults to true",
"command": "command to run to perform the check"
}
```
Expand Down Expand Up @@ -177,7 +178,8 @@ The syntax for the `additional_checks` key is as follows:
],
"ini": [
"(array of strings; OPTIONAL) specific php.ini settings to use for this check only"
]
],
"ignore_platform_reqs_on_8": "(boolean; OPTIONAL) Whether or not to ignore platform reqs when installing dependencies on PHP 8.0; defaults to true"
}
}
]
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ core.info(`Using php extensions: ${JSON.stringify(config.extensions)}`);
core.info(`Providing php.ini settings: ${JSON.stringify(config.php_ini)}`);
core.info(`Dependency sets found: ${JSON.stringify(config.dependencies)}`);
core.info(`Additional checks found: ${JSON.stringify(config.additional_checks)}`);
core.info(`Ignore platform reqs on version 8: ${config.ignore_platform_reqs_8 ? "Yes" : "No"}`);

let matrix = {include: createJobs(config)};

Expand Down
26 changes: 15 additions & 11 deletions src/command.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { CURRENT_STABLE } from './config.js';

export class Command {
command = '';
php = CURRENT_STABLE;
extensions = [];
ini = [];
dependencies = 'locked';
command = '';
php = CURRENT_STABLE;
extensions = [];
ini = [];
dependencies = 'locked';
ignore_platform_reqs_8 = true;

/**
* @param {String} command
* @param {String} php
* @param {Array<String>} extensions
* @param {Array<String>} ini
* @param {String} dependencies
* @param {Boolean} ignore_platform_reqs_8
*/
constructor(command, php, extensions, ini, dependencies) {
this.command = command;
this.php = php;
this.extensions = extensions;
this.ini = ini;
this.dependencies = dependencies;
constructor(command, php, extensions, ini, dependencies, ignore_platform_reqs_8) {
this.command = command;
this.php = php;
this.extensions = extensions;
this.ini = ini;
this.dependencies = dependencies;
this.ignore_platform_reqs_8 = ignore_platform_reqs_8;
}

toJSON() {
Expand All @@ -29,6 +32,7 @@ export class Command {
extensions: this.extensions,
ini: this.ini,
dependencies: this.dependencies,
ignore_platform_reqs_8: this.ignore_platform_reqs_8,
};
}
};
25 changes: 15 additions & 10 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ function gatherVersions (composerJson) {
}

class Config {
code_checks = true;
doc_linting = true;
versions = [];
stable_version = CURRENT_STABLE;
extensions = [];
php_ini = ['memory_limit=-1'];
dependencies = ['lowest', 'latest'];
checks = [];
exclude = [];
additional_checks = [];
code_checks = true;
doc_linting = true;
versions = [];
stable_version = CURRENT_STABLE;
extensions = [];
php_ini = ['memory_limit = -1'];
dependencies = ['lowest', 'latest'];
checks = [];
exclude = [];
additional_checks = [];
ignore_platform_reqs_8 = true;

/**
* @param {Requirements} requirements
Expand Down Expand Up @@ -105,6 +106,10 @@ class Config {
if (configuration.additional_checks !== undefined && Array.isArray(configuration.additional_checks)) {
this.additional_checks = configuration.additional_checks;
}

if (configuration.ignore_platform_reqs_8 !== undefined && typeof configuration.ignore_platform_reqs_8 === 'boolean') {
this.ignore_platform_reqs_8 = configuration.ignore_platform_reqs_8;
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/create-jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const createQaJobs = function (command, config) {
config.stable_version,
config.extensions,
config.php_ini,
'locked'
'locked',
config.ignore_platform_reqs_8,
))
)];
};
Expand All @@ -53,6 +54,7 @@ const createPHPUnitJob = function (version, deps, config) {
config.extensions,
config.php_ini,
deps,
config.ignore_platform_reqs_8,
)),
);
};
Expand All @@ -70,6 +72,7 @@ const createNoOpJob = function (config) {
[],
[],
'locked',
config.ignore_platform_reqs_8,
)),
)];
};
Expand Down

0 comments on commit 4f21db5

Please sign in to comment.