aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig20
1 files changed, 18 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index c84375a..9627782 100644
--- a/build.zig
+++ b/build.zig
@@ -35,7 +35,7 @@ pub fn build(b: *std.Build) void {
.{ .name = "api", .module = api_mod },
.{ .name = "frontend", .module = frontend_mod },
.{ .name = "http", .module = http_mod },
- },
+ }
}),
});
@@ -43,9 +43,9 @@ pub fn build(b: *std.Build) void {
const run_step = b.step("run", "Run the app");
+
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
-
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
@@ -59,6 +59,7 @@ pub fn build(b: *std.Build) void {
const db_test_step = b.step("test-db", "Run database tests");
db_test_step.dependOn(&run_db_tests.step);
+
const api_tests = b.addTest(.{
.root_module = api_mod,
});
@@ -66,6 +67,7 @@ pub fn build(b: *std.Build) void {
const api_test_step = b.step("test-api", "Run api tests");
api_test_step.dependOn(&run_api_tests.step);
+
const frontend_tests = b.addTest(.{
.root_module = frontend_mod,
});
@@ -73,6 +75,7 @@ pub fn build(b: *std.Build) void {
const frontend_test_step = b.step("test-frontend", "Run frontend tests");
frontend_test_step.dependOn(&run_frontend_tests.step);
+
const http_tests = b.addTest(.{
.root_module = http_mod,
});
@@ -80,11 +83,13 @@ pub fn build(b: *std.Build) void {
const http_test_step = b.step("test-http", "Run http tests");
http_test_step.dependOn(&run_http_tests.step);
+
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
+
const test_step = b.step("test", "Run all tests");
test_step.dependOn(&run_db_tests.step);
test_step.dependOn(&run_api_tests.step);
@@ -92,16 +97,27 @@ pub fn build(b: *std.Build) void {
test_step.dependOn(&run_http_tests.step);
test_step.dependOn(&run_exe_tests.step);
+
const fmt_step = b.step("fmt", "Format");
const do_fmt = b.addFmt(.{
.paths = &.{ "src" },
});
fmt_step.dependOn(&do_fmt.step);
+
const check_fmt_step = b.step("check", "Check format and syntax");
const do_check_fmt = b.addFmt(.{
.paths = &.{ "src" },
.check = true,
});
check_fmt_step.dependOn(&do_check_fmt.step);
+
+
+ const docs_step = b.step("docs", "Emit documentation");
+ const docs_install = b.addInstallDirectory(.{
+ .install_dir = .prefix,
+ .install_subdir = "docs",
+ .source_dir = exe.getEmittedDocs(),
+ });
+ docs_step.dependOn(&docs_install.step);
}