Skip to content

Commit 00019be

Browse files
feat: Query parsing (HUGE THING READ CHANGELOG) (#224)
* query parsing * chore: Update docs for - query parsing * query parsing * Bun ffi * chore: Update docs for - Bun ffi * fix cross + zig relation * chore: Update docs for - fix cross + zig relation * skip windows build * publish the release * window * correct linking for windows dll cdylib * chore: Update docs for - correct linking for windows dll cdylib * feat: Add aarch64 windows target * improve ffi str allocation * fix aarch windows * fix nix * improve allocations * chore: Update docs for - improve allocations * fix style
1 parent d7bc727 commit 00019be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+6758
-646
lines changed

.cargo/config.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
[target.x86_64-apple-darwin]
2-
rustflags = [
3-
"-C", "link-arg=-undefined",
4-
"-C", "link-arg=dynamic_lookup",
5-
]
6-
7-
[target.aarch64-apple-darwin]
1+
[target.'cfg(target_os = "macos")']
82
rustflags = [
93
"-C", "link-arg=-undefined",
104
"-C", "link-arg=dynamic_lookup",

.github/workflows/lua-tests.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Lua E2E Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
MACOSX_DEPLOYMENT_TARGET: "13"
12+
13+
jobs:
14+
lua-tests:
15+
name: Lua E2E (${{ matrix.os }})
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-latest
22+
- os: macos-latest
23+
- os: windows-latest
24+
target: x86_64-pc-windows-msvc
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install Zig
29+
uses: mlugg/setup-zig@v2
30+
with:
31+
version: 0.15.2
32+
33+
- name: Install Rust
34+
uses: actions-rust-lang/setup-rust-toolchain@v1
35+
with:
36+
cache: true
37+
cache-on-failure: true
38+
cache-key: "v1-lua-e2e"
39+
rustflags: ""
40+
target: ${{ matrix.target || '' }}
41+
42+
- name: Build Rust binary (Windows)
43+
if: matrix.target
44+
run: cargo build --release --target ${{ matrix.target }} -p fff-nvim
45+
46+
- name: Copy binary to target/release (Windows)
47+
if: matrix.target
48+
shell: bash
49+
run: |
50+
cp target/${{ matrix.target }}/release/fff_nvim.dll target/release/fff_nvim.dll
51+
52+
- name: Build Rust binary
53+
if: ${{ !matrix.target }}
54+
run: cargo build --release -p fff-nvim
55+
56+
- name: Install Neovim
57+
uses: rhysd/action-setup-vim@v1
58+
with:
59+
neovim: true
60+
version: v0.10.4
61+
62+
- name: Clone plenary.nvim
63+
shell: bash
64+
run: git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ../plenary.nvim
65+
66+
- name: Run Lua tests
67+
shell: bash
68+
run: |
69+
nvim --headless -u tests/minimal_init.lua \
70+
-c "PlenaryBustedFile tests/fff_core_spec.lua" 2>&1

.github/workflows/release.yaml

Lines changed: 174 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,95 +6,191 @@ on:
66
pull_request:
77

88
jobs:
9-
build:
10-
name: Build ${{ matrix.target }}
9+
build-nvim:
10+
name: Build Neovim ${{ matrix.target }}
1111
runs-on: ${{ matrix.os }}
1212
permissions:
1313
contents: read
1414
strategy:
1515
matrix:
1616
include:
17-
## Linux builds
18-
# Glibc 2.21
17+
## Linux builds (using cargo-zigbuild)
18+
# Glibc 2.17 (RHEL 7, CentOS 7 compatible)
1919
- os: ubuntu-latest
2020
target: x86_64-unknown-linux-gnu
21+
zigbuild_target: x86_64-unknown-linux-gnu.2.17
2122
artifact_name: target/x86_64-unknown-linux-gnu/release/libfff_nvim.so
23+
ext: so
2224
- os: ubuntu-latest
2325
target: aarch64-unknown-linux-gnu
26+
zigbuild_target: aarch64-unknown-linux-gnu.2.17
2427
artifact_name: target/aarch64-unknown-linux-gnu/release/libfff_nvim.so
25-
# Musl 1.2.3
28+
ext: so
29+
# Musl (statically linked)
2630
- os: ubuntu-latest
2731
target: x86_64-unknown-linux-musl
2832
artifact_name: target/x86_64-unknown-linux-musl/release/libfff_nvim.so
33+
ext: so
2934
- os: ubuntu-latest
3035
target: aarch64-unknown-linux-musl
3136
artifact_name: target/aarch64-unknown-linux-musl/release/libfff_nvim.so
32-
# # Android (Termux)
33-
# - os: ubuntu-latest
34-
# target: aarch64-linux-android
35-
# artifact_name: target/aarch64-linux-android/release/libfff_nvim.so
37+
ext: so
3638

3739
## macOS builds
3840
- os: macos-latest
3941
target: x86_64-apple-darwin
4042
artifact_name: target/x86_64-apple-darwin/release/libfff_nvim.dylib
43+
ext: dylib
4144
- os: macos-latest
4245
target: aarch64-apple-darwin
4346
artifact_name: target/aarch64-apple-darwin/release/libfff_nvim.dylib
47+
ext: dylib
4448

45-
## Windows builds
4649
- os: windows-latest
4750
target: x86_64-pc-windows-msvc
4851
artifact_name: target/x86_64-pc-windows-msvc/release/fff_nvim.dll
52+
ext: dll
4953
- os: windows-latest
5054
target: aarch64-pc-windows-msvc
5155
artifact_name: target/aarch64-pc-windows-msvc/release/fff_nvim.dll
56+
ext: dll
5257

5358
steps:
5459
- uses: actions/checkout@v4
5560
with:
5661
persist-credentials: false
5762

58-
# - name: Set Rust toolchain
59-
# if: contains(matrix.target, 'linux')
60-
# # https://github.com/rust-cross/cargo-zigbuild/issues/327
61-
# run: echo -e '[toolchain]\nchannel = "nightly-2025-02-19"' > rust-toolchain.toml
62-
6363
- name: Install Rust
64+
run: rustup target add ${{ matrix.target }}
65+
66+
- name: Install Zig
67+
uses: mlugg/setup-zig@v2
68+
with:
69+
version: 0.15.2
70+
71+
- name: Install cargo-zigbuild
72+
if: contains(matrix.os, 'ubuntu')
73+
run: cargo install cargo-zigbuild
74+
75+
- name: Build for Linux
76+
if: contains(matrix.os, 'ubuntu')
77+
run: |
78+
cargo zigbuild --release --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-nvim
79+
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"
80+
81+
- name: Build for macOS
82+
if: contains(matrix.os, 'macos')
83+
run: |
84+
MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }} -p fff-nvim
85+
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"
86+
87+
- name: Build for Windows
88+
if: contains(matrix.os, 'windows')
89+
shell: bash
6490
run: |
65-
rustup target add ${{ matrix.target }}
91+
cargo build --release --target ${{ matrix.target }} -p fff-nvim
92+
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.${{ matrix.ext }}"
93+
94+
- name: Upload artifacts
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: nvim-${{ matrix.target }}
98+
path: ${{ matrix.target }}.*
99+
100+
build-c:
101+
name: Build C FFI ${{ matrix.target }}
102+
runs-on: ${{ matrix.os }}
103+
permissions:
104+
contents: read
105+
strategy:
106+
matrix:
107+
include:
108+
## Linux builds
109+
- os: ubuntu-latest
110+
target: x86_64-unknown-linux-gnu
111+
zigbuild_target: x86_64-unknown-linux-gnu.2.17
112+
artifact_name: target/x86_64-unknown-linux-gnu/release/libfff_c.so
113+
ext: so
114+
- os: ubuntu-latest
115+
target: aarch64-unknown-linux-gnu
116+
zigbuild_target: aarch64-unknown-linux-gnu.2.17
117+
artifact_name: target/aarch64-unknown-linux-gnu/release/libfff_c.so
118+
ext: so
119+
- os: ubuntu-latest
120+
target: x86_64-unknown-linux-musl
121+
artifact_name: target/x86_64-unknown-linux-musl/release/libfff_c.so
122+
ext: so
123+
- os: ubuntu-latest
124+
target: aarch64-unknown-linux-musl
125+
artifact_name: target/aarch64-unknown-linux-musl/release/libfff_c.so
126+
ext: so
127+
128+
## macOS builds
129+
- os: macos-latest
130+
target: x86_64-apple-darwin
131+
artifact_name: target/x86_64-apple-darwin/release/libfff_c.dylib
132+
ext: dylib
133+
- os: macos-latest
134+
target: aarch64-apple-darwin
135+
artifact_name: target/aarch64-apple-darwin/release/libfff_c.dylib
136+
ext: dylib
137+
138+
## Windows builds
139+
- os: windows-latest
140+
target: x86_64-pc-windows-msvc
141+
artifact_name: target/x86_64-pc-windows-msvc/release/fff_c.dll
142+
ext: dll
143+
- os: windows-latest
144+
target: aarch64-pc-windows-msvc
145+
artifact_name: target/aarch64-pc-windows-msvc/release/fff_c.dll
146+
ext: dll
147+
148+
steps:
149+
- uses: actions/checkout@v4
150+
with:
151+
persist-credentials: false
152+
153+
- name: Install Rust
154+
run: rustup target add ${{ matrix.target }}
155+
156+
- name: Install Zig
157+
uses: mlugg/setup-zig@v2
158+
with:
159+
version: 0.15.2
160+
161+
- name: Install cargo-zigbuild
162+
if: contains(matrix.os, 'ubuntu')
163+
run: cargo install cargo-zigbuild
66164

67165
- name: Build for Linux
68166
if: contains(matrix.os, 'ubuntu')
69167
run: |
70-
cargo install cross --git https://github.com/cross-rs/cross
71-
cross build --release --target ${{ matrix.target }}
72-
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.so"
168+
cargo zigbuild --release --target ${{ matrix.zigbuild_target || matrix.target }} -p fff-c
169+
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"
73170
74171
- name: Build for macOS
75172
if: contains(matrix.os, 'macos')
76173
run: |
77-
# Ventura (https://en.wikipedia.org/wiki/MacOS_version_history#Releases)
78-
MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }}
79-
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.dylib"
174+
MACOSX_DEPLOYMENT_TARGET="13" cargo build --release --target ${{ matrix.target }} -p fff-c
175+
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"
80176
81177
- name: Build for Windows
82178
if: contains(matrix.os, 'windows')
179+
shell: bash
83180
run: |
84-
cargo build --release --target ${{ matrix.target }}
85-
mv "${{ matrix.artifact_name }}" "${{ matrix.target }}.dll"
181+
cargo build --release --target ${{ matrix.target }} -p fff-c
182+
mv "${{ matrix.artifact_name }}" "c-lib-${{ matrix.target }}.${{ matrix.ext }}"
86183
87184
- name: Upload artifacts
88185
uses: actions/upload-artifact@v4
89186
with:
90-
name: ${{ matrix.target }}
91-
path: ${{ matrix.target }}*
187+
name: c-lib-${{ matrix.target }}
188+
path: c-lib-${{ matrix.target }}.*
92189

93190
release:
94191
name: Release
95-
needs: build
192+
needs: [build-nvim, build-c]
96193
runs-on: ubuntu-latest
97-
if: github.event_name == 'push'
98194
permissions:
99195
contents: write
100196
steps:
@@ -105,12 +201,44 @@ jobs:
105201
with:
106202
path: ./binaries
107203

204+
- name: Flatten and rename Neovim artifacts
205+
working-directory: ./binaries
206+
run: |
207+
# Move nvim artifacts to root level with original naming
208+
for dir in nvim-*/; do
209+
target="${dir#nvim-}"
210+
target="${target%/}"
211+
for file in "$dir"*; do
212+
if [ -f "$file" ]; then
213+
filename=$(basename "$file")
214+
mv "$file" "./$filename"
215+
fi
216+
done
217+
rmdir "$dir" 2>/dev/null || true
218+
done
219+
220+
- name: Flatten C library artifacts
221+
working-directory: ./binaries
222+
run: |
223+
# Move c-lib artifacts to root level
224+
for dir in c-lib-*/; do
225+
for file in "$dir"*; do
226+
if [ -f "$file" ]; then
227+
filename=$(basename "$file")
228+
mv "$file" "./$filename"
229+
fi
230+
done
231+
rmdir "$dir" 2>/dev/null || true
232+
done
233+
108234
- name: Generate checksums
109235
working-directory: ./binaries
110236
run: |
111-
ls -a
112-
for file in ./**/*; do
113-
sha256sum "$file" > "${file}.sha256"
237+
ls -la
238+
for file in *; do
239+
if [ -f "$file" ] && [[ ! "$file" == *.sha256 ]]; then
240+
sha256sum "$file" > "${file}.sha256"
241+
fi
114242
done
115243
116244
- name: Prepare tag
@@ -126,16 +254,22 @@ jobs:
126254
name: "${{ steps.vars.outputs.tag }}"
127255
tag_name: "${{ steps.vars.outputs.tag }}"
128256
token: ${{ github.token }}
129-
files: ./binaries/**/*
257+
files: ./binaries/*
130258
draft: false
131259
prerelease: true
132260
generate_release_notes: false
133261
body: |
134262
Nightly release from commit: ${{ github.sha }}
135263
264+
## Neovim Plugin
265+
- `{target}.so` / `.dylib` / `.dll` - Lua module for Neovim
266+
267+
## C FFI Library (for Bun/Node/Python)
268+
- `c-lib-{target}.so` / `.dylib` / `.dll` - C FFI library
269+
136270
comment-on-pr:
137271
name: Comment on PR
138-
needs: build
272+
needs: [build-nvim, build-c]
139273
runs-on: ubuntu-latest
140274
if: github.event_name == 'pull_request'
141275
permissions:
@@ -161,15 +295,19 @@ jobs:
161295
edit-mode: replace
162296
body: |
163297
<!-- fff-nvim-build-comment -->
164-
## 🔨 Build Artifacts for your PR
165-
166-
You can test the prebuilt binaries if you use lazy.nvim right now.
298+
## Build Artifacts for your PR
167299
300+
### Neovim Plugin
301+
Test with lazy.nvim:
168302
```lua
169303
{
170304
"dmtrKovalenko/fff.nvim",
171305
tag = "${{ steps.vars.outputs.short_sha }}",
172306
}
173307
```
308+
309+
### Bun/TypeScript Package
310+
The `fff` npm package will download binaries from this release automatically.
311+
174312
---
175313
*Built from ${{ github.sha }}*

0 commit comments

Comments
 (0)