diff --git a/builder.php b/builder.php index 1c549c8..20c8117 100644 --- a/builder.php +++ b/builder.php @@ -44,7 +44,7 @@ function runner($msg) { $fillers = implode(" ", array_fill(0, count($attrs), '%s')); - $cmd = 'NIX_PATH=nixpkgs=%s nix-build --argstr system %s --option restrict-eval true --keep-going . ' . $fillers; + $cmd = 'NIX_PATH=nixpkgs=%s nix-build --no-out-link --argstr system %s --option restrict-eval true --keep-going . ' . $fillers; $args = $attrs; array_unshift($args, NIX_SYSTEM); array_unshift($args, $pname); diff --git a/mass-rebuilder.php b/mass-rebuilder.php index 66eaf2c..c4f6c1f 100644 --- a/mass-rebuilder.php +++ b/mass-rebuilder.php @@ -195,7 +195,7 @@ function try_eval($ghclient, $owner, $name, $sha, $eval_name, $cmd, $args) { $ghclient->api('repository')->statuses()->create( $owner, $name, - $head_sha, + $sha, [ 'state' => 'failure', 'description' => 'Failed to evaluate ' . $eval_name, @@ -209,10 +209,10 @@ function try_eval($ghclient, $owner, $name, $sha, $eval_name, $cmd, $args) { $ghclient->api('repository')->statuses()->create( $owner, $name, - $head_sha, + $sha, [ 'state' => 'success', - 'description' => 'Evaluation of $eval_name is OK', + 'description' => 'Evaluation of ' . $eval_name . ' is OK', 'context' => 'grahamcofborg-eval-' . $eval_name, ] ); diff --git a/src/RebuildTagClassifier.php b/src/RebuildTagClassifier.php index bcaebc4..7a6ddda 100644 --- a/src/RebuildTagClassifier.php +++ b/src/RebuildTagClassifier.php @@ -49,7 +49,7 @@ class RebuildTagClassifier { $suffix = "101-500"; } else if ($count > 10) { $suffix = "11-100"; - } else if ($count > 1) { + } else if ($count > 0) { $suffix = "1-10"; } else { $suffix = "0"; diff --git a/src/TestRebuildTagClassifier.php b/src/TestRebuildTagClassifier.php index cc95a93..799af36 100644 --- a/src/TestRebuildTagClassifier.php +++ b/src/TestRebuildTagClassifier.php @@ -5,6 +5,15 @@ namespace GHE; class TestRebuildTagClassifier extends \PHPUnit\Framework\TestCase { + function testParseLabelJustOne() { + $this->assertEquals( + ["10.rebuild-linux: 1-10", "10.rebuild-darwin: 0"], + RebuildTagClassifier::parseAndLabel([ + "Estimating rebuild amount by counting changed Hydra jobs.", + " 1 x86_64-linux", + ])); + } + function testExecParseAndLabelGarbage() { $this->assertEquals( ["10.rebuild-darwin: 0", "10.rebuild-linux: 0", ], @@ -56,6 +65,15 @@ class TestRebuildTagClassifier extends \PHPUnit\Framework\TestCase ); } + function testParseJustOne() { + $this->assertEquals( + ["x86_64-linux" => 1], + RebuildTagClassifier::parse([ + "Estimating rebuild amount by counting changed Hydra jobs.", + " 1 x86_64-linux", + ])); + } + function testExecParseDarwinOnly() { $this->assertEquals( ["x86_64-darwin" => 5],