diff --git a/.github/workflows/artifact.yml b/.github/workflows/artifact.yml index 56fa1f9..cd10654 100644 --- a/.github/workflows/artifact.yml +++ b/.github/workflows/artifact.yml @@ -13,7 +13,7 @@ jobs: with: version: 0.10.0-dev.555+1b6a1e691 - run: | - zig build test -Dfetch + zig build test -Dfetch -Dci_target=${{matrix.os}} shell: bash - uses: actions/upload-artifact@v2 with: diff --git a/build2.zig b/build2.zig index 0630c3c..c118560 100644 --- a/build2.zig +++ b/build2.zig @@ -33,7 +33,14 @@ pub fn build(b: *Builder) !void { // having the iguana repo copied into this one //try addGithubReleaseExe(b, github_release_step, ziget_repo, "x86_64-linux", SslBackend.iguana); - const target = b.standardTargetOptions(.{}); + const target = if (b.option([]const u8, "ci_target", "the CI target being built")) |ci_target| + try std.zig.CrossTarget.parse(.{ .arch_os_abi = ci_target_map.get(ci_target) orelse { + std.log.err("unknown ci_target '{s}'", .{ci_target}); + std.os.exit(1); + } }) + else + b.standardTargetOptions(.{}); + const mode = b.standardReleaseOptions(); const zigup_build_options = b.addOptions(); @@ -185,3 +192,9 @@ fn addGithubReleaseExe(b: *Builder, github_release_step: *std.build.Step, ziget_ fn join(b: *Builder, parts: []const []const u8) ![]const u8 { return try std.fs.path.join(b.allocator, parts); } + +const ci_target_map = std.ComptimeStringMap([]const u8, .{ + .{ "ubuntu-latest", "x86_64-linux" }, + .{ "macos-latest", "x86_64-macos" }, + .{ "windows-latest", "x86_64-windows" }, +});