ci: rebuild from source when publishing
This commit is contained in:
parent
29a7ea5669
commit
a10f2262e2
2 changed files with 8 additions and 7 deletions
2
.github/workflows/cd.yml
vendored
2
.github/workflows/cd.yml
vendored
|
|
@ -82,7 +82,7 @@ jobs:
|
||||||
- name: Build Package
|
- name: Build Package
|
||||||
run: |
|
run: |
|
||||||
cd pkg/temporal
|
cd pkg/temporal
|
||||||
zig build -Dtarget=${{ matrix.target }} -Doptimize=ReleaseSafe
|
zig build -Dbuild-rust -Dtarget=${{ matrix.target }} -Doptimize=ReleaseSafe
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ const std = @import("std");
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
const force_build_rust = b.option(bool, "build-rust", "Always build Rust library from source") orelse false;
|
||||||
|
|
||||||
const arch_str = @tagName(target.result.cpu.arch);
|
const arch_str = @tagName(target.result.cpu.arch);
|
||||||
const os_str = @tagName(target.result.os.tag);
|
const os_str = @tagName(target.result.os.tag);
|
||||||
|
|
@ -33,9 +34,9 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
var selected_lib_file: std.Build.LazyPath = undefined;
|
var selected_lib_file: std.Build.LazyPath = undefined;
|
||||||
if (prebuilt_lib_file) |lib_file| {
|
if (prebuilt_lib_file != null and !force_build_rust) {
|
||||||
// std.debug.print("Using pre-built temporal_capi library from downloaded artifact at: {s}\n", .{prebuilt_lib_path});
|
// std.debug.print("Using pre-built temporal_capi library from downloaded artifact at: {s}\n", .{prebuilt_lib_path});
|
||||||
selected_lib_file = lib_file;
|
selected_lib_file = prebuilt_lib_file.?;
|
||||||
} else {
|
} else {
|
||||||
// std.debug.print("building from source: {s}\n", .{prebuilt_lib_path});
|
// std.debug.print("building from source: {s}\n", .{prebuilt_lib_path});
|
||||||
const build_crab = @import("build_crab");
|
const build_crab = @import("build_crab");
|
||||||
|
|
@ -51,12 +52,12 @@ pub fn build(b: *std.Build) !void {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
selected_lib_file = build_dir.path(b, lib_name);
|
selected_lib_file = build_dir.path(b, lib_name);
|
||||||
|
|
||||||
// --- Install Step (for publishing) --- //
|
|
||||||
const install_lib = b.addInstallFile(selected_lib_file, b.fmt("lib/{s}/{s}", .{ target_triple, lib_name }));
|
|
||||||
b.getInstallStep().dependOn(&install_lib.step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Install Step (for publishing) --- //
|
||||||
|
const install_lib = b.addInstallFile(selected_lib_file, b.fmt("lib/{s}/{s}", .{ target_triple, lib_name }));
|
||||||
|
b.getInstallStep().dependOn(&install_lib.step);
|
||||||
|
|
||||||
// --- Zig Module --- //
|
// --- Zig Module --- //
|
||||||
const mod = b.addModule("temporal_rs", .{
|
const mod = b.addModule("temporal_rs", .{
|
||||||
.root_source_file = b.path("src/root.zig"),
|
.root_source_file = b.path("src/root.zig"),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue