-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
105 lines (86 loc) · 3.26 KB
/
Copy pathbuild.zig
File metadata and controls
105 lines (86 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Create and export the PocketFlow module (public, accessible to dependents)
const pocketflow_mod = b.addModule("pocketflow", .{
.root_source_file = b.path("src/pocketflow.zig"),
.target = target,
.optimize = optimize,
});
// Create and export the Ollama module (public, accessible to dependents)
const ollama_mod = b.addModule("ollama", .{
.root_source_file = b.path("src/ollama.zig"),
.target = target,
.optimize = optimize,
});
// Build the PocketFlow library
const lib = b.addLibrary(.{
.name = "pocketflow",
.root_module = pocketflow_mod,
});
b.installArtifact(lib);
// Build the document generator example executable
const example_mod = b.createModule(.{
.root_source_file = b.path("examples/document_generator.zig"),
.target = target,
.optimize = optimize,
});
// Add imports to the example module
example_mod.addImport("pocketflow", pocketflow_mod);
example_mod.addImport("ollama", ollama_mod);
const example_exe = b.addExecutable(.{
.name = "document_generator",
.root_module = example_mod,
});
b.installArtifact(example_exe);
const run_cmd = b.addRunArtifact(example_exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the document generator example");
run_step.dependOn(&run_cmd.step);
// Unit tests for core modules
const node_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/node.zig"),
.target = target,
.optimize = optimize,
}),
});
const context_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/context.zig"),
.target = target,
.optimize = optimize,
}),
});
const flow_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/flow.zig"),
.target = target,
.optimize = optimize,
}),
});
const ollama_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/ollama.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_node_tests = b.addRunArtifact(node_tests);
const run_context_tests = b.addRunArtifact(context_tests);
const run_flow_tests = b.addRunArtifact(flow_tests);
const run_ollama_tests = b.addRunArtifact(ollama_tests);
// Test step to run all unit tests
const test_step = b.step("test", "Run all unit tests");
test_step.dependOn(&run_node_tests.step);
test_step.dependOn(&run_context_tests.step);
test_step.dependOn(&run_flow_tests.step);
test_step.dependOn(&run_ollama_tests.step);
// Integration test step (requires Ollama server)
const integration_test_step = b.step("test-integration", "Run integration tests (requires Ollama server)");
integration_test_step.dependOn(&run_ollama_tests.step);
}