Skip to content

Commit c06d686

Browse files
authored
fix(gha): Update CMake installation for macOS (#15439)
- Use a local tap to install a specific CMake version to work around Homebrew environment issues on runners.
1 parent 13744a6 commit c06d686

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/macos-cmake.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,30 @@ jobs:
263263
run: |
264264
# Remove the older CMake version
265265
brew unlink cmake
266+
267+
# Create a temporary local tap
268+
cd "${{runner.temp}}"
269+
mkdir -p user/homebrew-tap/Formula
270+
cd user/homebrew-tap
271+
git init
272+
266273
# Download the Homebrew formula for CMake==3.27.2
267-
curl -fsSL -o cmake.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/fd21fcf239bcd0231c9fed5719403ec128151af4/Formula/cmake.rb
268-
brew install cmake.rb
274+
curl -fsSL -o cmake.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/fd21fcf239bcd0231c9fed5719403ec128151af4/Formula/c/cmake.rb
275+
mv cmake.rb ./Formula/
276+
277+
git add .
278+
git commit -m "Add CMake formula"
279+
280+
# Tap the local repository
281+
brew tap user/homebrew-tap "${{runner.temp}}/user/homebrew-tap"
282+
283+
# Install CMake from the local tap
284+
brew install --build-from-source user/homebrew-tap/cmake
285+
286+
# Clean up the tap
287+
brew untap user/homebrew-tap
288+
cd "${{runner.temp}}"
289+
rm -rf user
269290
- name: Download and Install sccache
270291
if: ${{ inputs.sccache-mode != 'DISABLED' }}
271292
working-directory: "${{runner.temp}}"

0 commit comments

Comments
 (0)