Commit 5d7aadc

Eric Bower  ·  2026-05-09 11:03:56 -0400 EDT
parent 7ef2be4
feat: pico.sh ci integration
3 files changed,  +21, -25
+2, -10
......@@ -16,16 +16,8 @@ pub fn build(b: *std.Build) void {
1616 const version = b.option([]const u8, "version", "Version string for release") orelse
1717 @as([]const u8, @import("build.zig.zon").version);
1818
19- var code: u8 = 0;
20- const git_sha = std.mem.trim(u8, b.runAllowFail(
21- &.{ "git", "rev-parse", "--short", "HEAD" },
22- &code,
23- .Inherit,
24- ) catch "unknown", "\n");
25-
2619 const options = b.addOptions();
2720 options.addOption([]const u8, "version", version);
28- options.addOption([]const u8, "git_sha", git_sha);
2921 const ghostty_ver = @import("build.zig.zon").dependencies.ghostty.hash;
3022 options.addOption([]const u8, "ghostty_version", ghostty_ver);
3123
......@@ -139,14 +131,14 @@ pub fn build(b: *std.Build) void {
139131 const arch_name = @tagName(release_target.cpu_arch orelse .x86_64);
140132 const tarball_name = b.fmt("zmx-{s}-{s}-{s}.tar.gz", .{ version, os_name, arch_name });
141133
142- const tar = b.addSystemCommand(&.{ "tar", "--no-xattrs", "-czf" });
134+ const tar = b.addSystemCommand(&.{ "tar", "-czf" });
143135
144136 const tarball = tar.addOutputFileArg(tarball_name);
145137 tar.addArg("-C");
146138 tar.addDirectoryArg(release_exe.getEmittedBinDirectory());
147139 tar.addArg("zmx");
148140
149- const shasum = b.addSystemCommand(&.{ "shasum", "-a", "256" });
141+ const shasum = b.addSystemCommand(&.{"sha256sum"});
150142 shasum.addFileArg(tarball);
151143 const shasum_output = shasum.captureStdOut();
152144
+18, -8
......@@ -1,16 +1,26 @@
11 #!/usr/bin/env bash
2-set -xeo pipefail
2+set -euo pipefail
33
4-# This is a little experiement seeing how we could use zmx as a job engine for CI
4+export ZMX_SESSION_PREFIX="${ZMX_SESSION_PREFIX:-ci.zmx.}"
5+EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}"
56
6-export ZMX_SESSION_PREFIX="ci-"
7+echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}"
78
8-zmx run build podman build -t zig .
9+zmx run build docker build -t zig-zmx .
10+zmx run fmt -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig fmt --check .
11+zmx run test -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig build test
12+zmx run integration -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig build test-integration
13+zmx wait "*"
14+
15+if [[ $EVENT_TYPE != "release" ]]; then
16+ echo "success!"
17+ exit 0
18+fi
919
10-zmx run fmt -d podman run --rm -it -v "$(pwd)":/app zig zig fmt --check .
11-zmx run test -d podman run --rm -it -v "$(pwd)":/app zig zig build test --summary all
12-zmx run integration -d podman run --rm -it -v "$(pwd)":/app zig zig build test-integration
20+NEW_VERSION="0.6.0"
21+zmx run semver sed -i "s/\.version = \"[^\"]*\"/.version = \"$NEW_VERSION\"/" build.zig.zon && cat build.zig.zon
22+zmx run build-release -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig build release
23+# zmx run upload -d docker run --rm -it -v "$(pwd)":/app -v ~/.ssh:/root/.ssh:ro zig-zmx zig build upload
1324 zmx wait "*"
1425
15-zmx kill "*"
1626 echo "success!"
+1, -7
......@@ -1,6 +1,5 @@
11 const std = @import("std");
22 const posix = std.posix;
3-const builtin = @import("builtin");
43 const build_options = @import("build_options");
54 const ghostty_vt = @import("ghostty-vt");
65 const ipc = @import("ipc.zig");
......@@ -11,7 +10,6 @@ const cross = @import("cross.zig");
1110 const socket = @import("socket.zig");
1211
1312 pub const version = build_options.version;
14-pub const git_sha = build_options.git_sha;
1513 pub const ghostty_version = build_options.ghostty_version;
1614
1715 var log_system = log.LogSystem{};
......@@ -1202,13 +1200,9 @@ const Daemon = struct {
12021200 fn printVersion(cfg: *Cfg) !void {
12031201 var buf: [256]u8 = undefined;
12041202 var w = std.fs.File.stdout().writer(&buf);
1205- var ver = version;
1206- if (builtin.mode == .Debug) {
1207- ver = git_sha;
1208- }
12091203 try w.interface.print(
12101204 "zmx\t\t{s}\nghostty_vt\t{s}\nsocket_dir\t{s}\nlog_dir\t\t{s}\n",
1211- .{ ver, ghostty_version, cfg.socket_dir, cfg.log_dir },
1205+ .{ version, ghostty_version, cfg.socket_dir, cfg.log_dir },
12121206 );
12131207 try w.interface.flush();
12141208 }