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
......@@ -10,6 +10,7 @@ zig_std_src/
1010 ghostty_src/
1111 prior_art/
1212 .beads/
13+.envrc
1314
1415 # Nix
1516 result
+1, -0
......@@ -10,6 +10,7 @@ Use spec: https://common-changelog.org/
1010 - There are just too many edge cases with tracking exit status in other shells which makes
1111 `zmx run` much less useful for task management.
1212 - This means when using `zmx run` the target shell must have support for `$?` exit code tracking
13+- *BREAKING* `zmx tail` now strips ansi escape codes
1314
1415 ## v0.6.0 - 2026-05-16
1516
+1, -1
......@@ -19,4 +19,4 @@ RUN rm ./mise.toml
1919
2020 RUN zig build
2121
22-CMD ["zig", "build"]
22+CMD ["zig", "build", "-Doptimize=ReleaseSafe"]
+24, -0
......@@ -0,0 +1,24 @@
1+# Dockerfile for publishing GitHub releases
2+
3+FROM alpine:3.23
4+
5+RUN apk add --no-cache curl bash git
6+
7+ARG GH_VERSION=2.67.0
8+RUN curl -L -o /tmp/gh.tar.gz \
9+ https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz && \
10+ cd /tmp && \
11+ tar -xzf gh.tar.gz && \
12+ cp gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh && \
13+ chmod +x /usr/local/bin/gh && \
14+ rm -rf /tmp/gh*
15+
16+ARG TAG
17+ENV GH_REPO="neurosnap/zmx"
18+
19+CMD ["sh", "-c", "test -n \"$TAG\" || { echo 'ERROR: TAG is required'; exit 1; }; \
20+ VERSION=\"${TAG#v}\"; \
21+ for f in /dist/*; do echo \"$f\" | grep -q \"zmx-$VERSION-\" || { echo \"ERROR: $f does not match $TAG\"; exit 1; }; done; \
22+ gh release delete \"$TAG\" --repo \"$GH_REPO\" --yes 2>/dev/null; \
23+ gh release create \"$TAG\" --repo \"$GH_REPO\" --title \"zmx $TAG\"; \
24+ gh release upload \"$TAG\" /dist/* --repo \"$GH_REPO\" --clobber"]
+17, -0
......@@ -0,0 +1,17 @@
1+# Dockerfile for uploading release artifacts and docs to pgs.sh
2+
3+FROM golang:1.21-alpine AS builder
4+RUN go install github.com/picosh/pdocs/cmd@latest && mv /go/bin/cmd /go/bin/pdocs
5+
6+FROM alpine:3.23
7+RUN apk add --no-cache rsync openssh-client
8+
9+COPY --from=builder /go/bin/pdocs /usr/local/bin/pdocs
10+
11+WORKDIR /app
12+
13+CMD ["sh", "-c", " \
14+ cat README.md | pdocs -tmpl index.tmpl -toc | ssh pgs.sh /zmx/index.html && \
15+ rsync -v ./logo.png pgs.sh:/zmx/ && \
16+ rsync -rv dist/ pgs.sh:/zmx/a \
17+"]
+2, -20
......@@ -80,14 +80,6 @@ pub fn build(b: *std.Build) void {
8080 test_step.dependOn(&run_exe_unit_tests.step);
8181 }
8282
83- // Integration tests (bats)
84- {
85- const integration_step = b.step("test-integration", "Run bats integration tests");
86- const bats = b.addSystemCommand(&.{ "bats", "test/session.bats" });
87- bats.step.dependOn(b.getInstallStep());
88- integration_step.dependOn(&bats.step);
89- }
90-
9183 // Check for LSP integration
9284 {
9385 const check = b.step("check", "Check if zmx compiles");
......@@ -128,10 +120,11 @@ pub fn build(b: *std.Build) void {
128120 release_mod.addImport("ghostty-vt", release_dep.module("ghostty-vt"));
129121 }
130122
123+ const is_macos = resolved.result.os.tag == .macos;
131124 const release_exe = b.addExecutable(.{
132125 .name = "zmx",
133126 .use_llvm = true,
134- .use_lld = true,
127+ .use_lld = !is_macos,
135128 .root_module = release_mod,
136129 });
137130 release_exe.linkLibC();
......@@ -161,15 +154,4 @@ pub fn build(b: *std.Build) void {
161154 }
162155 }
163156
164- // Upload artifacts to pgs
165- {
166- const upload_step = b.step("upload", "Upload docs and dist to pgs.sh:/zmx");
167- const gen_doc = b.addSystemCommand(&.{ "sh", "-c", "cat README.md | pdocs -tmpl index.tmpl -toc | ssh pgs.sh /zmx/index.html" });
168- const rsync_docs = b.addSystemCommand(&.{ "rsync", "-v", "./logo.png", "pgs.sh:/zmx/" });
169- const rsync_dist = b.addSystemCommand(&.{ "rsync", "-rv", "zig-out/dist/", "pgs.sh:/zmx/a" });
170-
171- upload_step.dependOn(&gen_doc.step);
172- upload_step.dependOn(&rsync_docs.step);
173- upload_step.dependOn(&rsync_dist.step);
174- }
175157 }
+3, -0
......@@ -2,3 +2,6 @@
22 zig = "0.15.2"
33 zls = "0.15.1"
44 bats = "1.13.0"
5+
6+[tasks.test]
7+run = "bats test/session.bats"
+30, -11
......@@ -6,26 +6,45 @@ EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}"
66
77 echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}"
88
9-if command -v mise &> /dev/null; then
10- echo "mise is installed trusting workspace to suppress errors"
11- mise trust
9+if ! command -v mise &> /dev/null; then
10+ echo "ERR: mise is required"
11+ exit 1
1212 fi
1313
14+zmx run install bash -c "mise trust && mise install"
15+
1416 zmx run build docker build -t zig-zmx .
15-zmx run fmt -d docker run --rm -it zig-zmx zig fmt --check .
16-zmx run test -d docker run --rm -it zig-zmx zig build test
17-zmx run integration -d docker run --rm -it zig-zmx zig build test-integration
17+zmx run fmt -d docker run --rm -t zig-zmx:latest zig fmt --check .
18+zmx run test -d docker run --rm -t zig-zmx:latest zig build test
19+zmx run integration -d docker run --rm -t zig-zmx:latest zig build test-integration
1820 zmx wait "*"
1921
20-if [[ $EVENT_TYPE != "release" ]]; then
22+if [[ $EVENT_TYPE != "git.tag" ]]; then
2123 echo "success!"
2224 exit 0
2325 fi
2426
25-NEW_VERSION="0.6.0"
27+TAG="${PICO_CI_TAG_NAME}"
28+NEW_VERSION="${PICO_CI_TAG_NAME#v}"
29+
2630 zmx run semver sed -i "s/\.version = \"[^\"]*\"/.version = \"$NEW_VERSION\"/" build.zig.zon && cat build.zig.zon
27-zmx run build-release -d docker run --rm -it -v "$(pwd)":/app zig-zmx zig build release
28-# zmx run upload -d docker run --rm -it -v "$(pwd)":/app -v ~/.ssh:/root/.ssh:ro zig-zmx zig build upload
29-zmx wait "*"
31+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
32+zmx run build-release -d docker run --rm -t zig-zmx:latest zig build release
33+
34+echo "distributing bins"
35+zmx run upload-build docker build -t zmx-upload -f Dockerfile.upload .
36+zmx run upload docker run --rm \
37+ -v "$(pwd)/README.md:/app/README.md:ro" \
38+ -v "$(pwd)/logo.png:/app/logo.png:ro" \
39+ -v "$(pwd)/index.tmpl:/app/index.tmpl:ro" \
40+ -v "$(pwd)/zig-out/dist:/app/dist:ro" \
41+ -v ~/.ssh:/root/.ssh:ro \
42+ zmx-upload
43+zmx run gh-build docker build -t gh-release -f Dockerfile.release .
44+zmx run gh docker run --rm \
45+ -v "$(pwd)/zig-out/dist":/dist \
46+ -e GH_TOKEN \
47+ -e TAG="$TAG" \
48+ gh-release
3049
3150 echo "success!"