main
pici.sh
Eric Bower
·
2026-10-16
1#!/usr/bin/env bash
2set -euo pipefail
3
4export ZMX_SESSION_PREFIX="${ZMX_SESSION_PREFIX:-ci.zmx.}"
5EVENT="${PICI_EVENT:-manual}"
6BRANCH="${PICI_BRANCH:-tmp}"
7
8echo "running ci event=${EVENT} session=${ZMX_SESSION_PREFIX}"
9
10zmx run build docker build -t zig-zmx .
11zmx run build-release docker run --rm \
12 --ulimit stack=67108864:67108864 \
13 -v "$(pwd):/app" \
14 -t zig-zmx:latest zig build release -j8
15
16zmx run fmt -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest zig fmt --check .
17zmx run test -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest zig build test
18zmx run integration -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest bats --jobs 1 test/*.bats
19zmx wait "*"
20
21zmx run upload-build docker build -t zmx-upload -f Dockerfile.upload .
22
23if [[ $BRANCH = "main" ]]; then
24 zmx run upload docker run --rm \
25 -v "$(pwd)/README.md:/app/README.md:ro" \
26 -v "$(pwd)/logo.png:/app/logo.png:ro" \
27 -v "$(pwd)/index.tmpl:/app/index.tmpl:ro" \
28 -v ~/.ssh:/root/.ssh:ro \
29 zmx-upload
30fi
31
32if [[ $EVENT != "git.tag" ]]; then
33 echo "success!"
34 exit 0
35fi
36
37TAG="${PICI_TAG}"
38NEW_VERSION="${PICI_TAG#v}"
39
40zmx run brew bash gen-brew.sh "$NEW_VERSION"
41
42echo "distributing bins"
43zmx run upload docker run --rm \
44 -v "$(pwd)/zig-out/dist:/app/dist:ro" \
45 -v ~/.ssh:/root/.ssh:ro \
46 zmx-upload rsync -rv dist/ pgs.sh:/zmx/a
47zmx run gh-build docker build -t gh-release -f Dockerfile.release .
48zmx run gh docker run --rm \
49 -v "$(pwd)/zig-out/dist":/dist \
50 -e GH_TOKEN \
51 -e TAG="$TAG" \
52 gh-release
53
54echo "success!"