Skip to content

Commit bbddcba

Browse files
committed
add build and ci
1 parent ad265f5 commit bbddcba

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on: [push, pull_request]
2+
3+
name: CI
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Set up Zig
12+
uses: korandoru/setup-zig@v1
13+
with:
14+
zig-version: 0.13.0
15+
16+
- name: Lint
17+
run: zig fmt --check *.zig
18+
19+
test:
20+
name: test
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Set up Zig
26+
uses: korandoru/setup-zig@v1
27+
with:
28+
zig-version: 0.13.0
29+
30+
- name: Test
31+
run: zig build test --summary all

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
main*
2+
!main.zig
3+
zig-cache/
4+
.zig-cache/
5+
zig-out/

build.zig

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const Builder = @import("std").Build;
2+
3+
pub fn build(b: *Builder) void {
4+
const target = b.standardTargetOptions(.{});
5+
const optimize = b.standardOptimizeOption(.{});
6+
7+
const snappyz = b.dependency("snappyz", .{
8+
.target = target,
9+
.optimize = optimize,
10+
}).module("snappyz");
11+
12+
const mod = b.addModule("snappyframesz.zig", Builder.Module.CreateOptions{
13+
.root_source_file = b.path("src/frames.zig"),
14+
.target = target,
15+
.optimize = optimize,
16+
.imports = &.{
17+
.{ .name = "snappyz", .module = snappyz },
18+
},
19+
});
20+
_ = mod;
21+
22+
const lib = b.addStaticLibrary(.{
23+
.name = "snappyframesz",
24+
.root_source_file = .{ .cwd_relative = "src/frames.zig" },
25+
.optimize = optimize,
26+
.target = target,
27+
});
28+
b.installArtifact(lib);
29+
30+
const tests = b.addTest(.{
31+
.root_source_file = .{ .cwd_relative = "src/frames.zig" },
32+
.optimize = optimize,
33+
.target = target,
34+
});
35+
tests.root_module.addImport("snappyz", snappyz);
36+
37+
const run_tests = b.addRunArtifact(tests);
38+
const test_step = b.step("test", "Run unit tests");
39+
test_step.dependOn(&run_tests.step);
40+
}

build.zig.zon

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.{
2+
.name = "snappyframesz",
3+
.version = "0.0.1",
4+
.dependencies = .{
5+
.snappyz = .{
6+
.url = "https://github.com/blockblaz/zig-snappy/archive/31fb3a1.tar.gz",
7+
.hash = "1220a26e93b53174d700b6d840ea28e10976ea9c1ceaf2c5598ff7cf51fecc567736",
8+
},
9+
},
10+
.paths = .{""},
11+
}

0 commit comments

Comments
 (0)