Commit 769334b

Eric Bower  ·  2026-05-26 22:06:31 -0400 EDT
parent adb11d6
chore(ci): dockerizing main release steps
8 files changed,  +79, -32
+1, -0
1@@ -10,6 +10,7 @@ zig_std_src/
2 ghostty_src/
3 prior_art/
4 .beads/
5+.envrc
6 
7 # Nix
8 result
+1, -0
1@@ -10,6 +10,7 @@ Use spec: https://common-changelog.org/
2   - There are just too many edge cases with tracking exit status in other shells which makes
3     `zmx run` much less useful for task management.
4   - This means when using `zmx run` the target shell must have support for `$?` exit code tracking
5+- *BREAKING* `zmx tail` now strips ansi escape codes
6 
7 ## v0.6.0 - 2026-05-16
8 
+1, -1
1@@ -19,4 +19,4 @@ RUN rm ./mise.toml
2 
3 RUN zig build
4 
5-CMD ["zig", "build"]
6+CMD ["zig", "build", "-Doptimize=ReleaseSafe"]
+24, -0
 1@@ -0,0 +1,24 @@
 2+# Dockerfile for publishing GitHub releases
 3+
 4+FROM alpine:3.23
 5+
 6+RUN apk add --no-cache curl bash git
 7+
 8+ARG GH_VERSION=2.67.0
 9+RUN curl -L -o /tmp/gh.tar.gz \
10+    https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz && \
11+    cd /tmp && \
12+    tar -xzf gh.tar.gz && \
13+    cp gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh && \
14+    chmod +x /usr/local/bin/gh && \
15+    rm -rf /tmp/gh*
16+
17+ARG TAG
18+ENV GH_REPO="neurosnap/zmx"
19+
20+CMD ["sh", "-c", "test -n \"$TAG\" || { echo 'ERROR: TAG is required'; exit 1; }; \
21+      VERSION=\"${TAG#v}\"; \
22+      for f in /dist/*; do echo \"$f\" | grep -q \"zmx-$VERSION-\" || { echo \"ERROR: $f does not match $TAG\"; exit 1; }; done; \
23+      gh release delete \"$TAG\" --repo \"$GH_REPO\" --yes 2>/dev/null; \
24+      gh release create \"$TAG\" --repo \"$GH_REPO\" --title \"zmx $TAG\"; \
25+      gh release upload \"$TAG\" /dist/* --repo \"$GH_REPO\" --clobber"]
+17, -0
 1@@ -0,0 +1,17 @@
 2+# Dockerfile for uploading release artifacts and docs to pgs.sh
 3+
 4+FROM golang:1.21-alpine AS builder
 5+RUN go install github.com/picosh/pdocs/cmd@latest && mv /go/bin/cmd /go/bin/pdocs
 6+
 7+FROM alpine:3.23
 8+RUN apk add --no-cache rsync openssh-client
 9+
10+COPY --from=builder /go/bin/pdocs /usr/local/bin/pdocs
11+
12+WORKDIR /app
13+
14+CMD ["sh", "-c", " \
15+    cat README.md | pdocs -tmpl index.tmpl -toc | ssh pgs.sh /zmx/index.html && \
16+    rsync -v ./logo.png pgs.sh:/zmx/ && \
17+    rsync -rv dist/ pgs.sh:/zmx/a \
18+"]
+2, -20
 1@@ -80,14 +80,6 @@ pub fn build(b: *std.Build) void {
 2         test_step.dependOn(&run_exe_unit_tests.step);
 3     }
 4 
 5-    // Integration tests (bats)
 6-    {
 7-        const integration_step = b.step("test-integration", "Run bats integration tests");
 8-        const bats = b.addSystemCommand(&.{ "bats", "test/session.bats" });
 9-        bats.step.dependOn(b.getInstallStep());
10-        integration_step.dependOn(&bats.step);
11-    }
12-
13     // Check for LSP integration
14     {
15         const check = b.step("check", "Check if zmx compiles");
16@@ -128,10 +120,11 @@ pub fn build(b: *std.Build) void {
17                 release_mod.addImport("ghostty-vt", release_dep.module("ghostty-vt"));
18             }
19 
20+            const is_macos = resolved.result.os.tag == .macos;
21             const release_exe = b.addExecutable(.{
22                 .name = "zmx",
23                 .use_llvm = true,
24-                .use_lld = true,
25+                .use_lld = !is_macos,
26                 .root_module = release_mod,
27             });
28             release_exe.linkLibC();
29@@ -161,15 +154,4 @@ pub fn build(b: *std.Build) void {
30         }
31     }
32 
33-    // Upload artifacts to pgs
34-    {
35-        const upload_step = b.step("upload", "Upload docs and dist to pgs.sh:/zmx");
36-        const gen_doc = b.addSystemCommand(&.{ "sh", "-c", "cat README.md | pdocs -tmpl index.tmpl -toc | ssh pgs.sh /zmx/index.html" });
37-        const rsync_docs = b.addSystemCommand(&.{ "rsync", "-v", "./logo.png", "pgs.sh:/zmx/" });
38-        const rsync_dist = b.addSystemCommand(&.{ "rsync", "-rv", "zig-out/dist/", "pgs.sh:/zmx/a" });
39-
40-        upload_step.dependOn(&gen_doc.step);
41-        upload_step.dependOn(&rsync_docs.step);
42-        upload_step.dependOn(&rsync_dist.step);
43-    }
44 }
+3, -0
1@@ -2,3 +2,6 @@
2 zig = "0.15.2"
3 zls = "0.15.1"
4 bats = "1.13.0"
5+
6+[tasks.test]
7+run = "bats test/session.bats"
+30, -11
 1@@ -6,26 +6,45 @@ EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}"
 2 
 3 echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}"
 4 
 5-if command -v mise &> /dev/null; then
 6-  echo "mise is installed trusting workspace to suppress errors"
 7-  mise trust
 8+if ! command -v mise &> /dev/null; then
 9+  echo "ERR: mise is required"
10+  exit 1
11 fi
12 
13+zmx run install bash -c "mise trust && mise install"
14+
15 zmx run build docker build -t zig-zmx .
16-zmx run fmt -d docker run --rm -it zig-zmx zig fmt --check .
17-zmx run test -d docker run --rm -it zig-zmx zig build test
18-zmx run integration -d docker run --rm -it zig-zmx zig build test-integration
19+zmx run fmt -d docker run --rm -t zig-zmx:latest zig fmt --check .
20+zmx run test -d docker run --rm -t zig-zmx:latest zig build test
21+zmx run integration -d docker run --rm -t zig-zmx:latest zig build test-integration
22 zmx wait "*"
23 
24-if [[ $EVENT_TYPE != "release" ]]; then
25+if [[ $EVENT_TYPE != "git.tag" ]]; then
26   echo "success!"
27   exit 0
28 fi
29 
30-NEW_VERSION="0.6.0"
31+TAG="${PICO_CI_TAG_NAME}"
32+NEW_VERSION="${PICO_CI_TAG_NAME#v}"
33+
34 zmx run semver sed -i "s/\.version = \"[^\"]*\"/.version = \"$NEW_VERSION\"/" build.zig.zon && cat build.zig.zon
35-zmx run build-release -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig build release
36-# zmx run upload -d docker run --rm -it -v "$(pwd)":/app -v ~/.ssh:/root/.ssh:ro zig-zmx zig build upload
37-zmx wait "*"
38+zmx run update-readme sed -i "s/zmx-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/zmx-$NEW_VERSION/g" README.md
39+zmx run build-release -d docker run --rm -t zig-zmx:latest zig build release
40+
41+echo "distributing bins"
42+zmx run upload-build docker build -t zmx-upload -f Dockerfile.upload .
43+zmx run upload docker run --rm \
44+  -v "$(pwd)/README.md:/app/README.md:ro" \
45+  -v "$(pwd)/logo.png:/app/logo.png:ro" \
46+  -v "$(pwd)/index.tmpl:/app/index.tmpl:ro" \
47+  -v "$(pwd)/zig-out/dist:/app/dist:ro" \
48+  -v ~/.ssh:/root/.ssh:ro \
49+  zmx-upload
50+zmx run gh-build docker build -t gh-release -f Dockerfile.release .
51+zmx run gh docker run --rm \
52+  -v "$(pwd)/zig-out/dist":/dist \
53+  -e GH_TOKEN \
54+  -e TAG="$TAG" \
55+  gh-release
56 
57 echo "success!"