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
M
pico.sh
+1,
-0
| ... | ... | @@ -10,6 +10,7 @@ zig_std_src/ | |
| 10 | 10 | ghostty_src/ | |
| 11 | 11 | prior_art/ | |
| 12 | 12 | .beads/ | |
| 13 | + | .envrc | |
| 13 | 14 | ||
| 14 | 15 | # Nix | |
| 15 | 16 | result |
+1,
-0
| ... | ... | @@ -10,6 +10,7 @@ Use spec: https://common-changelog.org/ | |
| 10 | 10 | - There are just too many edge cases with tracking exit status in other shells which makes | |
| 11 | 11 | `zmx run` much less useful for task management. | |
| 12 | 12 | - 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 | |
| 13 | 14 | ||
| 14 | 15 | ## v0.6.0 - 2026-05-16 | |
| 15 | 16 |
+1,
-1
| ... | ... | @@ -19,4 +19,4 @@ RUN rm ./mise.toml | |
| 19 | 19 | ||
| 20 | 20 | RUN zig build | |
| 21 | 21 | ||
| 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 { | |
| 80 | 80 | test_step.dependOn(&run_exe_unit_tests.step); | |
| 81 | 81 | } | |
| 82 | 82 | ||
| 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 | - | ||
| 91 | 83 | // Check for LSP integration | |
| 92 | 84 | { | |
| 93 | 85 | const check = b.step("check", "Check if zmx compiles"); |
| ... | ... | @@ -128,10 +120,11 @@ pub fn build(b: *std.Build) void { | |
| 128 | 120 | release_mod.addImport("ghostty-vt", release_dep.module("ghostty-vt")); | |
| 129 | 121 | } | |
| 130 | 122 | ||
| 123 | + | const is_macos = resolved.result.os.tag == .macos; | |
| 131 | 124 | const release_exe = b.addExecutable(.{ | |
| 132 | 125 | .name = "zmx", | |
| 133 | 126 | .use_llvm = true, | |
| 134 | - | .use_lld = true, | |
| 127 | + | .use_lld = !is_macos, | |
| 135 | 128 | .root_module = release_mod, | |
| 136 | 129 | }); | |
| 137 | 130 | release_exe.linkLibC(); |
| ... | ... | @@ -161,15 +154,4 @@ pub fn build(b: *std.Build) void { | |
| 161 | 154 | } | |
| 162 | 155 | } | |
| 163 | 156 | ||
| 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 | - | } | |
| 175 | 157 | } |
+3,
-0
| ... | ... | @@ -2,3 +2,6 @@ | |
| 2 | 2 | zig = "0.15.2" | |
| 3 | 3 | zls = "0.15.1" | |
| 4 | 4 | bats = "1.13.0" | |
| 5 | + | ||
| 6 | + | [tasks.test] | |
| 7 | + | run = "bats test/session.bats" |
M
pico.sh
+30,
-11
| ... | ... | @@ -6,26 +6,45 @@ EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}" | |
| 6 | 6 | ||
| 7 | 7 | echo "running ci event=${EVENT_TYPE} session=${ZMX_SESSION_PREFIX}" | |
| 8 | 8 | ||
| 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 | |
| 12 | 12 | fi | |
| 13 | 13 | ||
| 14 | + | zmx run install bash -c "mise trust && mise install" | |
| 15 | + | ||
| 14 | 16 | 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 | |
| 18 | 20 | zmx wait "*" | |
| 19 | 21 | ||
| 20 | - | if [[ $EVENT_TYPE != "release" ]]; then | |
| 22 | + | if [[ $EVENT_TYPE != "git.tag" ]]; then | |
| 21 | 23 | echo "success!" | |
| 22 | 24 | exit 0 | |
| 23 | 25 | fi | |
| 24 | 26 | ||
| 25 | - | NEW_VERSION="0.6.0" | |
| 27 | + | TAG="${PICO_CI_TAG_NAME}" | |
| 28 | + | NEW_VERSION="${PICO_CI_TAG_NAME#v}" | |
| 29 | + | ||
| 26 | 30 | 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 | |
| 30 | 49 | ||
| 31 | 50 | echo "success!" |