Skip to content

Commit

Permalink
Merge branch 'main' into add_repository_settings
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Apr 13, 2024
2 parents 84ae166 + b216e0d commit 1082fb6
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 4 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/boost_log.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: boost_log

on:
push:
branches:
- '*'
path:
- 'instrumentation/boost_log/**'
- '.github/workflows/boost_log.yml'
pull_request:
branches: [main]
paths:
- 'instrumentation/boost_log/**'
- '.github/workflows/boost_log.yml'

jobs:
cmake_linux:
name: CMake Linux
runs-on: ubuntu-latest
steps:
- name: checkout googletest
uses: actions/checkout@v3
with:
repository: "google/googletest"
ref: "release-1.12.1"
path: "googletest"
submodules: "recursive"
- name: checkout opentelemetry-cpp-contrib
uses: actions/checkout@v3
with:
path: opentelemetry-cpp-contrib
# submodules: "recursive"
- name: checkout opentelemetry-cpp
uses: actions/checkout@v3
with:
repository: "open-telemetry/opentelemetry-cpp"
ref: "v1.14.2"
path: "opentelemetry-cpp"
submodules: "recursive"
- name: setup dependencies
run: |
sudo apt update -y
sudo apt install -y --no-install-recommends --no-install-suggests \
build-essential \
cmake \
ninja-build \
libssl-dev \
libcurl4-openssl-dev \
libprotobuf-dev \
protobuf-compiler \
libgmock-dev \
libgtest-dev \
libbenchmark-dev \
libboost-log-dev
# This is needed because libgmock-dev libgtest-dev installs 1.11,
# and 1.11 breaks the build.
- name: build googletest 1.12
run: |
mkdir -p "${GITHUB_WORKSPACE}/googletest/build"
cd "${GITHUB_WORKSPACE}/googletest/build"
cmake .. -G Ninja
cmake --build . -j$(nproc)
cmake --install . --prefix="${GITHUB_WORKSPACE}/sandbox"
- name: build opentelemetry-cpp
run: |
mkdir -p "${GITHUB_WORKSPACE}/opentelemetry-cpp/build"
cd "${GITHUB_WORKSPACE}/opentelemetry-cpp/build"
cmake .. -G Ninja -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF -DOPENTELEMETRY_INSTALL=ON
cmake --build . -j$(nproc)
cmake --install . --prefix="${GITHUB_WORKSPACE}/sandbox"
- name: build boost_log contrib
run: |
mkdir -p "${GITHUB_WORKSPACE}/boost_log/build"
cd "${GITHUB_WORKSPACE}/boost_log/build"
cmake ../../opentelemetry-cpp-contrib/instrumentation/boost_log \
-G Ninja \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/sandbox" \
-DBUILD_TESTING=ON \
-DWITH_EXAMPLES=ON \
-DOPENTELEMETRY_INSTALL=ON
cmake --build . -j$(nproc)
ctest -j1 --output-on-failure
cmake --install . --prefix="${GITHUB_WORKSPACE}/sandbox"
10 changes: 6 additions & 4 deletions instrumentation/boost_log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(this_target opentelemetry_boost_log_sink)
project(${this_target})

find_package(opentelemetry-cpp REQUIRED)
find_package(Boost COMPONENTS log REQUIRED)
find_package(Boost 1.73 COMPONENTS log REQUIRED)

add_library(${this_target} src/sink.cc)

Expand Down Expand Up @@ -69,6 +69,8 @@ if(OPENTELEMETRY_INSTALL)
endif() # OPENTELEMETRY_INSTALL

if(BUILD_TESTING)
find_package(GTest 1.12 REQUIRED)

set(testname sink_test)

include(GoogleTest)
Expand All @@ -81,9 +83,9 @@ if(BUILD_TESTING)
)

target_link_libraries(${testname} PRIVATE
gmock
gtest
gtest_main
GTest::gmock
GTest::gtest
GTest::gtest_main
Boost::log
opentelemetry-cpp::ostream_log_record_exporter
${this_target}
Expand Down

0 comments on commit 1082fb6

Please sign in to comment.