From d51a0b8ca3be6ae05af3a030547c7bc244aad3fb Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Fri, 23 Feb 2024 20:34:19 +0100 Subject: [PATCH] make latest patches work on zig master --- .github/workflows/build-zig-11.yml | 17 ++++++++++++++--- .github/workflows/mastercheck-localhost.yml | 2 +- .github/workflows/mastercheck.yml | 2 +- build.zig | 2 +- build_all.sh | 6 ------ src/request.zig | 2 +- targets.txt | 21 --------------------- wrk/zigstd/main.zig | 2 +- 8 files changed, 19 insertions(+), 35 deletions(-) delete mode 100755 build_all.sh delete mode 100644 targets.txt diff --git a/.github/workflows/build-zig-11.yml b/.github/workflows/build-zig-11.yml index e5754b4..877441b 100644 --- a/.github/workflows/build-zig-11.yml +++ b/.github/workflows/build-zig-11.yml @@ -22,6 +22,17 @@ jobs: - name: Check zig version run: zig version - name: Build all examples - run: ./build_all.sh - - name: Run all tests - run: zig build test + run: zig build all + # - name: Run all tests + # run: zig build test + # Run tests separately so we can see more clearly which one fails + - name: Run mustache tests + run: zig build test-mustache + - name: Run httpparams tests + run: zig build test-httpparams + - name: Run sendfile tests + run: zig build test-sendfile + - name: Run authentication tests + run: zig build test-authentication + - name: Report end of tests + run: echo "tests finished" diff --git a/.github/workflows/mastercheck-localhost.yml b/.github/workflows/mastercheck-localhost.yml index f8390ad..e597594 100644 --- a/.github/workflows/mastercheck-localhost.yml +++ b/.github/workflows/mastercheck-localhost.yml @@ -37,7 +37,7 @@ jobs: sleep 3 zig build - name: Build all examples - run: ./build_all.sh + run: zig build all - name: Run authentication tests run: zig build test-authentication - name: Run http parameter tests diff --git a/.github/workflows/mastercheck.yml b/.github/workflows/mastercheck.yml index e1041de..7ab6870 100644 --- a/.github/workflows/mastercheck.yml +++ b/.github/workflows/mastercheck.yml @@ -25,6 +25,6 @@ jobs: - name: Check zig version run: zig version - name: Build all examples - run: ./build_all.sh + run: zig build all - name: Run all tests run: zig build test diff --git a/build.zig b/build.zig index 99a30c0..85e6b1a 100644 --- a/build.zig +++ b/build.zig @@ -3,7 +3,7 @@ const build_facilio = @import("facil.io/build.zig").build_facilio; pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); - if (target.getOsTag() == .windows) { + if (target.result.os.tag == .windows) { std.log.err("\x1b[31mPlatform Not Supported\x1b[0m\nCurrently, Facil.io and Zap are not compatible with Windows. Consider using Linux or Windows Subsystem for Linux (WSL) instead.\nFor more information, please see:\n- https://github.com/zigzap/zap#most-faq\n- https://facil.io/#forking-contributing-and-all-that-jazz\n", .{}); std.os.exit(1); } diff --git a/build_all.sh b/build_all.sh deleted file mode 100755 index 9159374..0000000 --- a/build_all.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -for i in $(cat targets.txt) ; do - echo "-------------------------------------------" - echo $i $* - zig build $i $* -done diff --git a/src/request.zig b/src/request.zig index 44afbef..7bcc191 100644 --- a/src/request.zig +++ b/src/request.zig @@ -111,7 +111,7 @@ pub const HttpParamBinaryFile = struct { filename: ?[]const u8 = null, /// format function for printing file upload data - pub fn format(value: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) std.os.WriteError!void { + pub fn format(value: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { const d = value.data orelse "\\0"; const m = value.mimetype orelse "null"; const f = value.filename orelse "null"; diff --git a/targets.txt b/targets.txt deleted file mode 100644 index 3a69052..0000000 --- a/targets.txt +++ /dev/null @@ -1,21 +0,0 @@ -hello -hello2 -routes -serve -hello_json -endpoint -wrk -wrk_zigstd -mustache -endpoint_auth -http_params -pkghash -cookies -websockets -userpass_session -sendfile -middleware -middleware_with_endpoint -senderror -bindataformpost -announceybot diff --git a/wrk/zigstd/main.zig b/wrk/zigstd/main.zig index 0231718..9d97a2c 100644 --- a/wrk/zigstd/main.zig +++ b/wrk/zigstd/main.zig @@ -6,7 +6,7 @@ pub fn main() !void { }){}; const allocator = gpa.allocator(); - var server = std.http.Server.init(allocator, .{ + var server = std.http.Server.init(.{ .reuse_address = true, }); defer server.deinit();