Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: latest
uses: mlugg/setup-zig@v2
#with:
#version: latest

- name: Print Zig version
run: zig version
Expand Down
58 changes: 36 additions & 22 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "jetquery",
.root_source_file = b.path("src/jetquery.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/jetquery.zig"),
.target = target,
.optimize = optimize,
}),
});

b.installArtifact(lib);
Expand Down Expand Up @@ -37,9 +39,11 @@ pub fn build(b: *std.Build) !void {
"seeders";
const test_filters = b.option([]const []const u8, "test-filter", "Skip tests that do not match any filter") orelse &[0][]const u8{};
const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/jetquery.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/jetquery.zig"),
.target = target,
.optimize = optimize,
}),
.filters = test_filters,
});
lib_unit_tests.root_module.addImport("pg", pg_dep.module("pg"));
Expand All @@ -53,15 +57,19 @@ pub fn build(b: *std.Build) !void {

const exe_generate_migrations = b.addExecutable(.{
.name = "migrations",
.root_source_file = b.path("src/generate_migrations.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/generate_migrations.zig"),
.target = target,
.optimize = optimize,
}),
});

const migration_unit_tests = b.addTest(.{
.root_source_file = b.path("src/jetquery/Migrate.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/jetquery/Migrate.zig"),
.target = target,
.optimize = optimize,
}),
.filters = test_filters,
});
const run_migration_unit_tests = b.addRunArtifact(migration_unit_tests);
Expand All @@ -87,15 +95,19 @@ pub fn build(b: *std.Build) !void {

const exe_generate_seeder = b.addExecutable(.{
.name = "seed",
.root_source_file = b.path("src/generate_seeders.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/generate_seeders.zig"),
.target = target,
.optimize = optimize,
}),
});

const seed_unit_tests = b.addTest(.{
.root_source_file = b.path("src/jetquery/Seed.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/jetquery/Seed.zig"),
.target = target,
.optimize = optimize,
}),
.filters = test_filters,
});
const run_seed_unit_tests = b.addRunArtifact(seed_unit_tests);
Expand Down Expand Up @@ -149,9 +161,11 @@ pub fn build(b: *std.Build) !void {
jetquery_reflect_module.addImport("jetcommon", jetcommon_module);

const reflect_unit_tests = b.addTest(.{
.root_source_file = b.path("src/jetquery/reflection/Reflect.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/jetquery/reflection/Reflect.zig"),
.target = target,
.optimize = optimize,
}),
.filters = test_filters,
});
const run_reflect_unit_tests = b.addRunArtifact(reflect_unit_tests);
Expand Down
10 changes: 5 additions & 5 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
.name = .jetquery,
.version = "0.0.0",
.fingerprint = 0x8fab0d79cef7d74c,
.minimum_zig_version = "0.14.0",
.minimum_zig_version = "0.15.0-dev.1425+7ee6dab39",
.dependencies = .{
.jetcommon = .{
.url = "https://github.com/jetzig-framework/jetcommon/archive/eebd91d697cab9e1146d15e7d68dbceac5f96f23.tar.gz",
.hash = "jetcommon-0.1.0-jPY_DR9HAAAWM6tliOT1HGijaNK59Y7LhMZlB9EJeh5J",
.url = "https://github.com/jetzig-framework/jetcommon/archive/ff1f2cf50e6d0b35bfdadc77f9d21cf2a3e05b26.tar.gz",
.hash = "jetcommon-0.1.0-jPY_DdNIAAA7pPOLsOkd5BH4juCnM4F71sNLK2aiwMs6",
},
.pg = .{
.url = "https://github.com/karlseguin/pg.zig/archive/740b6bfe31bc3ebc81b7bc97fe883871da2604c7.tar.gz",
.hash = "pg-0.0.0-Wp_7gQr-BQAMQ8q9R0TzXrVgsyLVubJpg7mg_CSSIYqI",
.url = "https://github.com/karlseguin/pg.zig/archive/6a164b282eb69bb033b05301aa839be3bfdb8dd8.tar.gz",
.hash = "pg-0.0.0-Wp_7gWYABgDCWzy0PvaGuwpn1PxTqihfYowektiN11n7",
},
},
.paths = .{
Expand Down
6 changes: 3 additions & 3 deletions src/generate_migrations.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ pub fn main() !void {
var migrations_module_dir = try std.fs.cwd().openDir(std.fs.path.dirname(migrations_module_path).?, .{});
defer migrations_module_dir.close();

const writer = migrations_file.writer();
try writer.writeAll(
try migrations_file.writeAll(
\\const jetquery = @import("jetquery");
\\pub const Migration = struct {
\\ upFn: *const fn(repo: anytype) anyerror!void,
Expand All @@ -38,6 +37,7 @@ pub fn main() !void {
basename,
.{},
);
// was migrations_file.writer
try writer.print(
\\ .{{
\\ .upFn = @import("{0s}").up,
Expand All @@ -50,7 +50,7 @@ pub fn main() !void {
.{ try zigEscape(allocator, basename), try zigEscape(allocator, version) },
);
}
try writer.writeAll(
try migrations_file.writeAll(
\\};
\\
);
Expand Down
7 changes: 4 additions & 3 deletions src/generate_seeders.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub fn main() !void {
var seeders_module_dir = try std.fs.cwd().openDir(std.fs.path.dirname(seeders_module_path).?, .{});
defer seeders_module_dir.close();

const writer = seeders_file.writer();
try writer.writeAll(
//const writer = seeders_file.writer();
try seeders_file.writeAll(
\\const jetquery = @import("jetquery");
\\pub const Seeder = struct {
\\ runFn: *const fn(repo: anytype) anyerror!void,
Expand All @@ -35,6 +35,7 @@ pub fn main() !void {
basename,
.{},
);
// was seeders_file.writer
try writer.print(
\\ .{{
\\ .runFn = @import("{0s}").run,
Expand All @@ -45,7 +46,7 @@ pub fn main() !void {
.{try zigEscape(allocator, basename)},
);
}
try writer.writeAll(
try seeders_file.writeAll(
\\};
\\
);
Expand Down
Loading