Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Pass in-memory-cache input for extra_jobs #98

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ inputs:
phpunit:
type: boolean
default: true
phpunit_skip_suites:
type: string
required: false
default: ''
js:
type: boolean
default: true
Expand Down Expand Up @@ -146,6 +150,7 @@ runs:
echo "phplinting: ${{ inputs.phplinting }}" >> __inputs.yml
echo "phpunit: ${{ inputs.phpunit }}" >> __inputs.yml
echo "doclinting: ${{ inputs.doclinting }}" >> __inputs.yml
echo "phpunit_skip_suites: ${{ inputs.phpunit_skip_suites }}" >> __inputs.yml
echo "dynamic_matrix: ${{ inputs.dynamic_matrix }}" >> __inputs.yml
echo "simple_matrix: ${{ inputs.simple_matrix }}" >> __inputs.yml
echo "github_repository: '$GITHUB_REPOSITORY'" >> __inputs.yml
Expand Down
16 changes: 14 additions & 2 deletions job_creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public function createJob(int $phpIndex, array $opts): array
'endtoend_config' => '',
'js' => false,
'doclinting' => false,
'install_in_memory_cache_exts' => false,
// Needs full setup if installerVersion is set, OR this is a recipe
'needs_full_setup' => $this->installerVersion !== '' || (isset($this->repoData['type']) && $this->repoData['type'] === 'recipe'),
];
Expand Down Expand Up @@ -389,7 +390,8 @@ private function buildDynamicMatrix(
array $matrix,
array $run,
bool $composerInstall,
bool $simpleMatrix
bool $simpleMatrix,
array $skipPhpunitSuites
): array {
if ($run['phpunit'] && (file_exists('phpunit.xml') || file_exists('phpunit.xml.dist'))) {
$dom = new DOMDocument();
Expand All @@ -402,6 +404,9 @@ private function buildDynamicMatrix(
continue;
}
$suite = $testsuite->getAttribute('name');
if (in_array($suite, $skipPhpunitSuites)) {
continue;
}
$matrix = $this->createPhpunitJobs($matrix, $composerInstall, $simpleMatrix, $suite, $run);
}
// phpunit.xml has no defined testsuites, or only defaults a "Default"
Expand Down Expand Up @@ -519,6 +524,7 @@ public function createJson(string $yml): string
$composerInstall = false;
$dynamicMatrix = true;
$simpleMatrix = false;
$skipPhpunitSuites = [];
foreach ($inputs as $input => $value) {
if (in_array($input, [
'endtoend',
Expand All @@ -543,6 +549,9 @@ public function createJson(string $yml): string
$simpleMatrix = $this->parseBoolValue($value);
} else if (in_array($input, ['github_my_ref', 'github_repository', 'parent_branch'])) {
continue;
} else if ($input === 'phpunit_skip_suites') {
// value is a comma-separated string
$skipPhpunitSuites = array_map('trim', explode(',', $value));
} else {
throw new LogicException("Unhandled input $input");
}
Expand All @@ -557,7 +566,7 @@ public function createJson(string $yml): string
}

if ($dynamicMatrix) {
$matrix = $this->buildDynamicMatrix($matrix, $run, $composerInstall, $simpleMatrix);
$matrix = $this->buildDynamicMatrix($matrix, $run, $composerInstall, $simpleMatrix, $skipPhpunitSuites);
}

// extra jobs
Expand Down Expand Up @@ -628,6 +637,9 @@ public function createJson(string $yml): string
if ($job['doclinting'] == 'true') {
$name[] = 'doclinting';
}
if ($job['install_in_memory_cache_exts'] == 'true') {
$name[] = 'inmemorycache';
}
$name[] = $job['name_suffix'];
$name = array_filter($name);
$matrix['include'][$i]['name'] = implode(' ', $name);
Expand Down
Loading