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 { | |
| 16 | 16 | const version = b.option([]const u8, "version", "Version string for release") orelse | |
| 17 | 17 | @as([]const u8, @import("build.zig.zon").version); | |
| 18 | 18 | ||
| 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 | - | ||
| 26 | 19 | const options = b.addOptions(); | |
| 27 | 20 | options.addOption([]const u8, "version", version); | |
| 28 | - | options.addOption([]const u8, "git_sha", git_sha); | |
| 29 | 21 | const ghostty_ver = @import("build.zig.zon").dependencies.ghostty.hash; | |
| 30 | 22 | options.addOption([]const u8, "ghostty_version", ghostty_ver); | |
| 31 | 23 |
| ... | ... | @@ -139,14 +131,14 @@ pub fn build(b: *std.Build) void { | |
| 139 | 131 | const arch_name = @tagName(release_target.cpu_arch orelse .x86_64); | |
| 140 | 132 | const tarball_name = b.fmt("zmx-{s}-{s}-{s}.tar.gz", .{ version, os_name, arch_name }); | |
| 141 | 133 | ||
| 142 | - | const tar = b.addSystemCommand(&.{ "tar", "--no-xattrs", "-czf" }); | |
| 134 | + | const tar = b.addSystemCommand(&.{ "tar", "-czf" }); | |
| 143 | 135 | ||
| 144 | 136 | const tarball = tar.addOutputFileArg(tarball_name); | |
| 145 | 137 | tar.addArg("-C"); | |
| 146 | 138 | tar.addDirectoryArg(release_exe.getEmittedBinDirectory()); | |
| 147 | 139 | tar.addArg("zmx"); | |
| 148 | 140 | ||
| 149 | - | const shasum = b.addSystemCommand(&.{ "shasum", "-a", "256" }); | |
| 141 | + | const shasum = b.addSystemCommand(&.{"sha256sum"}); | |
| 150 | 142 | shasum.addFileArg(tarball); | |
| 151 | 143 | const shasum_output = shasum.captureStdOut(); | |
| 152 | 144 |
M
pico.sh
+18,
-8
| ... | ... | @@ -1,16 +1,26 @@ | |
| 1 | 1 | #!/usr/bin/env bash | |
| 2 | - | set -xeo pipefail | |
| 2 | + | set -euo pipefail | |
| 3 | 3 | ||
| 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}" | |
| 5 | 6 | ||
| 6 | - | export ZMX_SESSION_PREFIX="ci-" | |
| 7 | + | echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}" | |
| 7 | 8 | ||
| 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 | |
| 9 | 19 | ||
| 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 | |
| 13 | 24 | zmx wait "*" | |
| 14 | 25 | ||
| 15 | - | zmx kill "*" | |
| 16 | 26 | echo "success!" |
+1,
-7
| ... | ... | @@ -1,6 +1,5 @@ | |
| 1 | 1 | const std = @import("std"); | |
| 2 | 2 | const posix = std.posix; | |
| 3 | - | const builtin = @import("builtin"); | |
| 4 | 3 | const build_options = @import("build_options"); | |
| 5 | 4 | const ghostty_vt = @import("ghostty-vt"); | |
| 6 | 5 | const ipc = @import("ipc.zig"); |
| ... | ... | @@ -11,7 +10,6 @@ const cross = @import("cross.zig"); | |
| 11 | 10 | const socket = @import("socket.zig"); | |
| 12 | 11 | ||
| 13 | 12 | pub const version = build_options.version; | |
| 14 | - | pub const git_sha = build_options.git_sha; | |
| 15 | 13 | pub const ghostty_version = build_options.ghostty_version; | |
| 16 | 14 | ||
| 17 | 15 | var log_system = log.LogSystem{}; |
| ... | ... | @@ -1202,13 +1200,9 @@ const Daemon = struct { | |
| 1202 | 1200 | fn printVersion(cfg: *Cfg) !void { | |
| 1203 | 1201 | var buf: [256]u8 = undefined; | |
| 1204 | 1202 | var w = std.fs.File.stdout().writer(&buf); | |
| 1205 | - | var ver = version; | |
| 1206 | - | if (builtin.mode == .Debug) { | |
| 1207 | - | ver = git_sha; | |
| 1208 | - | } | |
| 1209 | 1203 | try w.interface.print( | |
| 1210 | 1204 | "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 }, | |
| 1212 | 1206 | ); | |
| 1213 | 1207 | try w.interface.flush(); | |
| 1214 | 1208 | } |