From 4b649eb445a7a51dfcc93cb266de54018b5fd8b7 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Sat, 8 Jun 2024 10:13:06 -0700 Subject: [PATCH] upgrade to zig 0.13.0 --- .gitea/workflows/build.yaml | 14 ++++++-------- build.zig | 10 +++++----- src/main.zig | 2 +- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 7759db3..2cee389 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -2,9 +2,8 @@ name: Build run-name: Standard build, creates docker image and deploys on success on: [push] env: - ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ACTIONS_RUNTIME_URL: https://git.lerch.org/api/actions_pipeline/ - ZIG_URL: https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz + # ACTIONS_RUNTIME_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # ACTIONS_RUNTIME_URL: https://git.lerch.org/api/actions_pipeline/ BUILD_TARGET: x86_64-linux-gnu # Needs to be gnu since we're using dlopen BUILD_OPTIMIZATION: ReleaseSafe # Safety is usually a good thing jobs: @@ -14,11 +13,10 @@ jobs: - run: echo "Triggered by ${{ github.event_name }} event" - name: Check out repository code uses: actions/checkout@v3 - - name: Install zig - run: | - curl -s "$ZIG_URL" |tar -xJ -C /usr/local \ - && ln -s /usr/local/zig*/zig /usr/local/bin \ - && true + - uses: elerch/setup-zig@v3 + with: + version: 0.13.0 + - uses: elerch/zig-action-cache@v1.1.6 - name: Test run: zig build test -Dtarget="$BUILD_TARGET" - name: Build diff --git a/build.zig b/build.zig index 4297c9a..82a973a 100644 --- a/build.zig +++ b/build.zig @@ -19,7 +19,7 @@ pub fn build(b: *std.Build) void { .name = "flexilib", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -34,7 +34,7 @@ pub fn build(b: *std.Build) void { .name = "flexilib-sample-lib", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/main-lib.zig" }, + .root_source_file = b.path("src/main-lib.zig"), .target = target, .optimize = optimize, }); @@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void { .name = "flexilib", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/interface.zig" }, + .root_source_file = b.path("src/interface.zig"), .target = target, .optimize = optimize, }); @@ -83,14 +83,14 @@ pub fn build(b: *std.Build) void { // Creates a step for unit testing. This only builds the test executable // but does not run it. const main_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); main_tests.linkLibC(); const lib_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main-lib.zig" }, + .root_source_file = b.path("src/main-lib.zig"), .target = target, .optimize = optimize, }); diff --git a/src/main.zig b/src/main.zig index 52f818b..341b345 100644 --- a/src/main.zig +++ b/src/main.zig @@ -397,7 +397,7 @@ pub fn main() !void { // panics. This is because arenas don't actually free memory until // they deinit. So we need to use the raw allocator here, but the // arena can be used to store our arguments above - var cp = std.ChildProcess.init(al.items, raw_allocator); + var cp = std.process.Child.init(al.items, raw_allocator); cp.stdin = stdin; cp.stdout = stdout; cp.stderr = stderr;