Skip to content

Commit 7362dd8

Browse files
authored
fix: kokoro for macos kokoro/macos/cmake-vcpkg (#15458)
* fix: clean up homebrew * fix: fix brew install of cmake * chore: add comments
1 parent 612245c commit 7362dd8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

ci/kokoro/macos/build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616

1717
set -euo pipefail
1818

19+
# Homebrew cleanup
20+
git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew || echo "Failed to set Homebrew origin"
21+
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/Homebrew/homebrew-core || echo "Failed to set homebrew-core origin"
22+
brew untap homebrew/cask --force || echo "Failed to untap homebrew/cask"
23+
brew untap homebrew/core --force || echo "Failed to untap homebrew/core"
24+
brew untap homebrew/cask-versions --force || echo "Failed to untap homebrew/cask-versions"
25+
brew cleanup -s || echo "brew cleanup failed"
26+
brew update-reset
27+
1928
source "$(dirname "$0")/../../lib/init.sh"
2029
source module ci/lib/io.sh
2130

ci/kokoro/macos/builds/cmake-vcpkg.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,24 @@ brew install bash ninja
3434
# Install a specific version of CMake to match our GHA builds
3535
(
3636
cd "${HOME}"
37+
# Create a temporary local tap
38+
mkdir -p user/homebrew-tap/Formula
39+
cd user/homebrew-tap
40+
git init
41+
42+
# Download the Homebrew formula for CMake==3.27.2
3743
curl -fsSL -o cmake.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/fd21fcf239bcd0231c9fed5719403ec128151af4/Formula/cmake.rb
38-
brew install cmake.rb
44+
mv cmake.rb ./Formula/
45+
46+
git add .
47+
git commit -m "Add CMake formula"
48+
49+
# Tap the local repository
50+
brew tap user/homebrew-tap "${HOME}/user/homebrew-tap"
51+
52+
# Uninstall existing CMake and install CMake from the local tap
53+
brew uninstall cmake
54+
brew install --build-from-source user/homebrew-tap/cmake
3955
)
4056

4157
io::log_h2 "Using CMake version"

0 commit comments

Comments
 (0)