Skip to content

Commit da6aceb

Browse files
committed
Adds a cmake project to build and install all third party dependencies. Adds a install_thirdparty.sh bash script. Use the script in ci and remove the separate install scripts for abseil, googletest, protobuf, and grpc. Adds third party tag files and removes references to specific third party versions from ci workflows.
1 parent 0e8b2d1 commit da6aceb

21 files changed

+681
-567
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 107 deletions
Large diffs are not rendered by default.

.github/workflows/cmake_install.yml

Lines changed: 82 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
CMAKE_VERSION: '3.31.6'
2020
# cxx17 is the default for windows-2022
2121
CXX_STANDARD: '17'
22+
CMAKE_EXTRA_ARGS: "-DWITH_STL=CXX17 -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
2223
steps:
2324
- name: Harden the runner (Audit all outbound calls)
2425
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
@@ -44,6 +45,7 @@ jobs:
4445
# Set to the latest version of cmake 3.x
4546
CMAKE_VERSION: '3.31.6'
4647
CXX_STANDARD: '20'
48+
CMAKE_EXTRA_ARGS: "-DWITH_GSL=ON -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
4749
steps:
4850
- name: Harden the runner (Audit all outbound calls)
4951
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
@@ -75,19 +77,50 @@ jobs:
7577
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
7678
with:
7779
egress-policy: audit
78-
7980
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8081
with:
8182
submodules: 'recursive'
82-
- name: Install libcurl, zlib, nlohmann-json with apt
83+
- name: Setup CI Environment
8384
run: |
8485
sudo -E ./ci/setup_ci_environment.sh
8586
sudo -E ./ci/setup_cmake.sh
86-
sudo -E ./ci/setup_googletest.sh
87-
- name: Install abseil, protobuf, and grpc with apt
87+
- name: Install Dependencies
8888
run: |
8989
sudo -E apt-get update
90-
sudo -E apt-get install -y libabsl-dev libprotobuf-dev libgrpc++-dev protobuf-compiler protobuf-compiler-grpc
90+
sudo -E apt-get install -y libabsl-dev libcurl4-openssl-dev zlib1g-dev nlohmann-json3-dev libprotobuf-dev libgrpc++-dev protobuf-compiler protobuf-compiler-grpc
91+
- name: Run Tests (static libs)
92+
env:
93+
BUILD_SHARED_LIBS: 'OFF'
94+
run: ./ci/do_ci.sh cmake.install.test
95+
- name: Run Tests (shared libs)
96+
env:
97+
BUILD_SHARED_LIBS: 'ON'
98+
run: ./ci/do_ci.sh cmake.install.test
99+
100+
ubuntu_2404_all_fetch:
101+
name: Ubuntu 24.04 fetch all dependencies (static libs - shared libs - opentracing shim)
102+
runs-on: ubuntu-24.04
103+
env:
104+
INSTALL_TEST_DIR: '/home/runner/install_test'
105+
# CMake 3.28 is apt package version for Ubuntu 24.04
106+
CMAKE_VERSION: '3.28.3'
107+
# The default cxx standard for Ubuntu 24.04
108+
CXX_STANDARD: '17'
109+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FETCH_CONTENT_ONLY=ON"
110+
BUILD_TYPE: 'Debug'
111+
steps:
112+
- name: Harden the runner (Audit all outbound calls)
113+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
114+
with:
115+
egress-policy: audit
116+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
117+
with:
118+
# Don't checkout the submodules.
119+
submodules: false
120+
- name: Setup CI Environment
121+
run: |
122+
sudo -E ./ci/setup_ci_environment.sh
123+
sudo -E ./ci/setup_cmake.sh
91124
- name: Run Tests (static libs)
92125
env:
93126
BUILD_SHARED_LIBS: 'OFF'
@@ -96,43 +129,36 @@ jobs:
96129
env:
97130
BUILD_SHARED_LIBS: 'ON'
98131
run: ./ci/do_ci.sh cmake.install.test
132+
- name: Run OpenTracing Shim Test
133+
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
99134

100135
ubuntu_2404_latest:
101136
name: Ubuntu 24.04 latest versions cxx20 (static libs)
102137
runs-on: ubuntu-24.04
103138
env:
104139
INSTALL_TEST_DIR: '/home/runner/install_test'
140+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
105141
# Set to the latest version of cmake 3.x
106142
CMAKE_VERSION: '3.31.6'
107143
# Set to the latest cxx standard supported by opentelemetry-cpp
108144
CXX_STANDARD: '20'
109-
# Versions below set to the latest version available
110-
# The abseil and protobuf versions are taken from
111-
# the grpc submodules at the GRPC_VERSION tag
112-
GOOGLETEST_VERSION: '1.16.0'
113-
ABSEIL_CPP_VERSION: '20240722.1'
114-
PROTOBUF_VERSION: '29.0'
115-
GRPC_VERSION: 'v1.71.0'
145+
CMAKE_EXTRA_ARGS: '-DWITH_STL=CXX20 -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON'
116146
BUILD_TYPE: 'Debug'
117147
steps:
118148
- name: Harden the runner (Audit all outbound calls)
119149
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
120150
with:
121151
egress-policy: audit
122-
123152
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
124153
with:
125-
submodules: 'recursive'
126-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
154+
submodules: false
155+
- name: Setup CI Environment
127156
run: |
128157
sudo -E ./ci/setup_ci_environment.sh
129158
sudo -E ./ci/setup_cmake.sh
130-
sudo -E ./ci/setup_googletest.sh
131-
- name: Build abseil, protobuf, and grpc with ci scripts
159+
- name: Install Dependencies
132160
run: |
133-
sudo -E ./ci/install_abseil.sh
134-
sudo -E ./ci/install_protobuf.sh
135-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
161+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_latest
136162
- name: Run Tests (static libs)
137163
env:
138164
BUILD_SHARED_LIBS: 'OFF'
@@ -143,35 +169,27 @@ jobs:
143169
runs-on: ubuntu-22.04
144170
env:
145171
INSTALL_TEST_DIR: '/home/runner/install_test'
172+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
146173
# CMake 3.22 is the apt package version for Ubuntu 22.04
147174
CMAKE_VERSION: '3.22.0'
148175
CXX_STANDARD: '17'
149-
# These are stable versions tested in the main ci workflow
150-
# and defaults in the devcontainer
151-
GOOGLETEST_VERSION: '1.14.0'
152-
ABSEIL_CPP_VERSION: '20230125.3'
153-
PROTOBUF_VERSION: '23.3'
154-
GRPC_VERSION: 'v1.55.0'
176+
CMAKE_EXTRA_ARGS: "-DWITH_STL=CXX17 -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
155177
BUILD_TYPE: 'Debug'
156178
steps:
157179
- name: Harden the runner (Audit all outbound calls)
158180
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
159181
with:
160182
egress-policy: audit
161-
162183
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
163184
with:
164-
submodules: 'recursive'
165-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
185+
submodules: false
186+
- name: Setup CI Environment
166187
run: |
167188
sudo -E ./ci/setup_ci_environment.sh
168189
sudo -E ./ci/setup_cmake.sh
169-
sudo -E ./ci/setup_googletest.sh
170-
- name: Build abseil, protobuf, and grpc with ci scripts
190+
- name: Install Dependencies
171191
run: |
172-
sudo -E ./ci/install_abseil.sh
173-
sudo -E ./ci/install_protobuf.sh
174-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
192+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_stable
175193
- name: Run Tests (static libs)
176194
env:
177195
BUILD_SHARED_LIBS: 'OFF'
@@ -186,36 +204,28 @@ jobs:
186204
runs-on: ubuntu-22.04
187205
env:
188206
INSTALL_TEST_DIR: '/home/runner/install_test'
207+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
189208
# Set to the current minimum version of cmake
190209
CMAKE_VERSION: '3.14.0'
191210
# cxx14 is the default for Ubuntu 22.04
192211
CXX_STANDARD: '14'
193-
# This is the apt package version of googletest for Ubuntu 22.04
194-
GOOGLETEST_VERSION: '1.11.0'
195-
# These are minimum versions tested in the main ci workflow
196-
ABSEIL_CPP_VERSION: '20220623.2'
197-
PROTOBUF_VERSION: '21.12'
198-
GRPC_VERSION: 'v1.49.2'
199-
BUILD_TYPE: 'Debug'
212+
CMAKE_EXTRA_ARGS: "-DWITH_GSL=ON -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
213+
BUILD_TYPE: 'Release'
200214
steps:
201215
- name: Harden the runner (Audit all outbound calls)
202216
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
203217
with:
204218
egress-policy: audit
205-
206219
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
207220
with:
208-
submodules: 'recursive'
209-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
221+
submodules: false
222+
- name: Setup CI Environment
210223
run: |
211224
sudo -E ./ci/setup_ci_environment.sh
212225
sudo -E ./ci/setup_cmake.sh
213-
sudo -E ./ci/setup_googletest.sh
214-
- name: Build abseil, protobuf, and grpc with ci scripts
226+
- name: Install Dependencies
215227
run: |
216-
sudo -E ./ci/install_abseil.sh
217-
sudo -E ./ci/install_protobuf.sh
218-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
228+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_minimum
219229
- name: Run Tests (static libs)
220230
env:
221231
BUILD_SHARED_LIBS: 'OFF'
@@ -233,6 +243,7 @@ jobs:
233243
# CMake 3.28 is apt package version for Ubuntu 24.04
234244
CMAKE_VERSION: '3.28.3'
235245
CXX_STANDARD: '17'
246+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
236247
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
237248
BUILD_TYPE: 'Debug'
238249
steps:
@@ -243,7 +254,10 @@ jobs:
243254

244255
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
245256
with:
246-
submodules: 'recursive'
257+
submodules: false
258+
- name: Get required submodules
259+
run: |
260+
git submodule update --init --depth 1 third_party/opentelemetry-proto
247261
- name: Install Conan
248262
run: |
249263
python3 -m pip install pip==25.0.1
@@ -270,13 +284,14 @@ jobs:
270284
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
271285

272286
ubuntu_2404_conan_latest:
273-
name: Ubuntu 24.04 conan latest versions cxx17 (static libs)
287+
name: Ubuntu 24.04 conan latest versions cxx17 (static libs - opentracing shim)
274288
runs-on: ubuntu-24.04
275289
env:
276290
INSTALL_TEST_DIR: '/home/runner/install_test'
277291
# Set to the latest version of cmake 3.x
278292
CMAKE_VERSION: '3.31.6'
279293
CXX_STANDARD: '17'
294+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
280295
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
281296
BUILD_TYPE: 'Debug'
282297
steps:
@@ -287,7 +302,10 @@ jobs:
287302

288303
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
289304
with:
290-
submodules: 'recursive'
305+
submodules: false
306+
- name: Get required submodules
307+
run: |
308+
git submodule update --init --depth 1 third_party/opentelemetry-proto
291309
- name: Install Conan
292310
run: |
293311
python3 -m pip install pip==25.0.1
@@ -306,6 +324,8 @@ jobs:
306324
run: |
307325
export PKG_CONFIG_PATH=$INSTALL_TEST_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
308326
./ci/verify_packages.sh
327+
- name: Run OpenTracing Shim Test
328+
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
309329

310330
macos_14_conan_stable:
311331
name: macOS 14 conan stable versions cxx17 (static libs)
@@ -314,6 +334,7 @@ jobs:
314334
INSTALL_TEST_DIR: '/Users/runner/install_test'
315335
CMAKE_VERSION: '3.28.3'
316336
CXX_STANDARD: '17'
337+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
317338
CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake'
318339
BUILD_TYPE: 'Debug'
319340
steps:
@@ -324,7 +345,10 @@ jobs:
324345

325346
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
326347
with:
327-
submodules: 'recursive'
348+
submodules: false
349+
- name: Get required submodules
350+
run: |
351+
git submodule update --init --depth 1 third_party/opentelemetry-proto
328352
- name: Install Conan and tools
329353
run: |
330354
brew install conan autoconf automake libtool coreutils
@@ -347,6 +371,7 @@ jobs:
347371
# Set to the latest version of cmake 3.x
348372
CMAKE_VERSION: '3.31.6'
349373
CXX_STANDARD: '17'
374+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
350375
BUILD_TYPE: 'Debug'
351376
steps:
352377
- name: Harden the runner (Audit all outbound calls)
@@ -356,7 +381,10 @@ jobs:
356381

357382
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
358383
with:
359-
submodules: 'recursive'
384+
submodules: false
385+
- name: Get required submodules
386+
run: |
387+
git submodule update --init --depth 1 third_party/opentelemetry-proto
360388
- name: Install Dependencies with Homebrew
361389
run: |
362390
./ci/setup_cmake_macos.sh

.github/workflows/iwyu.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
build-essential \
3131
ninja-build \
3232
libssl-dev \
33+
zlib1g-dev \
3334
libcurl4-openssl-dev \
3435
libabsl-dev \
3536
libprotobuf-dev \
@@ -40,11 +41,13 @@ jobs:
4041
libgtest-dev \
4142
libbenchmark-dev \
4243
llvm-dev \
43-
libclang-dev
44+
libclang-dev \
45+
zlib1g-dev \
4446
sudo ./ci/setup_cmake.sh
4547
- name: Install include-what-you-use
4648
run: |
4749
sudo ./ci/install_iwyu.sh
50+
4851
- name: Prepare CMake
4952
run: |
5053
TOPDIR=`pwd`

ci/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ by invoking the script
2424
checker.
2525
* `benchmark`: run all benchmarks.
2626
* `format`: use `tools/format.sh` to enforce text formatting.
27-
* `third_party.tags`: store third_party release tags.
2827
* `code.coverage`: build cmake targets with CXX option `--coverage` and run
2928
tests.
3029

ci/do_ci.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,17 @@ switch ($action) {
330330
$CXX_STANDARD = 14
331331
}
332332
Write-Host "Using CXX_STANDARD: $CXX_STANDARD"
333+
334+
if (Test-Path Env:\CMAKE_EXTRA_ARGS) {
335+
# Split on any run of whitespace; filter out any empty tokens
336+
$CMAKE_EXTRA_ARGS = $Env:CMAKE_EXTRA_ARGS -split '\s+' |
337+
Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
338+
}
339+
else {
340+
$CMAKE_EXTRA_ARGS = @()
341+
}
342+
343+
Write-Host "CMAKE_EXTRA_ARGS is: $CMAKE_EXTRA_ARGS"
333344

334345
$CMAKE_OPTIONS = @(
335346
"-DCMAKE_CXX_STANDARD=$CXX_STANDARD",
@@ -362,7 +373,8 @@ switch ($action) {
362373
-DWITH_EXAMPLES=ON `
363374
-DWITH_EXAMPLES_HTTP=ON `
364375
-DBUILD_W3CTRACECONTEXT_TEST=ON `
365-
-DOPENTELEMETRY_INSTALL=ON
376+
-DOPENTELEMETRY_INSTALL=ON `
377+
@CMAKE_EXTRA_ARGS
366378

367379
$exit = $LASTEXITCODE
368380
if ($exit -ne 0) {

0 commit comments

Comments
 (0)