Skip to content

release: v0.3.3 — align versions, fix Homebrew tag interpolation #10

release: v0.3.3 — align versions, fix Homebrew tag interpolation

release: v0.3.3 — align versions, fix Homebrew tag interpolation #10

Workflow file for this run

name: Release Binaries
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- target: darwin-aarch64
runner: macos-latest
# Intel macOS: cross-compile on the plentiful arm runner (macos-13
# Intel runners are deprecated and queue-starved). The binary can't be
# run on the arm host, so its runtime smoke test is skipped.
- target: darwin-x86_64
runner: macos-latest
osx_arch: x86_64
zig_target: x86_64-macos
skip_run: "true"
- target: linux-x86_64
runner: ubuntu-latest
- target: linux-aarch64
runner: ubuntu-24.04-arm
steps:
- name: Checkout source (recursive)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Zig 0.16.0 (direct from ziglang.org)
env:
ZIG_VERSION: "0.16.0"
run: |
set -eux
case "$(uname -s)" in
Linux) ZIG_OS="linux" ;;
Darwin) ZIG_OS="macos" ;;
esac
case "$(uname -m)" in
x86_64|amd64) ZIG_ARCH="x86_64" ;;
aarch64|arm64) ZIG_ARCH="aarch64" ;;
esac
URL="https://ziglang.org/download/${ZIG_VERSION}/zig-${ZIG_ARCH}-${ZIG_OS}-${ZIG_VERSION}.tar.xz"
curl -fsSL "$URL" -o /tmp/zig.tar.xz
sudo mkdir -p /opt/zig
sudo tar -xJf /tmp/zig.tar.xz -C /opt/zig --strip-components=1
sudo ln -sf /opt/zig/zig /usr/local/bin/zig
zig version
- name: Install dependencies (macOS)
if: startsWith(matrix.target, 'darwin')
run: brew install cmake
- name: Install dependencies (Linux)
if: startsWith(matrix.target, 'linux')
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential clang libc++-dev libc++abi-dev
- name: Resolve llama.cpp submodule SHA
id: llama_sha
run: |
SHA=$(git -C lib/llama.cpp rev-parse HEAD)
echo "sha=$SHA" >> "$GITHUB_OUTPUT"
- name: Cache llama.cpp build output
id: cache_llama
uses: actions/cache@v4
with:
path: lib/llama.cpp/build
key: llama-cpp-${{ matrix.target }}-${{ steps.llama_sha.outputs.sha }}-libcxx-v3
- name: Download embedding model
run: |
mkdir -p lib
# MiniLM-L6-v2, 384-dim — must match EMBEDDING_DIM and the float[384] schema.
curl -L -o lib/minilm.gguf \
"https://huggingface.co/leliuga/all-MiniLM-L6-v2-GGUF/resolve/main/all-MiniLM-L6-v2.F16.gguf"
- name: Build llama.cpp static libraries
if: steps.cache_llama.outputs.cache-hit != 'true'
run: |
# Cross-compile flags for Intel macOS built on an arm runner.
# GGML_NATIVE=OFF stops ggml from applying host (apple-m2) CPU flags
# that clang rejects when targeting x86_64 ("unknown target CPU").
OSX_ARCH_FLAG=""
if [ -n "${{ matrix.osx_arch }}" ]; then OSX_ARCH_FLAG="-DCMAKE_OSX_ARCHITECTURES=${{ matrix.osx_arch }} -DGGML_NATIVE=OFF"; fi
if [ "$(uname -s)" = "Darwin" ]; then
cmake -S lib/llama.cpp -B lib/llama.cpp/build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
$OSX_ARCH_FLAG \
-DGGML_METAL=ON \
-DGGML_BLAS=ON \
-DLLAMA_BUILD_TESTS=OFF \
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_SERVER=OFF \
-DLLAMA_BUILD_TOOLS=OFF
else
CC=clang CXX=clang++ \
cmake -S lib/llama.cpp -B lib/llama.cpp/build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" \
-DGGML_METAL=OFF \
-DGGML_BLAS=OFF \
-DLLAMA_BUILD_TESTS=OFF \
-DLLAMA_BUILD_EXAMPLES=OFF \
-DLLAMA_BUILD_SERVER=OFF
fi
cmake --build lib/llama.cpp/build -j
- name: Build release
run: |
if [ -n "${{ matrix.zig_target }}" ]; then
zig build --release=fast -Dtarget=${{ matrix.zig_target }}
else
zig build --release=fast
fi
- name: Smoke test (incl. real embeddings)
# Skip for a cross-compiled binary that can't run on this host.
if: ${{ matrix.skip_run != 'true' }}
run: |
set -eux
./zig-out/bin/memxt init
./zig-out/bin/memxt stats
# Validate the full semantic path: mine a file, then recall it.
printf 'The deploy key id is QUASAR-77 and must never be logged.\n' > smoke.txt
# Mine into an explicit wing; project-derived default wing is the git
# repo name (memxt), so search must pass --wing or it will miss.
./zig-out/bin/memxt mine smoke.txt smoke
./zig-out/bin/memxt search "what is the deploy key" --wing smoke 2>&1 | tee /tmp/memxt-search.out
grep -q QUASAR-77 /tmp/memxt-search.out
- name: Package tarball
env:
TARGET: ${{ matrix.target }}
run: |
TARBALL="memxt-${TARGET}.tar.gz"
tar -czf "$TARBALL" -C zig-out/bin memxt
shasum -a 256 "$TARBALL" > "$TARBALL.sha256"
ls -lh "$TARBALL" "$TARBALL.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: memxt-${{ matrix.target }}
path: |
memxt-${{ matrix.target }}.tar.gz
memxt-${{ matrix.target }}.tar.gz.sha256
release:
name: Publish GitHub Release
needs: build
# Publish whatever platforms succeeded even if one leg fails, rather than
# skipping the whole release (fail-fast is off on the build matrix).
if: ${{ always() && !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/*.sha256
generate_release_notes: true
body: |
Install with one line:
```bash
curl -fsSL https://raw.githubusercontent.com/Yupcha/memxt/main/install.sh | bash
```
Prebuilt binaries attached for darwin-aarch64, darwin-x86_64, linux-x86_64, linux-aarch64.