Skip to content

Commit

Permalink
chore: update zig version and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
speed2exe committed Mar 14, 2024
1 parent 62e314a commit ecf90c8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit ecf90c8

Please sign in to comment.