perf: -256kb RAM consumption for persistent index #460
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: Prebuild | |
| on: | |
| push: | |
| branches: [main, fix/download-version] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build-nvim: | |
| name: Build Neovim ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| ## Linux builds (using cargo-zigbuild) | |
| # Glibc 2.17 (RHEL 7, CentOS 7 compatible) | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| zigbuild_target: x86_64-unknown-linux-gnu.2.17 | |
| artifact_name: target/x86_64-unknown-linux-gnu/release/libfff_nvim.so | |
| ext: so | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| zigbuild_target: aarch64-unknown-linux-gnu.2.17 | |
| artifact_name: target/aarch64-unknown-linux-gnu/release/libfff_nvim.so | |
| ext: so | |
| # Musl (statically linked) | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact_name: target/x86_64-unknown-linux-musl/release/libfff_nvim.so | |
| ext: so | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| artifact_name: target/aarch64-unknown-linux-musl/release/libfff_nvim.so | |
| ext: so | |
| ## Android (Termux) | |
| - os: ubuntu-latest | |
| target: aarch64-linux-android | |
| artifact_name: target/aarch64-linux-android/release/libfff_nvim.so | |
| ext: so | |
| ## macOS builds | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: target/x86_64-apple-darwin/release/libfff_nvim.dylib | |
| ext: dylib | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: target/aarch64-apple-darwin/release/libfff_nvim.dylib | |
| ext: dylib | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: target/x86_64-pc-windows-msvc/release/fff_nvim.dll | |
| ext: dll | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact_name: target/aarch64-pc-windows-msvc/release/fff_nvim.dll | |
| ext: dll | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Install cargo-zigbuild | |
| if: contains(matrix.os, 'ubuntu') | |
| run: cargo install cargo-zigbuild | |
| - name: Build for Linux | |
| if: contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'android') | |
| run: | | |
| cargo zigbuild --release --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-nvim --features zlob | |
| mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for Android (Termux) | |
| if: contains(matrix.target, 'android') | |
| run: | | |
| NDK_BIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" | |
| # NDK clang for C deps (libgit2, lmdb, blake3) that need Bionic sysroot headers | |
| export CC_aarch64_linux_android="$NDK_BIN/aarch64-linux-android24-clang" | |
| export CXX_aarch64_linux_android="$NDK_BIN/aarch64-linux-android24-clang++" | |
| export AR_aarch64_linux_android="$NDK_BIN/llvm-ar" | |
| export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_BIN/aarch64-linux-android24-clang" | |
| cargo build --release --target ${{ matrix.target }} -p fff-nvim --features zlob | |
| mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for macOS | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }} -p fff-nvim --features zlob | |
| mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Ad-hoc sign macOS binary | |
| if: contains(matrix.os, 'macos') | |
| run: codesign --force --sign - "${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for Windows | |
| if: contains(matrix.os, 'windows') | |
| shell: bash | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} -p fff-nvim --features zlob | |
| mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nvim-${{ matrix.target }} | |
| path: ${{ matrix.target }}.* | |
| build-c: | |
| name: Build C FFI ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| ## Linux builds | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| zigbuild_target: x86_64-unknown-linux-gnu.2.17 | |
| artifact_name: target/x86_64-unknown-linux-gnu/release/libfff_c.so | |
| npm_package: fff-bin-linux-x64-gnu | |
| lib_filename: libfff_c.so | |
| ext: so | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| zigbuild_target: aarch64-unknown-linux-gnu.2.17 | |
| artifact_name: target/aarch64-unknown-linux-gnu/release/libfff_c.so | |
| npm_package: fff-bin-linux-arm64-gnu | |
| lib_filename: libfff_c.so | |
| ext: so | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact_name: target/x86_64-unknown-linux-musl/release/libfff_c.so | |
| npm_package: fff-bin-linux-x64-musl | |
| lib_filename: libfff_c.so | |
| ext: so | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| artifact_name: target/aarch64-unknown-linux-musl/release/libfff_c.so | |
| npm_package: fff-bin-linux-arm64-musl | |
| lib_filename: libfff_c.so | |
| ext: so | |
| ## Android (Termux) | |
| - os: ubuntu-latest | |
| target: aarch64-linux-android | |
| artifact_name: target/aarch64-linux-android/release/libfff_c.so | |
| lib_filename: libfff_c.so | |
| ext: so | |
| ## macOS builds | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: target/x86_64-apple-darwin/release/libfff_c.dylib | |
| npm_package: fff-bin-darwin-x64 | |
| lib_filename: libfff_c.dylib | |
| ext: dylib | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: target/aarch64-apple-darwin/release/libfff_c.dylib | |
| npm_package: fff-bin-darwin-arm64 | |
| lib_filename: libfff_c.dylib | |
| ext: dylib | |
| ## Windows builds | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: target/x86_64-pc-windows-msvc/release/fff_c.dll | |
| npm_package: fff-bin-win32-x64 | |
| lib_filename: fff_c.dll | |
| ext: dll | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact_name: target/aarch64-pc-windows-msvc/release/fff_c.dll | |
| npm_package: fff-bin-win32-arm64 | |
| lib_filename: fff_c.dll | |
| ext: dll | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Install cargo-zigbuild | |
| if: contains(matrix.os, 'ubuntu') | |
| run: cargo install cargo-zigbuild | |
| - name: Build for Linux | |
| if: contains(matrix.os, 'ubuntu') && !contains(matrix.target, 'android') | |
| run: | | |
| cargo zigbuild --release --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-c --features zlob | |
| mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for Android (Termux) | |
| if: contains(matrix.target, 'android') | |
| run: | | |
| NDK_BIN="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" | |
| export CC_aarch64_linux_android="$NDK_BIN/aarch64-linux-android24-clang" | |
| export CXX_aarch64_linux_android="$NDK_BIN/aarch64-linux-android24-clang++" | |
| export AR_aarch64_linux_android="$NDK_BIN/llvm-ar" | |
| export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_BIN/aarch64-linux-android24-clang" | |
| cargo build --release --target ${{ matrix.target }} -p fff-c --features zlob | |
| mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for macOS | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }} -p fff-c --features zlob | |
| mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Ad-hoc sign macOS binary | |
| if: contains(matrix.os, 'macos') | |
| run: codesign --force --sign - "c-lib-${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Build for Windows | |
| if: contains(matrix.os, 'windows') | |
| shell: bash | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} -p fff-c --features zlob | |
| mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}" | |
| - name: Prepare npm package | |
| if: "!contains(matrix.target, 'android')" | |
| shell: bash | |
| run: | | |
| # Copy the built binary into the platform npm package directory | |
| cp "c-lib-${{ matrix.target }}.${{ matrix.ext }}" "packages/${{ matrix.npm_package }}/${{ matrix.lib_filename }}" | |
| - name: Upload C library artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: c-lib-${{ matrix.target }} | |
| path: c-lib-${{ matrix.target }}.* | |
| - name: Upload npm package artifact | |
| if: "!contains(matrix.target, 'android')" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-${{ matrix.npm_package }} | |
| path: packages/${{ matrix.npm_package }}/ | |
| build-mcp: | |
| name: Build MCP ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| ## Linux builds (using cargo-zigbuild) | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| zigbuild_target: x86_64-unknown-linux-gnu.2.17 | |
| artifact_name: target/x86_64-unknown-linux-gnu/release/fff-mcp | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| zigbuild_target: aarch64-unknown-linux-gnu.2.17 | |
| artifact_name: target/aarch64-unknown-linux-gnu/release/fff-mcp | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| artifact_name: target/x86_64-unknown-linux-musl/release/fff-mcp | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| artifact_name: target/aarch64-unknown-linux-musl/release/fff-mcp | |
| ## macOS builds | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| artifact_name: target/x86_64-apple-darwin/release/fff-mcp | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| artifact_name: target/aarch64-apple-darwin/release/fff-mcp | |
| ## Windows builds | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| artifact_name: target/x86_64-pc-windows-msvc/release/fff-mcp.exe | |
| - os: windows-latest | |
| target: aarch64-pc-windows-msvc | |
| artifact_name: target/aarch64-pc-windows-msvc/release/fff-mcp.exe | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Install Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Install cargo-zigbuild | |
| if: contains(matrix.os, 'ubuntu') | |
| run: cargo install cargo-zigbuild | |
| - name: Build for Linux | |
| if: contains(matrix.os, 'ubuntu') | |
| run: | | |
| cargo zigbuild --release --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-mcp --features zlob | |
| cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}" | |
| - name: Build for macOS | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }} -p fff-mcp --features zlob | |
| cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}" | |
| - name: Ad-hoc sign macOS binary | |
| if: contains(matrix.os, 'macos') | |
| run: codesign --force --sign - "fff-mcp-${{ matrix.target }}" | |
| - name: Build for Windows | |
| if: contains(matrix.os, 'windows') | |
| shell: bash | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} -p fff-mcp --features zlob | |
| cp "${{ matrix.artifact_name }}" "fff-mcp-${{ matrix.target }}.exe" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mcp-${{ matrix.target }} | |
| path: fff-mcp-${{ matrix.target }}* | |
| release: | |
| name: Release | |
| needs: [build-nvim, build-c, build-mcp] | |
| runs-on: ubuntu-latest | |
| # do not create releases on the forks (no permissions) | |
| if: github.event_name != 'pull_request' || github.event.pull_request.user.login == 'dmtrKovalenko' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Lua | |
| uses: leafo/gh-actions-lua@v12 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./binaries | |
| - name: Flatten and rename Neovim artifacts | |
| working-directory: ./binaries | |
| run: | | |
| # Move nvim artifacts to root level with original naming | |
| for dir in nvim-*/; do | |
| target="${dir#nvim-}" | |
| target="${target%/}" | |
| for file in "$dir"*; do | |
| if [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| mv "$file" "./$filename" | |
| fi | |
| done | |
| rmdir "$dir" 2>/dev/null || true | |
| done | |
| - name: Flatten C library artifacts | |
| working-directory: ./binaries | |
| run: | | |
| # Move c-lib artifacts to root level | |
| for dir in c-lib-*/; do | |
| for file in "$dir"*; do | |
| if [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| mv "$file" "./$filename" | |
| fi | |
| done | |
| rmdir "$dir" 2>/dev/null || true | |
| done | |
| - name: Flatten MCP artifacts | |
| working-directory: ./binaries | |
| run: | | |
| for dir in mcp-*/; do | |
| for file in "$dir"*; do | |
| if [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| mv "$file" "./$filename" | |
| fi | |
| done | |
| rmdir "$dir" 2>/dev/null || true | |
| done | |
| - name: Remove npm package artifacts from release binaries | |
| working-directory: ./binaries | |
| run: | | |
| rm -rf npm-* | |
| - name: Generate checksums | |
| working-directory: ./binaries | |
| run: | | |
| ls -la | |
| for file in *; do | |
| if [ -f "$file" ] && [[ ! "$file" == *.sha256 ]]; then | |
| sha256sum "$file" > "${file}.sha256" | |
| fi | |
| done | |
| - name: Determine version | |
| id: version | |
| run: lua scripts/determine-version.lua | |
| - name: Upload Release Assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "${{ steps.version.outputs.version }}" | |
| tag_name: "${{ steps.version.outputs.is_release == 'true' && format('v{0}', steps.version.outputs.version) || steps.version.outputs.version }}" | |
| token: ${{ github.token }} | |
| files: ./binaries/* | |
| draft: false | |
| prerelease: ${{ steps.version.outputs.is_release != 'true' }} | |
| generate_release_notes: ${{ steps.version.outputs.is_release == 'true' }} | |
| body: | | |
| ${{ steps.version.outputs.is_release == 'true' && format('Release {0}', steps.version.outputs.version) || format('Nightly release from commit: {0}', github.sha) }} | |
| ## Neovim Plugin | |
| - `{target}.so` / `.dylib` / `.dll` - Lua module for Neovim | |
| ## C FFI Library (for Bun/Node/Python) | |
| - `c-lib-{target}.so` / `.dylib` / `.dll` - C FFI library | |
| ## MCP Server | |
| - `fff-mcp-{target}` - MCP server binary | |
| Install with: | |
| ```sh | |
| curl -fsSL https://raw.githubusercontent.com/dmtrKovalenko/fff.nvim/main/install-mcp.sh | bash | |
| ``` | |
| crates-publish: | |
| name: Publish Rust crates | |
| needs: [build-nvim, build-c, build-mcp] | |
| runs-on: ubuntu-latest | |
| if: >- | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fix/download-version' || startsWith(github.ref, 'refs/tags/v'))) | |
| || (github.event_name == 'pull_request' && github.head_ref == 'main') | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Lua | |
| uses: leafo/gh-actions-lua@v12 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-edit | |
| run: cargo install cargo-edit | |
| - name: Determine version | |
| id: version | |
| run: lua scripts/determine-version.lua | |
| - name: Publish crates | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: make publish-crates V="${{ steps.version.outputs.version }}" | |
| npm-publish: | |
| name: Publish npm packages | |
| needs: [build-c] | |
| runs-on: ubuntu-latest | |
| if: >- | |
| (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/fix/download-version' || startsWith(github.ref, 'refs/tags/v'))) | |
| || (github.event_name == 'pull_request' && github.head_ref == 'main') | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Lua | |
| uses: leafo/gh-actions-lua@v12 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "25" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Determine version | |
| id: version | |
| run: lua scripts/determine-version.lua | |
| - name: Download npm package artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: npm-* | |
| path: ./npm-packages | |
| - name: Publish platform packages | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| TAG="${{ steps.version.outputs.npm_tag }}" | |
| for pkg_dir in ./npm-packages/npm-*/; do | |
| if [ -d "$pkg_dir" ]; then | |
| pkg_name=$(node -p "require('${pkg_dir}package.json').name") | |
| echo "Publishing ${pkg_name}@${VERSION} with tag ${TAG}..." | |
| make set-npm-version PKG="$pkg_dir" VERSION="$VERSION" | |
| cd "$pkg_dir" | |
| npm publish --tag "$TAG" --access public || echo "Failed to publish ${pkg_name} (may already exist)" | |
| cd - | |
| fi | |
| done | |
| - name: Publish bun package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| TAG="${{ steps.version.outputs.npm_tag }}" | |
| echo "Publishing @ff-labs/fff-bun@${VERSION} with tag ${TAG}..." | |
| make set-npm-version PKG=packages/fff-bun VERSION="$VERSION" | |
| cd packages/fff-bun | |
| npm publish --tag "$TAG" --access public || echo "Failed to publish @ff-labs/fff-bun (may already exist)" | |
| - name: Publish Node.js package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| TAG="${{ steps.version.outputs.npm_tag }}" | |
| echo "Publishing @ff-labs/fff-node@${VERSION} with tag ${TAG}..." | |
| make set-npm-version PKG=packages/fff-node VERSION="$VERSION" | |
| cd packages/fff-node | |
| npm install | |
| npm run build | |
| npm publish --tag "$TAG" --access public || echo "Failed to publish @ff-labs/fff-node (may already exist)" |