Skip to content

Commit 29c0dd4

Browse files
authored
[CMAKE] Add thirdparty install cmake project and install bash script (#3486)
1 parent 016155f commit 29c0dd4

File tree

11 files changed

+694
-179
lines changed

11 files changed

+694
-179
lines changed

.devcontainer/Dockerfile.dev

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,22 @@ ARG USER_GID=1000
88
ARG INSTALL_PACKAGES=
99

1010
ARG CXX_STANDARD=17
11-
ARG ABSEIL_CPP_VERSION=20230125.3
12-
ARG PROTOBUF_VERSION=23.3
13-
ARG GRPC_VERSION=v1.55.0
1411

1512
ENV CXX_STANDARD=${CXX_STANDARD}
16-
ENV ABSEIL_CPP_VERSION=${ABSEIL_CPP_VERSION}
17-
ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
18-
ENV GRPC_VERSION=${GRPC_VERSION}
1913

2014
COPY ci /opt/ci
2115

2216
RUN apt update && apt install -y wget \
2317
ninja-build \
2418
llvm-dev \
2519
libclang-dev \
26-
libcurl4-openssl-dev \
2720
clang-tidy \
2821
shellcheck \
22+
sudo \
2923
cmake
3024

3125
RUN cd /opt/ci && bash setup_ci_environment.sh
3226
RUN cd /opt/ci && bash install_iwyu.sh
33-
RUN cd /opt && bash ci/setup_googletest.sh \
34-
&& bash ci/install_abseil.sh \
35-
&& bash ci/install_protobuf.sh \
36-
&& bash ci/setup_grpc.sh -r $GRPC_VERSION -s $CXX_STANDARD -p protobuf -p abseil-cpp
3727

3828
ADD https://github.com/bazelbuild/bazelisk/releases/download/v1.22.1/bazelisk-linux-amd64 /usr/local/bin
3929

@@ -46,14 +36,17 @@ ENV USER_UID=${USER_UID}
4636
ENV USER_GID=${USER_GID}
4737
ENV IS_CONTAINER_BUILD=true
4838

39+
COPY install /opt/install
4940
COPY ./.devcontainer/customize_container.sh /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
5041
RUN /tmp/opentelemetry_cpp/devcontainer/customize_container.sh
5142
RUN apt install -y npm && npm install -g [email protected]
5243

5344
USER devuser
5445

5546
WORKDIR /workspaces/opentelemetry-cpp
47+
RUN cd /opt && bash ci/install_thirdparty.sh --install-dir /home/devuser/third-party/install-stable --tags-file install/cmake/third_party_stable
48+
ENV CMAKE_PREFIX_PATH=/home/devuser/third-party/install-stable
5649

5750
ENTRYPOINT []
5851

59-
CMD ["/bin/bash"]
52+
CMD ["/bin/bash"]

.devcontainer/README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,6 @@ environment variables (for evaluation in `devcontainer.json`).
1010
* Host Environment Variable:
1111
`OTEL_CPP_DEVCONTAINER_CXX_STANDARD`
1212

13-
* **abseil-cpp version:**
14-
This is the version of abseil-cpp that will be used to build protobuf, gRPC,
15-
and opentelemetry-cpp.
16-
* Docker ARG:
17-
`ABSEIL_CPP_VERSION`
18-
* Host Environment Variable:
19-
`OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION`
20-
21-
* **Protobuf version:**
22-
* Docker ARG:
23-
`PROTOBUF_VERSION`
24-
* Host Environment Variable:
25-
`OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION`
26-
27-
* **gRPC version:**
28-
* Docker ARG:
29-
`GRPC_VERSION`
30-
* Host Environment Variable:
31-
`OTEL_CPP_DEVCONTAINER_GRPC_VERSION`
32-
3313
* **User ID (UID):**
3414
User ID (Default: `1000`)
3515
* Docker ARG:

.devcontainer/devcontainer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
"USER_UID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_UID:1000}",
1212
"USER_GID": "${localEnv:OTEL_CPP_DEVCONTAINER_USER_GID:1000}",
1313
"INSTALL_PACKAGES": "${localEnv:OTEL_CPP_DEVCONTAINER_INSTALL_PACKAGES:}",
14-
"CXX_STANDARD": "${localEnv:OTEL_CPP_DEVCONTAINER_CXX_STANDARD:17}",
15-
"GRPC_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_GRPC_VERSION:v1.55.0}",
16-
"PROTOBUF_VERSION": "${localEnv:OTEL_CPP_DEVCONTAINER_PROTOBUF_VERSION:23.3}",
17-
"ABSEIL_CPP_VERSION":"${localEnv:OTEL_CPP_DEVCONTAINER_ABSEIL_CPP_VERSION:20230125.3}"
14+
"CXX_STANDARD": "${localEnv:OTEL_CPP_DEVCONTAINER_CXX_STANDARD:17}"
1815
}
1916
},
2017
"customizations": {

.github/workflows/ci.yml

Lines changed: 48 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ jobs:
2121
# submodules: 'recursive'
2222
# - name: setup
2323
# env:
24-
# PROTOBUF_VERSION: '23.3'
25-
# ABSEIL_CPP_VERSION: '20230125.3'
2624
# CXX_STANDARD: '14'
2725
# CC: /usr/bin/gcc-10
2826
# CXX: /usr/bin/g++-10
2927
# run: |
3028
# sudo -E ./ci/setup_gcc10.sh
3129
# sudo -E ./ci/setup_ci_environment.sh
32-
# sudo -E ./ci/setup_googletest.sh
33-
# sudo -E ./ci/install_abseil.sh
34-
# sudo -E ./ci/install_protobuf.sh
30+
# - name: install dependencies
31+
# run: |
32+
# sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
3533

3634
cmake_test:
3735
name: CMake test (prometheus, elasticsearch, zipkin)
@@ -84,32 +82,25 @@ jobs:
8482
cmake_gcc_maintainer_sync_test:
8583
name: CMake gcc 14 (maintainer mode, sync)
8684
runs-on: ubuntu-24.04
85+
env:
86+
CC: /usr/bin/gcc-14
87+
CXX: /usr/bin/g++-14
88+
CXX_STANDARD: '14'
8789
steps:
8890
- name: Harden the runner (Audit all outbound calls)
8991
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
9092
with:
9193
egress-policy: audit
92-
9394
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9495
with:
9596
submodules: 'recursive'
9697
- name: setup
97-
env:
98-
CC: /usr/bin/gcc-14
99-
CXX: /usr/bin/g++-14
100-
PROTOBUF_VERSION: 21.12
10198
run: |
102-
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
10399
sudo -E ./ci/setup_ci_environment.sh
104-
sudo -E ./ci/setup_googletest.sh
105-
sudo -E ./ci/install_protobuf.sh
106-
- name: setup grpc
100+
- name: install dependencies
107101
run: |
108-
sudo ./ci/setup_grpc.sh
102+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
109103
- name: run cmake gcc (maintainer mode, sync)
110-
env:
111-
CC: /usr/bin/gcc-14
112-
CXX: /usr/bin/g++-14
113104
run: |
114105
./ci/do_ci.sh cmake.maintainer.sync.test
115106
- name: generate test cert
@@ -125,32 +116,25 @@ jobs:
125116
cmake_gcc_maintainer_async_test:
126117
name: CMake gcc 14 (maintainer mode, async)
127118
runs-on: ubuntu-24.04
119+
env:
120+
CC: /usr/bin/gcc-14
121+
CXX: /usr/bin/g++-14
122+
CXX_STANDARD: '14'
128123
steps:
129124
- name: Harden the runner (Audit all outbound calls)
130125
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
131126
with:
132127
egress-policy: audit
133-
134128
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135129
with:
136130
submodules: 'recursive'
137131
- name: setup
138-
env:
139-
CC: /usr/bin/gcc-14
140-
CXX: /usr/bin/g++-14
141-
PROTOBUF_VERSION: 21.12
142132
run: |
143-
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
144133
sudo -E ./ci/setup_ci_environment.sh
145-
sudo -E ./ci/setup_googletest.sh
146-
sudo -E ./ci/install_protobuf.sh
147-
- name: setup grpc
134+
- name: install dependencies
148135
run: |
149-
sudo ./ci/setup_grpc.sh
136+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
150137
- name: run cmake gcc (maintainer mode, async)
151-
env:
152-
CC: /usr/bin/gcc-14
153-
CXX: /usr/bin/g++-14
154138
run: |
155139
./ci/do_ci.sh cmake.maintainer.async.test
156140
- name: generate test cert
@@ -166,32 +150,25 @@ jobs:
166150
cmake_clang_maintainer_sync_test:
167151
name: CMake clang 18 (maintainer mode, sync)
168152
runs-on: ubuntu-24.04
153+
env:
154+
CC: /usr/bin/clang-18
155+
CXX: /usr/bin/clang++-18
156+
CXX_STANDARD: '14'
169157
steps:
170158
- name: Harden the runner (Audit all outbound calls)
171159
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
172160
with:
173161
egress-policy: audit
174-
175162
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
176163
with:
177164
submodules: 'recursive'
178165
- name: setup
179-
env:
180-
CC: /usr/bin/clang-18
181-
CXX: /usr/bin/clang++-18
182-
PROTOBUF_VERSION: 21.12
183166
run: |
184-
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
185167
sudo -E ./ci/setup_ci_environment.sh
186-
sudo -E ./ci/setup_googletest.sh
187-
sudo -E ./ci/install_protobuf.sh
188-
- name: setup grpc
168+
- name: install dependencies
189169
run: |
190-
sudo ./ci/setup_grpc.sh
170+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
191171
- name: run cmake clang (maintainer mode, sync)
192-
env:
193-
CC: /usr/bin/clang-18
194-
CXX: /usr/bin/clang++-18
195172
run: |
196173
./ci/do_ci.sh cmake.maintainer.sync.test
197174
- name: generate test cert
@@ -207,32 +184,25 @@ jobs:
207184
cmake_clang_maintainer_async_test:
208185
name: CMake clang 18 (maintainer mode, async)
209186
runs-on: ubuntu-24.04
187+
env:
188+
CC: /usr/bin/clang-18
189+
CXX: /usr/bin/clang++-18
190+
CXX_STANDARD: '14'
210191
steps:
211192
- name: Harden the runner (Audit all outbound calls)
212193
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
213194
with:
214195
egress-policy: audit
215-
216196
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
217197
with:
218198
submodules: 'recursive'
219199
- name: setup
220-
env:
221-
CC: /usr/bin/clang-18
222-
CXX: /usr/bin/clang++-18
223-
PROTOBUF_VERSION: 21.12
224200
run: |
225-
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
226201
sudo -E ./ci/setup_ci_environment.sh
227-
sudo -E ./ci/setup_googletest.sh
228-
sudo -E ./ci/install_protobuf.sh
229-
- name: setup grpc
202+
- name: install dependencies
230203
run: |
231-
sudo ./ci/setup_grpc.sh
204+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
232205
- name: run cmake clang (maintainer mode, async)
233-
env:
234-
CC: /usr/bin/clang-18
235-
CXX: /usr/bin/clang++-18
236206
run: |
237207
./ci/do_ci.sh cmake.maintainer.async.test
238208
- name: generate test cert
@@ -248,32 +218,25 @@ jobs:
248218
cmake_clang_maintainer_abiv2_test:
249219
name: CMake clang 18 (maintainer mode, abiv2)
250220
runs-on: ubuntu-24.04
221+
env:
222+
CC: /usr/bin/clang-18
223+
CXX: /usr/bin/clang++-18
224+
CXX_STANDARD: '14'
251225
steps:
252226
- name: Harden the runner (Audit all outbound calls)
253227
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
254228
with:
255229
egress-policy: audit
256-
257230
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
258231
with:
259232
submodules: 'recursive'
260233
- name: setup
261-
env:
262-
CC: /usr/bin/clang-18
263-
CXX: /usr/bin/clang++-18
264-
PROTOBUF_VERSION: 21.12
265234
run: |
266-
sudo apt remove needrestart #refer: https://github.com/actions/runner-images/issues/9937
267235
sudo -E ./ci/setup_ci_environment.sh
268-
sudo -E ./ci/setup_googletest.sh
269-
sudo -E ./ci/install_protobuf.sh
270-
- name: setup grpc
236+
- name: install dependencies
271237
run: |
272-
sudo ./ci/setup_grpc.sh
238+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
273239
- name: run cmake clang (maintainer mode, abiv2)
274-
env:
275-
CC: /usr/bin/clang-18
276-
CXX: /usr/bin/clang++-18
277240
run: |
278241
./ci/do_ci.sh cmake.maintainer.abiv2.test
279242
- name: generate test cert
@@ -566,10 +529,11 @@ jobs:
566529
- name: setup
567530
run: |
568531
sudo -E ./ci/setup_ci_environment.sh
569-
sudo -E ./ci/setup_googletest.sh
532+
- name: install dependencies
533+
run: |
534+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
570535
- name: run otlp exporter tests
571536
run: |
572-
sudo ./ci/setup_grpc.sh
573537
./ci/do_ci.sh cmake.exporter.otprotocol.test
574538
- name: generate test cert
575539
env:
@@ -584,30 +548,24 @@ jobs:
584548
cmake_modern_protobuf_grpc_with_abseil_test:
585549
name: CMake test (with modern protobuf,grpc and abseil)
586550
runs-on: ubuntu-latest
551+
env:
552+
CXX_STANDARD: '14'
587553
steps:
588554
- name: Harden the runner (Audit all outbound calls)
589555
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
590556
with:
591557
egress-policy: audit
592-
593558
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
594559
with:
595560
submodules: 'recursive'
596561
- name: setup
597-
env:
598-
PROTOBUF_VERSION: '23.3'
599-
ABSEIL_CPP_VERSION: '20230125.3'
600-
CXX_STANDARD: '14'
601562
run: |
602563
sudo -E ./ci/setup_ci_environment.sh
603-
sudo -E ./ci/setup_googletest.sh
604-
sudo -E ./ci/install_abseil.sh
605-
sudo -E ./ci/install_protobuf.sh
564+
- name: install dependencies
565+
run: |
566+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file install/cmake/third_party_stable
606567
- name: run otlp exporter tests
607-
env:
608-
CXX_STANDARD: '14'
609568
run: |
610-
sudo -E ./ci/setup_grpc.sh -m -p protobuf -p abseil-cpp
611569
./ci/do_ci.sh cmake.exporter.otprotocol.test
612570
613571
cmake_do_not_install_test:
@@ -625,10 +583,11 @@ jobs:
625583
- name: setup
626584
run: |
627585
sudo -E ./ci/setup_ci_environment.sh
628-
sudo -E ./ci/setup_googletest.sh
586+
- name: install dependencies
587+
run: |
588+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
629589
- name: run otlp exporter tests
630590
run: |
631-
sudo ./ci/setup_grpc.sh
632591
./ci/do_ci.sh cmake.do_not_install.test
633592
634593
cmake_otprotocol_shared_libs_with_static_grpc_test:
@@ -646,10 +605,11 @@ jobs:
646605
- name: setup
647606
run: |
648607
sudo -E ./ci/setup_ci_environment.sh
649-
sudo -E ./ci/setup_googletest.sh
608+
- name: install dependencies
609+
run: |
610+
sudo -E ./ci/install_thirdparty.sh --install-dir /usr/local --tags-file third_party_release
650611
- name: run otlp exporter tests
651612
run: |
652-
sudo ./ci/setup_grpc.sh -T
653613
./ci/do_ci.sh cmake.exporter.otprotocol.shared_libs.with_static_grpc.test
654614
655615
plugin_test:
@@ -951,7 +911,7 @@ jobs:
951911

952912
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
953913
- name: setup
954-
run: sudo apt remove needrestart && sudo ./ci/install_format_tools.sh #refer: https://github.com/actions/runner-images/issues/9937
914+
run: sudo ./ci/install_format_tools.sh
955915
- name: run tests
956916
run: ./ci/do_ci.sh format
957917

0 commit comments

Comments
 (0)