-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2923f4d
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: CI - Zig | ||
|
||
on: | ||
create: | ||
push: | ||
branches: master | ||
pull_request: | ||
schedule: | ||
- cron: "0 18 * * *" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ci-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: goto-bus-stop/setup-zig@v2 | ||
- run: zig fmt --check . | ||
- run: zig build | ||
- run: zig build test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.zig-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.Build) void { | ||
const target = b.standardTargetOptions(.{}); | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
const upstream = b.dependency("upstream", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const lib = b.addStaticLibrary(.{ | ||
.name = "picohttpparser", | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
lib.addIncludePath(b.path(".")); | ||
lib.linkLibC(); | ||
lib.addCSourceFiles(.{ | ||
.root = upstream.path("."), | ||
.files = &[_][]const u8{ | ||
"picohttpparser.c", | ||
}, | ||
.flags = &[_][]const u8{ | ||
"-Wall", "-fsanitize=address,undefined", | ||
}, | ||
}); | ||
lib.installHeader(upstream.path("picohttpparser.h"), "picohttpparser.h"); | ||
|
||
b.installArtifact(lib); | ||
|
||
// Tests | ||
|
||
const picotest = b.dependency("picotest", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const tests = b.addExecutable(.{ | ||
.name = "test-bin", | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
tests.linkLibrary(lib); | ||
tests.addIncludePath(upstream.path(".")); | ||
tests.addIncludePath(picotest.path(".")); | ||
tests.addCSourceFiles(.{ | ||
.root = picotest.path("."), | ||
.files = &[_][]const u8{ | ||
"picotest.c", | ||
}, | ||
.flags = &[_][]const u8{ | ||
"-Wall", "-fsanitize=address,undefined", | ||
}, | ||
}); | ||
tests.addCSourceFiles(.{ | ||
.root = upstream.path("."), | ||
.files = &[_][]const u8{ | ||
"test.c", | ||
}, | ||
.flags = &[_][]const u8{ | ||
"-Wall", "-fsanitize=address,undefined", | ||
}, | ||
}); | ||
|
||
const run_tests = b.addRunArtifact(tests); | ||
const test_step = b.step("test", "Run the tests"); | ||
test_step.dependOn(&run_tests.step); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.{ | ||
.name = "picohttpparser", | ||
.version = "0.0.0", | ||
.dependencies = .{ | ||
.upstream = .{ | ||
.url = "git+https://github.com/h2o/picohttpparser?ref=master#f8d0513f1a7a111f2597d643b073935a8afaf9e5", | ||
.hash = "1220783b493dce554f478bef55bdd94acd7dbb753dc8bc17dc2fbc57709b2a8a0909", | ||
}, | ||
.picotest = .{ | ||
.url = "git+https://github.com/h2o/picotest?ref=master#a99858e0c33b97b24cd09ceae729f2be33ec01e1", | ||
.hash = "1220d93e9c4cfccdc0bf3ea0c30f85785f8e7e0e0096b1d2fe16a9713b7261667c33", | ||
}, | ||
}, | ||
.minimum_zig_version = "0.13.0", | ||
|
||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
}, | ||
} |