Skip to content

Commit 7c2b382

Browse files
authored
Merge pull request #59 from Ocramius/feature/#3-include-infection-in-ci-runs
Add `infection/infection` to CI runs, when `infection.json(.dist)` exists
2 parents 3f631b5 + f82f9f8 commit 7c2b382

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Currently, it identifies the following:
1212
- Psalm checks based on the presence of `psalm.xml.dist` or `psalm.xml` files.
1313
- ComposerRequireChecker checks based on the presence of `composer-require-checker.json` file.
1414
- phpbench benchmarks based on the presence of a `phpbench.json`.
15+
- 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.
1516
- Markdown documentation based on the presence of a `mkdocs.yml` and/or markdown files in the `doc/book/` or `doc/books/` trees.
1617
- Codeception checks based on the presence of `codeception.yml.dist` or `codeception.yml` files.
1718

src/create-jobs.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Config } from './config.js';
66
import { Job } from './job.js';
77
import create_additional_jobs from './additional-checks.js';
88
import validateAndNormalizeChecks from './validate-and-normalize-checks-from-config.js';
9+
import parseJsonFile from "./json.js";
910

1011
/**
1112
* @param {String} filename
@@ -171,6 +172,24 @@ function checks (config) {
171172
return createQaJobs('./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate', config);
172173
}
173174
),
175+
new Check(
176+
config.code_checks,
177+
[fileTest('infection.json'), fileTest('infection.json.dist')],
178+
/**
179+
* @param {Config} config
180+
* @return {Array}
181+
*/
182+
function (config) {
183+
const composerFile = parseJsonFile('composer.json', false);
184+
let commandToExecute = './vendor/bin/infection';
185+
186+
if (composerFile.hasOwnProperty('require-dev') && composerFile['require-dev'].hasOwnProperty('roave/infection-static-analysis-plugin')) {
187+
commandToExecute = './vendor/bin/roave-infection-static-analysis-plugin';
188+
}
189+
190+
return createQaJobs(commandToExecute, config);
191+
}
192+
),
174193
new Check(
175194
config.doc_linting,
176195
[fileTest('mkdocs.yml')],
@@ -212,7 +231,7 @@ function checks (config) {
212231
* @return {Array}
213232
*/
214233
function (config) {
215-
return createQaJobs('vendor/bin/codecept run', config);
234+
return createQaJobs('./vendor/bin/codecept run', config);
216235
}
217236
)
218237
];

0 commit comments

Comments
 (0)