-
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
For example Circle CI can provide CIRCLE_NODE_INDEX and CIRCLE_NODE_TOTAL env. variables. Naive implementation of splitting can look like this.
class Runner
{
...
public function run()
{
...
$nodeIndex = (int) getenv('CIRCLE_NODE_INDEX');
$nodeTotal = (int) getenv('CIRCLE_NODE_TOTAL');
if ($nodeTotal) {
$this->jobs = array_values(array_filter(
$this->jobs,
function (int $jobIndex) use ($nodeIndex, $nodeTotal) {
return ($jobIndex % $nodeTotal) === $nodeIndex;
},
ARRAY_FILTER_USE_KEY
));
}Better implementation should automatically balance the tests based on the time it took to execute them in previous run.
fprochazka and mstrouhal
Metadata
Metadata
Assignees
Labels
No labels