Skip to content

Commit 897a00e

Browse files
PetarKirovMartinNikov
authored andcommitted
improve(mcl/commands/ci): Makes logs less verbose
1 parent 0df3298 commit 897a00e

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

packages/mcl/src/src/mcl/commands/ci.d

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export void ci(string[] args)
2525
auto shardMatrix = generateShardMatrix();
2626
foreach (shard; shardMatrix.include)
2727
{
28-
writeln("Shard ", shard.prefix ~ " ", shard.postfix ~ " ", shard.digit);
2928
params.flakePre = shard.prefix;
3029
params.flakePost = shard.postfix;
3130

@@ -57,25 +56,20 @@ export void ci(string[] args)
5756

5857
foreach (pkg; matrix)
5958
{
60-
if (pkg.isCached)
61-
{
62-
writeln("Package ", pkg.name, " is cached");
63-
}
64-
else
65-
{
66-
writeln("Package ", pkg.name, " is not cached; building...");
67-
ProcessPipes res = execute!ProcessPipes(["nix", "build", "--json", ".#" ~ pkg.attrPath]);
59+
if (pkg.isCached) continue;
6860

69-
foreach (line; res.stderr.byLine)
70-
{
71-
"\r".write;
72-
line.write;
73-
}
74-
"".writeln;
75-
auto json = parseJSON(res.stdout.byLine.join("\n").to!string);
76-
auto path = json.array[0]["outputs"]["out"].str;
77-
execute(["cachix", "push", params.cachixCache, path], false, true).writeln;
61+
writeln("Package ", pkg.name, " is not cached; building...");
62+
ProcessPipes res = execute!ProcessPipes(["nix", "build", "--json", ".#" ~ pkg.attrPath]);
63+
64+
foreach (line; res.stderr.byLine)
65+
{
66+
"\r".write;
67+
line.write;
7868
}
69+
"".writeln;
70+
auto json = parseJSON(res.stdout.byLine.join("\n").to!string);
71+
auto path = json.array[0]["outputs"]["out"].str;
72+
execute(["cachix", "push", params.cachixCache, path], false, true).writeln;
7973
}
8074

8175
}

packages/mcl/src/src/mcl/commands/ci_matrix.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module mcl.commands.ci_matrix;
22

33
import std.stdio : writeln, stderr, stdout;
44
import std.traits : EnumMembers;
5-
import std.string : indexOf, splitLines;
5+
import std.string : indexOf, splitLines, strip;
66
import std.algorithm : map, filter, reduce, chunkBy, find, any, sort, startsWith, each, canFind, fold;
77
import std.file : write, readText;
88
import std.range : array, front, join, split;
@@ -378,7 +378,8 @@ Package[] nixEvalJobs(string flakeAttrPrefix, string cachixUrl, bool doCheck = t
378378
.filter!(line => !uselessWarnings.any!(w => line.canFind(w)))
379379
.join("\n");
380380

381-
logWarning(stderrLogs);
381+
if (stderrLogs.strip != "")
382+
logWarning(stderrLogs);
382383

383384
int status = wait(pipes.pid);
384385

0 commit comments

Comments
 (0)