diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..5a82da4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Build + +on: + - push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: sudo apt-get update && sudo apt-get install -y sqlite3 + + - uses: actions/checkout@v4 + + - uses: goto-bus-stop/setup-zig@v2 + with: + version: master + + - run: zig build test --summary all diff --git a/build.zig b/build.zig index a17fcf0..6ecc658 100644 --- a/build.zig +++ b/build.zig @@ -25,4 +25,10 @@ pub fn build(b: *std.Build) !void { }, }); } + + const tests = b.addTest(.{ .root_source_file = .{ .path = "src/main.zig" } }); + tests.root_module.link_objects = sqlite.link_objects; + const run_tests = b.addRunArtifact(tests); + const test_step = b.step("test", "Run tests"); + test_step.dependOn(&run_tests.step); } diff --git a/src/main.zig b/src/main.zig index 7d60047..972d6e4 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,3 +1,5 @@ +const std = @import("std"); + pub const SQLite3 = @import("sqlite.zig").SQLite3; pub const Pool = @import("pool.zig").Pool; pub const Session = @import("session.zig").Session; @@ -9,3 +11,7 @@ pub const update = @import("dsl.zig").update; pub const delete = @import("dsl.zig").delete; pub const migrate = @import("migrate.zig").migrate; + +test { + std.testing.refAllDecls(@This()); +}