diff --git a/.github/workflows/integrations.yml b/.github/workflows/integrations.yml index 7de38c0..869ec39 100644 --- a/.github/workflows/integrations.yml +++ b/.github/workflows/integrations.yml @@ -20,7 +20,7 @@ jobs: - name: install zig run: | - ZIG_VERSION=0.12.0-dev.2858+7230b68b3 + ZIG_VERSION=0.12.0-dev.3291+17bad9f88 wget https://ziglang.org/builds/zig-linux-x86_64-$ZIG_VERSION.tar.xz tar xf zig-linux-x86_64-$ZIG_VERSION.tar.xz mv zig-linux-x86_64-$ZIG_VERSION $HOME/zig-build diff --git a/README.md b/README.md index e965bc9..51a4d49 100644 --- a/README.md +++ b/README.md @@ -329,9 +329,17 @@ fn main() !void { ## Integration Tests - Start up mysql/mariadb in docker: - - `docker run --name some-mysql --env MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql` - - `docker run --name some-mariadb --env MARIADB_ROOT_PASSWORD=password -p 3306:3306 -d mariadb` -- Run all the test: In root directory of project: `zig test integration_test -Dtest-filer='...'` +```bash +# MySQL +docker run --name some-mysql --env MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql +```bash +# MariaDB +docker run --name some-mariadb --env MARIADB_ROOT_PASSWORD=password -p 3306:3306 -d mariadb +``` +- Run all the test: In root directory of project: +```bash +zig build integration_test -Dtest-filer='...' +``` ## Philosophy ### Correctness diff --git a/build.zig b/build.zig index c5d21d3..1fa9bfc 100644 --- a/build.zig +++ b/build.zig @@ -5,13 +5,14 @@ pub fn build(b: *std.Build) void { .root_source_file = .{ .path = "./src/myzql.zig" }, }); - const test_filter = b.option([]const u8, "test-filter", "Filter for tests to run"); // -Dtest-filter="..." + // -Dtest-filter="..." + const test_filter = b.option([]const u8, "test-filter", "Filter for tests to run"); // zig build unit_test const unit_tests = b.addTest(.{ .root_source_file = .{ .path = "./src/myzql.zig" }, }); - unit_tests.filter = test_filter; + if (test_filter) |t| unit_tests.filters = &.{t}; // zig build [install] b.installArtifact(unit_tests); @@ -26,12 +27,12 @@ pub fn build(b: *std.Build) void { .root_source_file = .{ .path = "./integration_tests/main.zig" }, }); integration_tests.root_module.addImport("myzql", myzql); - integration_tests.filter = test_filter; + if (test_filter) |t| unit_tests.filters = &.{t}; // zig build [install] b.installArtifact(integration_tests); - // zig build run_integration_test + // zig build integration_test const run_integration_tests = b.addRunArtifact(integration_tests); const integration_test_step = b.step("integration_test", "Run integration tests"); integration_test_step.dependOn(&run_integration_tests.step);