Skip to content

Commit 341ec8e

Browse files
committed
pin cmake version in the cmake install test workflow
1 parent e843642 commit 341ec8e

File tree

3 files changed

+63
-10
lines changed

3 files changed

+63
-10
lines changed

.github/workflows/cmake_install.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
with:
1919
submodules: 'recursive'
2020
- name: Build dependencies with vcpkg submodule
21-
run: ./ci/setup_windows_ci_environment.ps1
21+
run: |
22+
./ci/setup_cmake.ps1
23+
./ci/setup_windows_ci_environment.ps1
2224
- name: Run Tests
2325
run: ./ci/do_ci.ps1 cmake.install.test
2426
- name: Run DLL Tests
@@ -34,7 +36,9 @@ jobs:
3436
with:
3537
submodules: 'recursive'
3638
- name: Build dependencies with vcpkg submodule
37-
run: ./ci/setup_windows_ci_environment.ps1
39+
run: |
40+
./ci/setup_cmake.ps1
41+
./ci/setup_windows_ci_environment.ps1
3842
- name: Run Tests
3943
run: ./ci/do_ci.ps1 cmake.install.test
4044

@@ -51,8 +55,9 @@ jobs:
5155
submodules: 'recursive'
5256
- name: Install libcurl, zlib, nlohmann-json with apt
5357
run: |
54-
sudo -E ./ci/setup_googletest.sh
5558
sudo -E ./ci/setup_ci_environment.sh
59+
sudo -E ./ci/setup_cmake.sh
60+
sudo -E ./ci/setup_googletest.sh
5661
- name: Install abseil, protobuf, and grpc with apt
5762
run: |
5863
sudo -E apt-get update
@@ -79,8 +84,9 @@ jobs:
7984
submodules: 'recursive'
8085
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
8186
run: |
82-
sudo -E ./ci/setup_googletest.sh
8387
sudo -E ./ci/setup_ci_environment.sh
88+
sudo -E ./ci/setup_cmake.sh
89+
sudo -E ./ci/setup_googletest.sh
8490
- name: Build abseil, protobuf, and grpc with ci scripts
8591
env:
8692
ABSEIL_CPP_VERSION: '20240722.1'
@@ -108,8 +114,9 @@ jobs:
108114
submodules: 'recursive'
109115
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
110116
run: |
111-
sudo -E ./ci/setup_googletest.sh
112117
sudo -E ./ci/setup_ci_environment.sh
118+
sudo -E ./ci/setup_cmake.sh
119+
sudo -E ./ci/setup_googletest.sh
113120
- name: Build abseil, protobuf, and grpc with ci scripts
114121
env:
115122
ABSEIL_CPP_VERSION: '20230125.3'
@@ -141,8 +148,9 @@ jobs:
141148
submodules: 'recursive'
142149
- name: Install gtest, libcurl, zlib, nlohmann-json with apt
143150
run: |
144-
sudo -E ./ci/setup_googletest.sh
145151
sudo -E ./ci/setup_ci_environment.sh
152+
sudo -E ./ci/setup_cmake.sh
153+
sudo -E ./ci/setup_googletest.sh
146154
- name: Build abseil, protobuf, and grpc with ci scripts
147155
env:
148156
ABSEIL_CPP_VERSION: '20220623.2'
@@ -179,7 +187,9 @@ jobs:
179187
pip install "conan>=2.0,<3"
180188
conan profile detect --force
181189
- name: Install or build all dependencies with Conan
182-
run: conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=Debug
190+
run: |
191+
sudo -E ./ci/setup_cmake.sh
192+
conan install install/conan/conanfile_stable.txt --build=missing -of /home/runner/conan -s build_type=Debug
183193
- name: Run Tests (static libs)
184194
env:
185195
BUILD_SHARED_LIBS: 'OFF'
@@ -213,7 +223,9 @@ jobs:
213223
pip install "conan>=2.0,<3"
214224
conan profile detect --force
215225
- name: Install or build all dependencies with Conan
216-
run: conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=Debug
226+
run: |
227+
sudo -E ./ci/setup_cmake.sh
228+
conan install install/conan/conanfile_latest.txt --build=missing -of /home/runner/conan -s build_type=Debug
217229
- name: Run Tests (static libs)
218230
env:
219231
BUILD_SHARED_LIBS: 'OFF'
@@ -238,6 +250,7 @@ jobs:
238250
- name: Install Conan and tools
239251
run: |
240252
brew install conan autoconf automake libtool coreutils
253+
sudo -E ./ci/setup_cmake_macos.sh
241254
conan profile detect --force
242255
- name: Install or build all dependencies with Conan
243256
run: conan install install/conan/conanfile_stable.txt --build=missing -of /Users/runner/conan -s build_type=Debug
@@ -258,6 +271,7 @@ jobs:
258271
submodules: 'recursive'
259272
- name: Install Dependencies with Homebrew
260273
run: |
274+
sudo -E ./ci/setup_cmake_macos.sh
261275
brew install coreutils
262276
brew install googletest
263277
brew install google-benchmark

ci/setup_cmake.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
set -e
77

8-
# Use CMAKE_VERSION env var if set, else default to 3.31.6
98
CMAKE_VERSION=${CMAKE_VERSION:-3.31.6}
109
CMAKE_DIR="cmake-$CMAKE_VERSION-linux-x86_64"
1110
CMAKE_TAR="$CMAKE_DIR.tar.gz"
@@ -25,7 +24,7 @@ mkdir -p /opt/cmake
2524
mv "$CMAKE_DIR" /opt/cmake/cmake
2625

2726
for file in /opt/cmake/cmake/bin/*; do
28-
ln -sf "$file" /usr/local/bin/$(basename "$file")
27+
ln -sf "$file" "/usr/local/bin/$(basename "$file")"
2928
done
3029

3130
rm -f "$CMAKE_TAR"

ci/setup_cmake_macos.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Copyright The OpenTelemetry Authors
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
set -e
7+
8+
CMAKE_VERSION="${CMAKE_VERSION:-3.31.6}"
9+
CMAKE_PKG="cmake-${CMAKE_VERSION}-macos-universal"
10+
CMAKE_TAR="${CMAKE_PKG}.tar.gz"
11+
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_TAR}"
12+
13+
INSTALL_DIR="/opt/cmake"
14+
BIN_DIR="${INSTALL_DIR}/cmake/CMake.app/Contents/bin"
15+
16+
echo "Installing CMake version ${CMAKE_VERSION}..."
17+
18+
if brew list cmake >/dev/null 2>&1; then
19+
echo "Removing existing Homebrew-installed CMake..."
20+
brew uninstall cmake
21+
fi
22+
23+
if ! command -v wget >/dev/null 2>&1; then
24+
echo "wget not found. Installing wget via Homebrew..."
25+
brew install wget
26+
fi
27+
28+
wget -q "${CMAKE_URL}"
29+
tar -xzf "${CMAKE_TAR}"
30+
31+
sudo mkdir -p "${INSTALL_DIR}"
32+
sudo mv "${CMAKE_PKG}" "${INSTALL_DIR}/cmake"
33+
34+
for file in "${BIN_DIR}"/*; do
35+
sudo ln -sf "${file}" "/usr/local/bin/$(basename "${file}")"
36+
done
37+
38+
rm -f "${CMAKE_TAR}"
39+
40+
cmake --version

0 commit comments

Comments
 (0)