Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/scripts/verify-feature-consistency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
CORE_YML="$REPO_ROOT/.github/workflows/core.yml"
SPNL_CARGO_TOML="$REPO_ROOT/spnl/Cargo.toml"
SPNL_CARGO_TOML="$REPO_ROOT/crates/spnl/Cargo.toml"

echo "Verifying feature consistency between core.yml and spnl/Cargo.toml..."

# Extract features from spnl/Cargo.toml
# Parse the [features] section, excluding only:
# Parse the [features] section, excluding:
# - default = [...]
# - local (CPU inference - mistralrs unconditionally depends on CUDA via candle-core/cudarc)
# - cuda* (CUDA-specific features)
# - ffi, pypi, run_py (pyo3/extension-module can't link into test binary; tested via python.yml)
CARGO_FEATURES=$(sed -n '/^\[features\]/,/^\[/p' "$SPNL_CARGO_TOML" | \
grep -E '^[a-z]' | \
sed 's/ *=.*//' | \
grep -v '^default$' | \
grep -v '^local$' | \
grep -v '^cuda' | \
grep -v '^ffi$' | \
grep -v '^pypi$' | \
grep -v '^run_py$' | \
sort)

# Extract features from core.yml cargo test command
Expand All @@ -34,7 +38,7 @@ CORE_YML_FEATURES=$(grep 'cargo test -p spnl --features' "$CORE_YML" | \
uniq)

echo ""
echo "Features in spnl/Cargo.toml (excluding default, local, cuda*):"
echo "Features in spnl/Cargo.toml (excluding default, local, cuda*, ffi, pypi, run_py):"
echo "$CARGO_FEATURES"
echo ""
echo "Features tested in core.yml (macOS cargo test -p spnl):"
Expand Down Expand Up @@ -67,6 +71,7 @@ echo "Excluded features (not tested in core.yml for spnl package):"
echo " - default (tested implicitly)"
echo " - local (CPU inference - mistralrs unconditionally depends on CUDA via candle-core/cudarc)"
echo " - cuda* (CUDA-specific features)"
echo " - ffi, pypi, run_py (pyo3/extension-module can't link into test binary; tested via python.yml)"
echo ""
echo "Note: 'local' feature IS tested in spnl-cli package tests, which uses it differently."

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/README-release-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ To add support for a new platform, add an entry to the `matrix.platform` array:
Modify the `cargo build` command in the workflow:

```yaml
cargo build --features your,features,here --release --package spnl-cli --target $TARGET
cargo build --manifest-path crates/spnl-cli/Cargo.toml --features your,features,here --release --target $TARGET
```

### Adjusting Compression
Expand Down Expand Up @@ -374,5 +374,5 @@ sha256sum -c checksums.txt
## Related Files

- Workflow: `.github/workflows/release-cli.yml`
- CLI Cargo.toml: `cli/Cargo.toml`
- CLI Cargo.toml: `crates/spnl-cli/Cargo.toml`
- Main Cargo.toml: `Cargo.toml`
4 changes: 2 additions & 2 deletions .github/workflows/RELEASE-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

3. Commit and push changes:
```bash
git add cli/Cargo.toml Cargo.lock
git add crates/spnl-cli/Cargo.toml Cargo.lock
git commit -m "Bump version to 0.14.0"
git push origin main
```
Expand Down Expand Up @@ -118,7 +118,7 @@ Users on Apple Silicon can run either version (Rosetta 2 compatibility).

Before publishing a release:

- [ ] Version bumped in `cli/Cargo.toml`
- [ ] Version bumped in `crates/spnl-cli/Cargo.toml`
- [ ] `Cargo.lock` updated
- [ ] Changes committed and pushed to main
- [ ] Release notes prepared
Expand Down
27 changes: 18 additions & 9 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,21 @@ jobs:
# IMPORTANT: Cannot use --all-features because mistralrs (used by local/metal/cuda features)
# unconditionally depends on candle-core, which depends on cudarc (CUDA).
#
# When adding new features to spnl/Cargo.toml, update this list!
# Current features tested (from spnl/Cargo.toml):
# - Included: cli_support, print, lisp, run, ollama, openai, gemini, pull, yaml, metal, rag, rag-deep-debug, spnl-api, vllm, k8s, gce, ffi, pypi, run_py, tok, openssl-vendored
# When adding new features to crates/spnl/Cargo.toml, update this list!
# Current features tested (from crates/spnl/Cargo.toml):
# - Included: cli_support, print, lisp, run, ollama, openai, gemini, pull, yaml, metal, rag, rag-deep-debug, spnl-api, vllm, k8s, gce, tok, openssl-vendored
# - Excluded: ffi, pypi, run_py (pyo3/extension-module can't link into test binary; tested via python.yml)
# - Excluded: local (CPU inference - pulls in CUDA deps via mistralrs)
# - Excluded: cuda, cuda-flash-attn, cuda-flash-attn-v3 (CUDA features)
cargo test -p spnl --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,ffi,pypi,run_py,tok,openssl-vendored -- --nocapture
cargo test -p spnl-cli --features bench,rag,spnl-api,vllm,k8s,gce,local,metal -- --nocapture
cargo test -p spnl-core --features lisp,yaml,tok -- --nocapture
cargo test -p spnl-run --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,tok,openssl-vendored -- --nocapture
cargo test -p spnl --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,tok,openssl-vendored -- --nocapture
cargo test --manifest-path crates/spnl-cli/Cargo.toml --features bench,rag,spnl-api,vllm,k8s,gce,local,metal -- --nocapture
else
# Test default features on Linux (no GPU features)
cargo test -p spnl -p spnl-cli -- --nocapture
# spnl-cli is excluded from workspace, test separately
cargo test -p spnl-core -p spnl-run -p spnl -- --nocapture
cargo test --manifest-path crates/spnl-cli/Cargo.toml -- --nocapture
fi

- name: cargo clippy
Expand All @@ -109,8 +114,12 @@ jobs:
# When adding new features, update the feature list above in cargo test!
if: runner.os == 'macOS'
run: |
cargo clippy -p spnl --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,ffi,pypi,run_py,tok,openssl-vendored --tests --no-deps -- -D warnings
cargo clippy -p spnl-cli --features bench,rag,spnl-api,vllm,k8s,gce,local,metal --tests --no-deps -- -D warnings
cargo clippy -p spnl-core --features lisp,yaml,tok --tests --no-deps -- -D warnings
cargo clippy -p spnl-run --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,tok,openssl-vendored --tests --no-deps -- -D warnings
cargo clippy -p spnl --features cli_support,print,lisp,run,ollama,openai,gemini,pull,yaml,metal,rag,rag-deep-debug,spnl-api,vllm,k8s,gce,tok,openssl-vendored --tests --no-deps -- -D warnings
cargo clippy --manifest-path crates/spnl-cli/Cargo.toml --features bench,rag,spnl-api,vllm,k8s,gce,local,metal --tests --no-deps -- -D warnings

- name: rustfmt
run: cargo fmt --all -- --check
run: |
cargo fmt --all -- --check
cargo fmt --manifest-path crates/spnl-cli/Cargo.toml -- --check
11 changes: 10 additions & 1 deletion .github/workflows/publish_crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ jobs:
- name: Publish
# Don't use --all-features to avoid CUDA compilation on macOS
# Users can enable CUDA features explicitly when needed
run: cargo publish --manifest-path spnl/Cargo.toml $DRY_RUN
run: |
cargo publish --manifest-path crates/spnl-core/Cargo.toml $DRY_RUN
# spnl-run and spnl depend on spnl-core being on crates.io, so
# dry-run (PR) can only validate spnl-core; real publish runs all three.
if [ "$DRY_RUN" = " " ]; then
sleep 30 # wait for crates.io to index spnl-core
cargo publish --manifest-path crates/spnl-run/Cargo.toml
sleep 30 # wait for crates.io to index spnl-run
cargo publish --manifest-path crates/spnl/Cargo.toml
fi
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
DRY_RUN: ${{ github.event_name == 'pull_request' && '--dry-run' || ' ' }}
12 changes: 6 additions & 6 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is autogenerated by maturin v1.9.4
# To update, run
#
# maturin generate-ci -m spnl/Cargo.toml github
# maturin generate-ci -m crates/spnl-ffi/Cargo.toml github
#
name: publish_pypi

Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
uses: ./maturin-action #PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path spnl/Cargo.toml --no-default-features -F tok,run_py
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path crates/spnl-ffi/Cargo.toml --no-default-features -F tok,run_py --strip
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: 2_28
- name: Upload wheels
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
# uses: ./maturin-action #PyO3/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path spnl/Cargo.toml
# args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path crates/spnl-ffi/Cargo.toml
# sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
# manylinux: auto #musllinux_1_2
# - name: Upload wheels
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
uses: ./maturin-action #PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path spnl/Cargo.toml --no-default-features -F tok,run_py
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path crates/spnl-ffi/Cargo.toml --no-default-features -F tok,run_py --strip
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
if: ${{ github.event_name != 'pull_request' }}
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
uses: ./maturin-action #PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path spnl/Cargo.toml --no-default-features -F tok,run_py
args: ${{ env.BUILD_RELEASE_ARG }} --out dist --find-interpreter --manifest-path crates/spnl-ffi/Cargo.toml --no-default-features -F tok,run_py --strip
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
if: ${{ github.event_name != 'pull_request' }}
Expand All @@ -181,7 +181,7 @@ jobs:
uses: ./maturin-action #PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path spnl/Cargo.toml
args: --out dist --manifest-path crates/spnl-ffi/Cargo.toml
- name: Upload sdist
uses: actions/upload-artifact@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: install maturin
run: pip install maturin
- name: maturin develop
run: maturin develop -m spnl/Cargo.toml --no-default-features -F pypi
run: maturin develop -m crates/spnl-ffi/Cargo.toml --no-default-features -F pypi,tok

- name: invoke the python tokenize api
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:
run: |
# Only use openssl-vendored for musl builds (static linking)
# Other platforms use system OpenSSL
cargo build --features $LOCAL_FEATURE,bench,rag,k8s,gce,spnl-api $BUILD_RELEASE_ARG --package spnl-cli --target $TARGET
cargo build --manifest-path crates/spnl-cli/Cargo.toml --target-dir target --features $LOCAL_FEATURE,bench,rag,k8s,gce,spnl-api $BUILD_RELEASE_ARG --target $TARGET

- name: Check for Apple signing secrets
if: runner.os == 'macOS'
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:
- name: Build CLI
shell: sh
run: |
cargo build --features $LOCAL_FEATURE,bench,rag,k8s,gce,spnl-api,openssl-vendored $BUILD_RELEASE_ARG --package spnl-cli --target $TARGET
cargo build --manifest-path crates/spnl-cli/Cargo.toml --target-dir target --features $LOCAL_FEATURE,bench,rag,k8s,gce,spnl-api,openssl-vendored $BUILD_RELEASE_ARG --target $TARGET

- name: Prepare binary
shell: sh
Expand Down Expand Up @@ -516,8 +516,8 @@ jobs:
echo "Building with features: $FEATURES,rag,k8s,gce,spnl-api"
echo "CUDA_COMPUTE_CAP: $CUDA_COMPUTE_CAP"
echo "CUDA_NVCC_FLAGS: $CUDA_NVCC_FLAGS"
cargo build --features $FEATURES,bench,rag,k8s,gce,spnl-api $BUILD_RELEASE_ARG \
--package spnl-cli --target $TARGET
cargo build --manifest-path crates/spnl-cli/Cargo.toml --target-dir target --features $FEATURES,bench,rag,k8s,gce,spnl-api $BUILD_RELEASE_ARG \
--target $TARGET

- name: Prepare binary
# Skip flash-attn variants on PRs (only run on release)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vllm-gce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Install spnl CLI
if: "!contains(github.event.pull_request.title, 'chore(deps)') && !contains(github.event.pull_request.title, 'fix(deps)') && env.GCP_CREDENTIALS && env.HF_TOKEN"
run: |
cargo build --features gce
cargo build --manifest-path crates/spnl-cli/Cargo.toml --target-dir target --features gce
sudo cp target/debug/spnl /usr/local/bin/

- name: Launch GCE VM
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*~
/target
target/
/target.cross
history.txt

Expand Down
Loading
Loading