Skip to content

Commit 6142a74

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 fa231c7 commit 6142a74

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
@@ -45,6 +46,7 @@ jobs:
4546
CMAKE_VERSION: '3.15.0'
4647
# cxx14 is the default for windows-2019
4748
CXX_STANDARD: '14'
49+
CMAKE_EXTRA_ARGS: "-DWITH_GSL=ON -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
4850
steps:
4951
- name: Harden the runner (Audit all outbound calls)
5052
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
@@ -76,19 +78,50 @@ jobs:
7678
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
7779
with:
7880
egress-policy: audit
79-
8081
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8182
with:
8283
submodules: 'recursive'
83-
- name: Install libcurl, zlib, nlohmann-json with apt
84+
- name: Setup CI Environment
8485
run: |
8586
sudo -E ./ci/setup_ci_environment.sh
8687
sudo -E ./ci/setup_cmake.sh
87-
sudo -E ./ci/setup_googletest.sh
88-
- name: Install abseil, protobuf, and grpc with apt
88+
- name: Install Dependencies
8989
run: |
9090
sudo -E apt-get update
91-
sudo -E apt-get install -y libabsl-dev libprotobuf-dev libgrpc++-dev protobuf-compiler protobuf-compiler-grpc
91+
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
92+
- name: Run Tests (static libs)
93+
env:
94+
BUILD_SHARED_LIBS: 'OFF'
95+
run: ./ci/do_ci.sh cmake.install.test
96+
- name: Run Tests (shared libs)
97+
env:
98+
BUILD_SHARED_LIBS: 'ON'
99+
run: ./ci/do_ci.sh cmake.install.test
100+
101+
ubuntu_2404_all_fetch:
102+
name: Ubuntu 24.04 fetch all dependencies (static libs - shared libs - opentracing shim)
103+
runs-on: ubuntu-24.04
104+
env:
105+
INSTALL_TEST_DIR: '/home/runner/install_test'
106+
# CMake 3.28 is apt package version for Ubuntu 24.04
107+
CMAKE_VERSION: '3.28.3'
108+
# The default cxx standard for Ubuntu 24.04
109+
CXX_STANDARD: '17'
110+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FETCH_CONTENT_ONLY=ON"
111+
BUILD_TYPE: 'Debug'
112+
steps:
113+
- name: Harden the runner (Audit all outbound calls)
114+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
115+
with:
116+
egress-policy: audit
117+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
118+
with:
119+
# Don't checkout the submodules.
120+
submodules: false
121+
- name: Setup CI Environment
122+
run: |
123+
sudo -E ./ci/setup_ci_environment.sh
124+
sudo -E ./ci/setup_cmake.sh
92125
- name: Run Tests (static libs)
93126
env:
94127
BUILD_SHARED_LIBS: 'OFF'
@@ -97,43 +130,36 @@ jobs:
97130
env:
98131
BUILD_SHARED_LIBS: 'ON'
99132
run: ./ci/do_ci.sh cmake.install.test
133+
- name: Run OpenTracing Shim Test
134+
run: ./ci/do_ci.sh cmake.opentracing_shim.install.test
100135

101136
ubuntu_2404_latest:
102137
name: Ubuntu 24.04 latest versions cxx20 (static libs)
103138
runs-on: ubuntu-24.04
104139
env:
105140
INSTALL_TEST_DIR: '/home/runner/install_test'
141+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
106142
# Set to the latest version of cmake 3.x
107143
CMAKE_VERSION: '3.31.6'
108144
# Set to the latest cxx standard supported by opentelemetry-cpp
109145
CXX_STANDARD: '20'
110-
# Versions below set to the latest version available
111-
# The abseil and protobuf versions are taken from
112-
# the grpc submodules at the GRPC_VERSION tag
113-
GOOGLETEST_VERSION: '1.16.0'
114-
ABSEIL_CPP_VERSION: '20240722.1'
115-
PROTOBUF_VERSION: '29.0'
116-
GRPC_VERSION: 'v1.71.0'
146+
CMAKE_EXTRA_ARGS: '-DWITH_STL=CXX20 -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON'
117147
BUILD_TYPE: 'Debug'
118148
steps:
119149
- name: Harden the runner (Audit all outbound calls)
120150
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
121151
with:
122152
egress-policy: audit
123-
124153
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
125154
with:
126-
submodules: 'recursive'
127-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
155+
submodules: false
156+
- name: Setup CI Environment
128157
run: |
129158
sudo -E ./ci/setup_ci_environment.sh
130159
sudo -E ./ci/setup_cmake.sh
131-
sudo -E ./ci/setup_googletest.sh
132-
- name: Build abseil, protobuf, and grpc with ci scripts
160+
- name: Install Dependencies
133161
run: |
134-
sudo -E ./ci/install_abseil.sh
135-
sudo -E ./ci/install_protobuf.sh
136-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
162+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_latest
137163
- name: Run Tests (static libs)
138164
env:
139165
BUILD_SHARED_LIBS: 'OFF'
@@ -144,35 +170,27 @@ jobs:
144170
runs-on: ubuntu-22.04
145171
env:
146172
INSTALL_TEST_DIR: '/home/runner/install_test'
173+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
147174
# CMake 3.22 is the apt package version for Ubuntu 22.04
148175
CMAKE_VERSION: '3.22.0'
149176
CXX_STANDARD: '17'
150-
# These are stable versions tested in the main ci workflow
151-
# and defaults in the devcontainer
152-
GOOGLETEST_VERSION: '1.14.0'
153-
ABSEIL_CPP_VERSION: '20230125.3'
154-
PROTOBUF_VERSION: '23.3'
155-
GRPC_VERSION: 'v1.55.0'
177+
CMAKE_EXTRA_ARGS: "-DWITH_STL=CXX17 -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
156178
BUILD_TYPE: 'Debug'
157179
steps:
158180
- name: Harden the runner (Audit all outbound calls)
159181
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
160182
with:
161183
egress-policy: audit
162-
163184
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
164185
with:
165-
submodules: 'recursive'
166-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
186+
submodules: false
187+
- name: Setup CI Environment
167188
run: |
168189
sudo -E ./ci/setup_ci_environment.sh
169190
sudo -E ./ci/setup_cmake.sh
170-
sudo -E ./ci/setup_googletest.sh
171-
- name: Build abseil, protobuf, and grpc with ci scripts
191+
- name: Install Dependencies
172192
run: |
173-
sudo -E ./ci/install_abseil.sh
174-
sudo -E ./ci/install_protobuf.sh
175-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
193+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_stable
176194
- name: Run Tests (static libs)
177195
env:
178196
BUILD_SHARED_LIBS: 'OFF'
@@ -187,36 +205,28 @@ jobs:
187205
runs-on: ubuntu-22.04
188206
env:
189207
INSTALL_TEST_DIR: '/home/runner/install_test'
208+
OTELCPP_PROTO_PATH: '/home/runner/third-party/opentelemetry-proto'
190209
# Set to the current minimum version of cmake
191210
CMAKE_VERSION: '3.14.0'
192211
# cxx14 is the default for Ubuntu 22.04
193212
CXX_STANDARD: '14'
194-
# This is the apt package version of googletest for Ubuntu 22.04
195-
GOOGLETEST_VERSION: '1.11.0'
196-
# These are minimum versions tested in the main ci workflow
197-
ABSEIL_CPP_VERSION: '20220623.2'
198-
PROTOBUF_VERSION: '21.12'
199-
GRPC_VERSION: 'v1.49.2'
200-
BUILD_TYPE: 'Debug'
213+
CMAKE_EXTRA_ARGS: "-DWITH_GSL=ON -DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
214+
BUILD_TYPE: 'Release'
201215
steps:
202216
- name: Harden the runner (Audit all outbound calls)
203217
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
204218
with:
205219
egress-policy: audit
206-
207220
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
208221
with:
209-
submodules: 'recursive'
210-
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
222+
submodules: false
223+
- name: Setup CI Environment
211224
run: |
212225
sudo -E ./ci/setup_ci_environment.sh
213226
sudo -E ./ci/setup_cmake.sh
214-
sudo -E ./ci/setup_googletest.sh
215-
- name: Build abseil, protobuf, and grpc with ci scripts
227+
- name: Install Dependencies
216228
run: |
217-
sudo -E ./ci/install_abseil.sh
218-
sudo -E ./ci/install_protobuf.sh
219-
sudo -E ./ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
229+
sudo -E ./ci/install_thirdparty.sh /usr/local install/cmake/third_party_minimum
220230
- name: Run Tests (static libs)
221231
env:
222232
BUILD_SHARED_LIBS: 'OFF'
@@ -234,6 +244,7 @@ jobs:
234244
# CMake 3.28 is apt package version for Ubuntu 24.04
235245
CMAKE_VERSION: '3.28.3'
236246
CXX_STANDARD: '17'
247+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
237248
CMAKE_TOOLCHAIN_FILE: /home/runner/conan/build/Debug/generators/conan_toolchain.cmake
238249
BUILD_TYPE: 'Debug'
239250
steps:
@@ -244,7 +255,10 @@ jobs:
244255

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

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

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

311331
macos_14_conan_stable:
312332
name: macOS 14 conan stable versions cxx17 (static libs)
@@ -315,6 +335,7 @@ jobs:
315335
INSTALL_TEST_DIR: '/Users/runner/install_test'
316336
CMAKE_VERSION: '3.28.3'
317337
CXX_STANDARD: '17'
338+
CMAKE_EXTRA_ARGS: "-DOTELCPP_THIRDPARTY_FIND_PACKAGE_ONLY=ON"
318339
CMAKE_TOOLCHAIN_FILE: '/Users/runner/conan/build/Debug/generators/conan_toolchain.cmake'
319340
BUILD_TYPE: 'Debug'
320341
steps:
@@ -325,7 +346,10 @@ jobs:
325346

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

358383
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
359384
with:
360-
submodules: 'recursive'
385+
submodules: false
386+
- name: Get required submodules
387+
run: |
388+
git submodule update --init --depth 1 third_party/opentelemetry-proto
361389
- name: Install Dependencies with Homebrew
362390
run: |
363391
./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)