From 25b5d125d42fcef06d9cd89478193f3b5d8f5103 Mon Sep 17 00:00:00 2001 From: can1357 Date: Fri, 20 Feb 2026 10:33:25 +0100 Subject: [PATCH] ci: add install-method smoke tests and gate release Fixes #121 --- .github/workflows/ci.yml | 32 ++++++- scripts/install-tests/run-ci.sh | 92 +++++++++++++++++++ .../install-tests/{run.sh => run-podman.sh} | 0 3 files changed, 121 insertions(+), 3 deletions(-) create mode 100755 scripts/install-tests/run-ci.sh rename scripts/install-tests/{run.sh => run-podman.sh} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa2260874..1ac07b647 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,8 +46,7 @@ jobs: {"os":"macos-14","platform":"darwin","arch":"arm64"}, {"os":"windows-latest","platform":"win32","arch":"x64","variants":"baseline modern"} ]') || fromJSON('[ - {"os":"ubuntu-22.04","platform":"linux","arch":"x64","variants":"baseline modern"}, - {"os":"ubuntu-22.04","platform":"linux","arch":"arm64","target":"aarch64-unknown-linux-gnu"} + {"os":"ubuntu-22.04","platform":"linux","arch":"x64","variants":"baseline modern"} ]') }} runs-on: ${{ matrix.os }} steps: @@ -128,9 +127,36 @@ jobs: bun packages/coding-agent/src/cli.ts --help bun packages/coding-agent/src/cli.ts stats --help + install_methods: + runs-on: ubuntu-22.04 + env: + RUSTFLAGS: -C target-cpu=x86-64-v3 + steps: + - uses: actions/checkout@v4 + with: + lfs: true + - uses: oven-sh/setup-bun@v2 + with: + bun-version: "1.3" + - uses: dtolnay/rust-toolchain@nightly + - name: Cache bun dependencies + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: bun-${{ runner.os }}-${{ hashFiles('**/bun.lock') }} + - name: Install system deps + run: | + sudo apt-get update + sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev fd-find ripgrep imagemagick + sudo ln -s $(which fdfind) /usr/local/bin/fd + sudo ln -sf /usr/bin/convert /usr/local/bin/magick + - run: bun install --frozen-lockfile + - name: Install method smoke tests + run: bash scripts/install-tests/run-ci.sh + release: if: startsWith(github.ref, 'refs/tags/v') - needs: [rust, native, test] + needs: [rust, native, test, install_methods] runs-on: ubuntu-22.04 permissions: contents: write diff --git a/scripts/install-tests/run-ci.sh b/scripts/install-tests/run-ci.sh new file mode 100755 index 000000000..c1bc9e877 --- /dev/null +++ b/scripts/install-tests/run-ci.sh @@ -0,0 +1,92 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")/../.." +ROOT_DIR="$(pwd)" +WORK_DIR="$(mktemp -d)" +trap 'rm -rf "$WORK_DIR"' EXIT + +section() { + echo "" + echo "=== $1 ===" +} + +smoke_cli() { + local omp_bin="$1" + "$omp_bin" --version + "$omp_bin" --help >/dev/null + "$omp_bin" stats --summary >/dev/null +} + +find_tarball() { + local pattern="$1" + local matches=() + shopt -s nullglob + matches=("$pattern") + shopt -u nullglob + + if [ "${#matches[@]}" -ne 1 ]; then + echo "Expected exactly one tarball matching: $pattern" + exit 1 + fi + + echo "${matches[0]}" +} + +section "Binary install smoke" +bun --cwd=packages/natives run build:native +bun --cwd=packages/coding-agent run build:binary + +BINARY_DIR="$WORK_DIR/binary-bin" +mkdir -p "$BINARY_DIR" +cp packages/coding-agent/dist/omp "$BINARY_DIR/omp" +shopt -s nullglob +native_addons=(packages/natives/native/pi_natives.*.node) +shopt -u nullglob +if [ "${#native_addons[@]}" -eq 0 ]; then + echo "No native addon files found in packages/natives/native" + exit 1 +fi +cp "${native_addons[@]}" "$BINARY_DIR/" + +smoke_cli "$BINARY_DIR/omp" + +section "Source install smoke" +SOURCE_BUN_HOME="$WORK_DIR/bun-source" +( + export BUN_INSTALL="$SOURCE_BUN_HOME" + export PATH="$BUN_INSTALL/bin:$PATH" + bun --cwd="$ROOT_DIR/packages/coding-agent" link + smoke_cli "$BUN_INSTALL/bin/omp" +) + +section "Tarball install smoke" +TARBALL_DIR="$WORK_DIR/tarballs" +mkdir -p "$TARBALL_DIR" +for pkg in utils natives ai agent tui stats coding-agent; do + ( + cd "$ROOT_DIR/packages/$pkg" + bun pm pack --destination "$TARBALL_DIR" --quiet >/dev/null + ) +done + +utils_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-utils-*.tgz)" +natives_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-natives-*.tgz)" +ai_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-ai-*.tgz)" +agent_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-agent-core-*.tgz)" +tui_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-tui-*.tgz)" +stats_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-omp-stats-*.tgz)" +coding_agent_tgz="$(find_tarball "$TARBALL_DIR"/oh-my-pi-pi-coding-agent-*.tgz)" + +TARBALL_APP_DIR="$WORK_DIR/tarball-install" +mkdir -p "$TARBALL_APP_DIR" +( + cd "$TARBALL_APP_DIR" + bun init -y >/dev/null + bun add "$utils_tgz" "$natives_tgz" "$ai_tgz" "$agent_tgz" "$tui_tgz" "$stats_tgz" + bun add "$coding_agent_tgz" + smoke_cli ./node_modules/.bin/omp +) + +echo "" +echo "All install method smoke tests passed" diff --git a/scripts/install-tests/run.sh b/scripts/install-tests/run-podman.sh similarity index 100% rename from scripts/install-tests/run.sh rename to scripts/install-tests/run-podman.sh