From d0dd2507d4ca7d20786cfc56432b00fd7e1cce7d Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Wed, 12 Jan 2022 17:47:08 -0800 Subject: [PATCH] fix build --- .drone.yml | 3 ++- VersionStep.zig | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index be33fd4..97b2e8d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,8 +17,9 @@ steps: - tar x -C /usr/local -f zig-linux-x86_64-0.9.0.tar.xz - rm /usr/local/bin/zig - ln -s /usr/local/zig-linux-x86_64-0.9.0/zig /usr/local/bin/zig + - apk add git - (cd codegen && zig build test) - - zig build # implicitly does a codegen + - zig build -Dfetch # implicitly does a codegen - zig build test - name: notify image: plugins/matrix diff --git a/VersionStep.zig b/VersionStep.zig index 0ea871b..0ed7ff5 100644 --- a/VersionStep.zig +++ b/VersionStep.zig @@ -84,10 +84,7 @@ fn getGitVersion(allocator: std.mem.Allocator, git_working_root: ?[]const u8, en // 2022-01-12 12:21:28 -0800 // HEAD -> zig-native - if (std.os.getenv("DRONE_COMMIT_SHA") != null) - return getGitVersionFromDrone(allocator); - - const log_output = try run( + const log_output = run( allocator, &[_][]const u8{ "git", @@ -97,7 +94,11 @@ fn getGitVersion(allocator: std.mem.Allocator, git_working_root: ?[]const u8, en }, git_working_root, env, - ); + ) catch |e| { + if (std.os.getenv("DRONE_COMMIT_SHA") != null) + return getGitVersionFromDrone(allocator); + return e; + }; defer allocator.free(log_output); const line_data = try getLines(allocator, 4, log_output); const hash = line_data[0];