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
102 changes: 102 additions & 0 deletions .github/workflows/build_and_test_full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Full build-and-test with gRPC exporter, only run when pushed to main
name: "Build and Run Tests Full"
on:
workflow_dispatch:
push:
branches:
- main
env:
MLM_LICENSE_TOKEN: ${{ secrets.MLM_LICENSE_TOKEN }}
jobs:
build-and-run-tests-ubuntu:
# Running on ubuntu-latest would use a glibc version that is incompatible when using the built mex files on a Debian 11
# Instead, run on ubuntu-20.04
runs-on: ubuntu-20.04
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
SYSTEM_LIBSTDCPP_PATH: "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install ninja-build
run: sudo apt-get install ninja-build
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler MATLAB_Compiler_SDK
- name: Build OpenTelemetry-Matlab
working-directory: opentelemetry-matlab
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DWITH_OTLP_GRPC=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
# Add the installation directory to the MATLAB Search Path by
# setting the MATLABPATH environment variable.
MATLABPATH: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
uses: matlab-actions/run-tests@v2
with:
select-by-folder: opentelemetry-matlab/test
build-and-run-tests-windows:
runs-on: windows-latest
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install ninja-build
run: choco install ninja
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler MATLAB_Compiler_SDK
- name: Build OpenTelemetry-Matlab
working-directory: opentelemetry-matlab
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DWITH_OTLP_GRPC=ON -DUSE_BATCH_FOR_MCC=ON -DFETCH_VCPKG=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
# Add the installation directory to the MATLAB Search Path by
# setting the MATLABPATH environment variable.
MATLABPATH: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
uses: matlab-actions/run-tests@v2
with:
select-by-folder: opentelemetry-matlab/test
build-and-run-tests-macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, macos-14] # runs on Mac with both Intel (macos-13) and Apple Silicon (macos-14) processors
env:
OPENTELEMETRY_MATLAB_INSTALL: "${{ github.workspace }}/otel_matlab_install"
steps:
- name: Download OpenTelemetry-Matlab source
uses: actions/checkout@v3
with:
path: opentelemetry-matlab
- name: Install ninja-build
run: brew install ninja
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2
with:
products: MATLAB_Compiler MATLAB_Compiler_SDK
- name: Build OpenTelemetry-Matlab
working-directory: opentelemetry-matlab
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DWITH_OTLP_GRPC=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
# Add the installation directory to the MATLAB Search Path by
# setting the MATLABPATH environment variable.
MATLABPATH: ${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
uses: matlab-actions/run-tests@v2
with:
select-by-folder: opentelemetry-matlab/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: "Build and Run Tests"
# Simplified build-and-test without gRPC exporter, run when pushed to any branches other than main or release branches
name: "Build and Run Tests Simple"
on:
workflow_dispatch:
push:
branches:
- '**'
- '!main'
- '!v*.*'
env:
MLM_LICENSE_TOKEN: ${{ secrets.MLM_LICENSE_TOKEN }}
jobs:
Expand Down Expand Up @@ -56,7 +61,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DFETCH_VCPKG=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_mltbx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_OTLP_GRPC=ON -DFETCH_VCPKG=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Compress into single artifact
working-directory: ${{ github.workspace }}
Expand Down
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ cmake_policy(SET CMP0074 NEW)
include(FetchContent)

# check if VCPKG_ROOT is defined, which should point to an existing installation
if(DEFINED ENV{VCPKG_ROOT})
# FETCH_VCPKG is a switch that can be defined to ignore VCPKG_ROOT
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED FETCH_VCPKG)
# Autodetect vcpkg toolchain
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
string(REPLACE "\\" "/" CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif()
else()
# VCPKG_ROOT not defined, get it using FetchContent

if(DEFINED VCPKG_PREFIX})
if(DEFINED VCPKG_PREFIX)
# download location specified
string(REPLACE "\\" "/" VCPKG_PREFIX "${VCPKG_PREFIX}")
else()
Expand Down Expand Up @@ -225,8 +226,8 @@ set(OPENTELEMETRY_PROXY_LIBRARY_NAME "OtelMatlabProxy")
find_package(Matlab REQUIRED)
find_package(Protobuf REQUIRED)
find_package(nlohmann_json REQUIRED)
if(WIN32)
find_package(zlib REQUIRED)
if(WIN32 OR APPLE)
find_package(ZLIB REQUIRED)
endif()

if(WITH_OTLP_HTTP)
Expand Down Expand Up @@ -406,12 +407,16 @@ if(WIN32)
$<TARGET_FILE_DIR:OpenSSL::SSL>/../bin/${OPENSSL_CRYPTO_DLL}
$<TARGET_FILE:re2::re2>)
endif()
elseif(UNIX AND NOT CYGWIN)
else()
set(OTEL_CPP_RUNTIME ${OTEL_CPP_PREFIX}/lib/libopentelemetry_proto${CMAKE_SHARED_LIBRARY_SUFFIX})
if(WITH_OTLP_GRPC)
set(OTEL_CPP_RUNTIME ${OTEL_CPP_PREFIX}/lib/libopentelemetry_proto${CMAKE_SHARED_LIBRARY_SUFFIX}
set(OTEL_CPP_RUNTIME ${OTEL_CPP_RUNTIME}
${OTEL_CPP_PREFIX}/lib/libopentelemetry_proto_grpc${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
set(OTEL_CPP_RUNTIME ${OTEL_CPP_PREFIX}/lib/libopentelemetry_proto${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
if(APPLE)
set(OTEL_CPP_RUNTIME ${OTEL_CPP_RUNTIME} $<TARGET_FILE:ZLIB::ZLIB>
$<TARGET_FILE_DIR:ZLIB::ZLIB>/libz.${ZLIB_MAJOR_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}
$<TARGET_FILE_DIR:ZLIB::ZLIB>/libz.${ZLIB_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
set(OPENTELEMETRY_PROXY_RUNTIME_LIBRARIES ${OTEL_CPP_RUNTIME})
endif()
Expand Down