Skip to content

Commit

Permalink
Merge pull request #391 from unum-cloud/main-dev
Browse files Browse the repository at this point in the history
Packaging Crates
  • Loading branch information
ashvardanian committed Apr 10, 2024
2 parents 36a8624 + facb5dc commit 96a79d7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ jobs:
with:
ref: "main"
- run: git submodule update --init --recursive
- name: Hide submodule Crates
run: |
mv simsimd/Cargo.toml simsimd/Cargo.toml.bak
mv stringzilla/Cargo.toml stringzilla/Cargo.toml.bak
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand Down
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,31 @@ The compilation settings are controlled by the `build.rs` and are independent fr

```sh
cargo test -p usearch -- --nocapture --test-threads=1
```

Publishing the crate is a bit more complicated than normally.
If you simply pull the repository with submodules and run the following command it will list fewer files than expected:

```sh
cargo package --list --allow-dirty
```

The reason for that is the heuristic that Cargo uses to determine the files to include in the package.

> Regardless of whether exclude or include is specified, the following files are always excluded:
> Any sub-packages will be skipped (any subdirectory that contains a Cargo.toml file).
Assuming both SimSIMD and StringZilla contain their own `Cargo.toml` files, we need to temporarily exclude them from the package.

```sh
mv simsimd/Cargo.toml simsimd/Cargo.toml.bak
mv stringzilla/Cargo.toml stringzilla/Cargo.toml.bak
cargo package --list --allow-dirty
cargo publish

# Revert back
mv simsimd/Cargo.toml.bak simsimd/Cargo.toml
mv stringzilla/Cargo.toml.bak stringzilla/Cargo.toml
```

## Objective-C and Swift
Expand Down Expand Up @@ -406,6 +430,21 @@ docker buildx create --use &&
--push .
```

## WebAssembly

```sh
export WASI_VERSION=21
export WASI_VERSION_FULL=${WASI_VERSION}.0
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
```

After the installation, we can pass WASI SDK to CMake as a new toolchain:

```sh
cmake -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake .
```

## Working on Sub-Modules

Extending metrics in SimSIMD:
Expand Down
15 changes: 7 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ edition = "2021"
license = "Apache-2.0"
publish = true
repository = "https://github.com/unum-cloud/usearch"

# If no precompiled binaries are available, the build script will compile the
# following files using the `build.rs` specification.
documentation = "https://unum-cloud.github.io/usearch"
include = [
"rust/*",
"include/*",
"fp16/include/*",
"simsimd/include/*",
"Cargo.toml",
"/rust/**",
"/include/**",
"/fp16/include/**",
"/simsimd/include/**",
"/stringzilla/include/**",
"/build.rs",
]

[features]
Expand Down

0 comments on commit 96a79d7

Please sign in to comment.