Skip to content
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/unittests-capi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on: push

jobs:
test-capi:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/unittests-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ on: push

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Get test data
Expand All @@ -26,8 +30,12 @@ jobs:
- name: Run clippy
run: |
poe clippy
- name: Install gsl
run: sudo apt-get install libgsl0-dev
- name: Install gsl (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libgsl0-dev
- name: Install gsl (macOS)
if: runner.os == 'macOS'
run: brew install gsl
- name: Run Rust unit tests
run: |
poe rtest
2 changes: 1 addition & 1 deletion crates/eko/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "eko-rs"
version = "0.0.0"
dynamic = ["version"]
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Rust",
Expand Down
2 changes: 1 addition & 1 deletion crates/ekore_capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exclude = ["tests"]
rustdoc-args = ["--html-in-header", "doc-header.html"]

[lib]
crate-type = ["cdylib", "staticlib"]
crate-type = ["cdylib"]

[features]
capi = []
Expand Down
7 changes: 7 additions & 0 deletions crates/ekore_capi/tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ run_section() {
echo " Compiling $name.$ext..."
"$compiler" "$src" "${extra[@]}" \
-L"$LIB_DIR" -lekore_capi -o "$bin" -Wl,-rpath,"$RPATH"

# macOS: cargo-c bakes an absolute /lib/... install name; fix it to @rpath
if [ "$(uname)" = "Darwin" ]; then
old="$(otool -L "$bin" | awk '/\/lib\/libekore_capi/{print $1; exit}')"
[ -n "$old" ] && install_name_tool -change "$old" "@rpath/$(basename "$old")" "$bin"
fi

echo " Running $name..."
"$bin"
rm -f "$bin"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ rtest = "cargo test --workspace"
fmtcheck = "cargo fmt --all -- --check"
clippy = "cargo clippy --no-deps"
rbib = { "shell" = "python crates/make_bib.py > crates/ekore/src/bib.rs" }
build-capi = "cargo cinstall --release -p ekore_capi --destdir=./crates/ekore_capi/dist --prefix=/ --libdir=/lib --includedir=/include"
build-capi = "cargo cinstall --release --library-type cdylib -p ekore_capi --destdir=./crates/ekore_capi/dist --prefix=/ --libdir=/lib --includedir=/include"
Comment thread
AkshatRai07 marked this conversation as resolved.
ctest = "./crates/ekore_capi/tests/run_tests.sh"

[tool.pytest.ini_options]
Expand Down
2 changes: 1 addition & 1 deletion tests/data/assets.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/usr/bin/env bash
# This script downloads the test assets to run both Rust and Python unit tests.
# The script is to be executed in the root directory of the repository.

Expand Down
Loading