Skip to content

Commit

Permalink
cross compile on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
marler8997 committed Feb 9, 2022
1 parent faceefc commit a169b43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 14 additions & 1 deletion build2.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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" },
});

0 comments on commit a169b43

Please sign in to comment.