Merge pull request #3 from Yupcha/rebrand/memxt #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| - target: darwin-x86_64 | |
| runner: macos-13 | |
| - 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-v2 | |
| - 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: | | |
| if [ "$(uname -s)" = "Darwin" ]; then | |
| cmake -S lib/llama.cpp -B lib/llama.cpp/build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DBUILD_SHARED_LIBS=OFF \ | |
| -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: zig build --release=fast | |
| - name: Smoke test (incl. real embeddings) | |
| 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 | |
| ./zig-out/bin/memxt mine smoke.txt smoke | |
| ./zig-out/bin/memxt search "what is the deploy key" 2>&1 | grep -q QUASAR-77 | |
| - 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. |