Skip to content

Commit

Permalink
Merge pull request #59 from Ocramius/feature/#3-include-infection-in-…
Browse files Browse the repository at this point in the history
…ci-runs

Add `infection/infection` to CI runs, when `infection.json(.dist)` exists
  • Loading branch information
boesing authored Oct 10, 2021
2 parents 3f631b5 + f82f9f8 commit 7c2b382
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Currently, it identifies the following:
- Psalm checks based on the presence of `psalm.xml.dist` or `psalm.xml` files.
- ComposerRequireChecker checks based on the presence of `composer-require-checker.json` file.
- phpbench benchmarks based on the presence of a `phpbench.json`.
- 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.
- Markdown documentation based on the presence of a `mkdocs.yml` and/or markdown files in the `doc/book/` or `doc/books/` trees.
- Codeception checks based on the presence of `codeception.yml.dist` or `codeception.yml` files.

Expand Down
21 changes: 20 additions & 1 deletion src/create-jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Config } from './config.js';
import { Job } from './job.js';
import create_additional_jobs from './additional-checks.js';
import validateAndNormalizeChecks from './validate-and-normalize-checks-from-config.js';
import parseJsonFile from "./json.js";

/**
* @param {String} filename
Expand Down Expand Up @@ -171,6 +172,24 @@ function checks (config) {
return createQaJobs('./vendor/bin/phpbench run --revs=2 --iterations=2 --report=aggregate', config);
}
),
new Check(
config.code_checks,
[fileTest('infection.json'), fileTest('infection.json.dist')],
/**
* @param {Config} config
* @return {Array}
*/
function (config) {
const composerFile = parseJsonFile('composer.json', false);
let commandToExecute = './vendor/bin/infection';

if (composerFile.hasOwnProperty('require-dev') && composerFile['require-dev'].hasOwnProperty('roave/infection-static-analysis-plugin')) {
commandToExecute = './vendor/bin/roave-infection-static-analysis-plugin';
}

return createQaJobs(commandToExecute, config);
}
),
new Check(
config.doc_linting,
[fileTest('mkdocs.yml')],
Expand Down Expand Up @@ -212,7 +231,7 @@ function checks (config) {
* @return {Array}
*/
function (config) {
return createQaJobs('vendor/bin/codecept run', config);
return createQaJobs('./vendor/bin/codecept run', config);
}
)
];
Expand Down

0 comments on commit 7c2b382

Please sign in to comment.