main
pici.sh
Eric Bower
·
2026-09-05
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 -v "$(pwd):/app" -t zig-zmx:latest zig build release
12
13zmx run fmt -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest zig fmt --check .
14zmx run test -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest zig build test
15zmx run integration -d docker run --rm -v "$(pwd):/app" -t zig-zmx:latest bats --jobs 1 test/*.bats
16zmx wait "*"
17
18zmx run upload-build docker build -t zmx-upload -f Dockerfile.upload .
19
20if [[ $BRANCH = "main" ]]; then
21 zmx run upload docker run --rm \
22 -v "$(pwd)/README.md:/app/README.md:ro" \
23 -v "$(pwd)/logo.png:/app/logo.png:ro" \
24 -v "$(pwd)/index.tmpl:/app/index.tmpl:ro" \
25 -v ~/.ssh:/root/.ssh:ro \
26 zmx-upload
27fi
28
29if [[ $EVENT != "git.tag" ]]; then
30 echo "success!"
31 exit 0
32fi
33
34TAG="${PICI_TAG}"
35NEW_VERSION="${PICI_TAG#v}"
36
37zmx run brew bash gen-brew.sh "$NEW_VERSION"
38
39echo "distributing bins"
40zmx run upload docker run --rm \
41 -v "$(pwd)/zig-out/dist:/app/dist:ro" \
42 -v ~/.ssh:/root/.ssh:ro \
43 zmx-upload rsync -rv dist/ pgs.sh:/zmx/a
44zmx run gh-build docker build -t gh-release -f Dockerfile.release .
45zmx run gh docker run --rm \
46 -v "$(pwd)/zig-out/dist":/dist \
47 -e GH_TOKEN \
48 -e TAG="$TAG" \
49 gh-release
50
51echo "success!"