Commit 398f52c

Eric Bower  ·  2026-05-11 09:55:20 -0400 EDT
parent b0db3e1
chore: pico.sh ci script
2 files changed,  +56, -0
+13, -0
......@@ -0,0 +1,13 @@
1+FROM golang:1.25.0-alpine
2+
3+RUN apk add rsync openssh make gcc musl-dev
4+
5+WORKDIR /app
6+
7+COPY go.mod go.sum Makefile /app
8+
9+RUN go mod download
10+
11+ENV PICO_SECRET="danger"
12+
13+CMD ["go", "test", "-race", "./..."]
+43, -0
......@@ -0,0 +1,43 @@
1+#!/usr/bin/env bash
2+set -euo pipefail
3+
4+export ZMX_SESSION_PREFIX="${ZMX_SESSION_PREFIX:-ci.pico.}"
5+JOB_ID="${PICO_CI_JOB_ID:-local}"
6+EVENT_TYPE="${PICO_CI_EVENT_TYPE:-manual}"
7+
8+printf "\x1b[33m[%s] running ci (event=%s)\x1b[0m\n" "$JOB_ID" "$EVENT_TYPE"
9+
10+zmx run lint -d docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:v2.11.4 golangci-lint run
11+cat << EOF | zmx run tests -d
12+docker build -t pico-test -f ./Dockerfile.test . && \
13+docker run -t --rm -v $(pwd):/app pico-test
14+EOF
15+zmx wait "*"
16+printf "\x1b[32msuccess tests!\x1b[0m\n"
17+
18+if [ "$EVENT_TYPE" != "release" ]; then
19+ exit 0
20+fi
21+
22+DOCKER_TAG="latest"
23+DOCKER_PLATFORM="linux/amd64,linux/arm64"
24+
25+docker buildx ls | grep pico || docker buildx create --name pico
26+docker buildx use pico
27+zmx run caddy -d docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/caddy:$DOCKER_TAG" ./caddy
28+zmx run bouncer docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/bouncer:$DOCKER_TAG" ./bouncer
29+zmx wait "*"
30+
31+zmx run auth docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/auth-web:$DOCKER_TAG" --build-arg APP=auth --target release-web .
32+zmx run cdn docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/pgs-cdn:$DOCKER_TAG" --target release-web -f Dockerfile.cdn .
33+zmx run standalone docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pgs:$DOCKER_TAG" --target release -f Dockerfile.standalone .
34+zmx wait "*"
35+
36+apps=("prose" "pastes" "pgs" "feeds" "pipe")
37+for APP in "${apps[@]}"; do
38+ zmx run "$APP-ssh" -d docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/$APP-ssh:$DOCKER_TAG" --build-arg "APP=$APP" --target release-ssh .
39+ zmx run "$APP-web" -d docker buildx build --push --platform "$DOCKER_PLATFORM" -t "ghcr.io/picosh/pico/$APP-web:$DOCKER_TAG" --build-arg "APP=$APP" --target release-web .
40+ zmx wait "*"
41+done
42+
43+printf "\x1b[32msuccess release!\x1b[0m\n"