Skip to content

Custom precompile step to include libonnxruntime.so on linux #6

Custom precompile step to include libonnxruntime.so on linux

Custom precompile step to include libonnxruntime.so on linux #6

Workflow file for this run

name: Test
on:
push:
branches: [main]
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
name: Linux ${{ matrix.elixir }}, ${{ matrix.otp }}
strategy:
matrix:
elixir: ["1.17.3"]
otp: ["27.1.2"]
env:
MIX_ENV: test
# Force source build. CI validates the source path end-to-end;
# precompiled artifacts are exercised separately in release.yml.
ORTEX_BUILD: "true"
steps:
- uses: actions/checkout@v6
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Install dependencies
run: mix deps.get
- name: Compile and check warnings
run: mix compile --warnings-as-errors
- name: Locate libonnxruntime artifacts (diagnostic)
# The ort Rust crate downloads libonnxruntime during cargo build.
# On Linux the NIF dynamically links against it and Ortex.Util
# copies it into priv/native/ so the rpath ($ORIGIN) can find it.
# When that copy fails, the NIF fails to dlopen at test time. This
# diagnostic step prints every libonnxruntime location in the
# workspace so we can verify both sides.
run: |
echo "=== libonnxruntime files in workspace ==="
find "$GITHUB_WORKSPACE" -name 'libonnxruntime*' -printf '%p (%s bytes)\n' 2>/dev/null || \
find "$GITHUB_WORKSPACE" -name 'libonnxruntime*' -exec ls -la {} \;
echo
echo "=== priv/native contents ==="
ls -la _build/test/lib/ortex/priv/native/ || true
echo
echo "=== ldd on the loaded NIF ==="
ldd _build/test/lib/ortex/priv/native/ortex.so || true
- name: Check formatting
run: mix format --check-formatted
- name: Run tests
run: mix test
macos:
runs-on: macos-latest
name: macOS
env:
MIX_ENV: test
# Force source build. CI validates the source path end-to-end;
# precompiled artifacts are exercised separately in release.yml.
ORTEX_BUILD: "true"
steps:
- uses: actions/checkout@v6
- name: Install
run: |
brew update
brew install erlang@27 elixir
- name: Install dependencies
run: mix deps.get
- name: Compile and check warnings
run: mix compile --warnings-as-errors
- name: Check formatting
run: mix format --check-formatted
- name: Run tests
run: mix test