forked from Loongphy/codex-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
98 lines (92 loc) · 3.31 KB
/
Copy pathbuild.zig
File metadata and controls
98 lines (92 loc) · 3.31 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
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const package_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const main_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const exe = b.addExecutable(.{
.name = "codex-auth",
.root_module = main_module,
});
b.installArtifact(exe);
const fake_curl_module = b.createModule(.{
.root_source_file = b.path("tests/fake_curl.zig"),
.target = target,
.optimize = optimize,
});
const fake_curl_exe = b.addExecutable(.{
.name = "curl",
.root_module = fake_curl_module,
});
const install_fake_curl = b.addInstallArtifact(fake_curl_exe, .{});
const fake_curl_fail_module = b.createModule(.{
.root_source_file = b.path("tests/fake_curl_fail.zig"),
.target = target,
.optimize = optimize,
});
const fake_curl_fail_exe = b.addExecutable(.{
.name = "curl-fail",
.root_module = fake_curl_fail_module,
});
const install_fake_curl_fail = b.addInstallArtifact(fake_curl_fail_exe, .{});
const test_helpers_step = b.step("test-helpers", "Install test helper binaries");
test_helpers_step.dependOn(b.getInstallStep());
test_helpers_step.dependOn(&install_fake_curl.step);
test_helpers_step.dependOn(&install_fake_curl_fail.step);
const run_cmd = b.addRunArtifact(exe);
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run codex-auth");
run_step.dependOn(&run_cmd.step);
const test_files = [_][]const u8{
"tests/api_account_test.zig",
"tests/api_http_test.zig",
"tests/api_me_test.zig",
"tests/api_usage_test.zig",
"tests/auth_test.zig",
"tests/cli_behavior_test.zig",
"tests/cli_picker_test.zig",
"tests/compat_fs_test.zig",
"tests/cli_integration_test.zig",
"tests/lib_compile_test.zig",
"tests/registry_import_test.zig",
"tests/registry_test.zig",
"tests/session_test.zig",
"tests/time_relative_test.zig",
"tests/table_layout_test.zig",
"tests/tui_display_test.zig",
"tests/tui_session_test.zig",
"tests/tui_table_test.zig",
"tests/workflows_core_test.zig",
"tests/workflows_live_test.zig",
};
const test_step = b.step("test", "Run tests");
for (test_files) |test_file| {
const test_module = b.createModule(.{
.root_source_file = b.path(test_file),
.target = target,
.optimize = optimize,
.link_libc = true,
.imports = &.{
.{ .name = "codex_auth", .module = package_module },
},
});
const test_artifact = b.addTest(.{
.root_module = test_module,
});
const run_test = b.addRunArtifact(test_artifact);
run_test.setEnvironmentVariable("CODEX_AUTH_CLI_INTEGRATION_PROJECT_ROOT", b.pathFromRoot("."));
test_step.dependOn(&run_test.step);
}
}