Skip to content

Commit f47a0af

Browse files
committed
fix CI running out of disk space
1 parent 1a6f17c commit f47a0af

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

runtest.zig

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,40 @@ pub fn main() !void {
115115
}
116116
}
117117

118+
fn isCompilerPath(path: []const u8) bool {
119+
var it = std.fs.path.NativeComponentIterator.init(path) catch std.debug.panic("invalid path '{s}'", .{path});
120+
{
121+
const name = (it.next() orelse return false).name;
122+
if (!std.mem.eql(u8, name, "install")) return false;
123+
}
124+
_ = it.next() orelse return false;
125+
126+
const leaf = (it.next() orelse return false).name;
127+
return std.mem.eql(u8, leaf, "files");
128+
}
129+
118130
fn copyEnvDir(
119131
allocator: std.mem.Allocator,
120132
in_root: []const u8,
121133
out_root: []const u8,
122134
in_path: []const u8,
123135
out_path: []const u8,
124136
) !void {
137+
std.debug.assert(std.mem.startsWith(u8, in_path, in_root));
138+
std.debug.assert(std.mem.startsWith(u8, out_path, out_root));
139+
140+
{
141+
const separators = switch (builtin.os.tag) {
142+
.windows => "\\/",
143+
else => "/",
144+
};
145+
const relative = std.mem.trimLeft(u8, in_path[in_root.len..], separators);
146+
if (isCompilerPath(relative)) {
147+
std.debug.print("skipping '{s}'\n", .{relative});
148+
return;
149+
}
150+
}
151+
125152
var in_dir = try std.fs.cwd().openDir(in_path, .{ .iterate = true });
126153
defer in_dir.close();
127154

0 commit comments

Comments
 (0)