mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 01:35:42 +00:00
* Ensure Bazel is available in self-hosted workflows * Allow Bazel CI to use Command Line Tools * Set macOS C++ deployment target for Bazel * Use Bazel macOS minimum OS flags * Raise macOS Bazel deployment target for filesystem * Ensure git-lfs is available for CI fetches * Authenticate CI LFS fetches with workflow token * Disable stale LFS hooks during CI checkout * Disable LFS filters during CI checkout * Prepare Git LFS before persistent checkout * Harden generated Bazel rc and LFS auth * Let Xcode sync skip without full Xcode * Harden Unity build cache markers * Require full Xcode for mactools sync
83 lines
2.4 KiB
Bash
Executable File
83 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
COMMON_PATHS="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
|
export PATH="${COMMON_PATHS}:${PATH}"
|
|
|
|
write_developer_dir_override() {
|
|
if [ "$(uname -s)" != "Darwin" ]; then
|
|
return
|
|
fi
|
|
|
|
local developer_dir=""
|
|
if [ -d "/Applications/Xcode.app/Contents/Developer" ]; then
|
|
developer_dir="/Applications/Xcode.app/Contents/Developer"
|
|
elif [ -d "/Library/Developer/CommandLineTools" ]; then
|
|
developer_dir="/Library/Developer/CommandLineTools"
|
|
else
|
|
developer_dir="$(xcode-select -p 2>/dev/null || true)"
|
|
fi
|
|
|
|
if [ -z "$developer_dir" ] || [ ! -d "$developer_dir" ]; then
|
|
echo "ERROR: no usable Apple developer directory found"
|
|
echo "Install Command Line Tools with: xcode-select --install"
|
|
echo "Full Xcode is only required for workflows that build/sign Apple apps."
|
|
exit 1
|
|
fi
|
|
|
|
export DEVELOPER_DIR="$developer_dir"
|
|
if [ -f .bazelrc.local ] && [ -z "${CI:-}" ]; then
|
|
echo "Keeping existing .bazelrc.local outside CI"
|
|
else
|
|
{
|
|
echo "# Generated by ci/github_actions/ensure_bazel_installed.sh; do not edit."
|
|
printf 'common:macos --repo_env=DEVELOPER_DIR=%s\n' "$developer_dir"
|
|
} > .bazelrc.local
|
|
fi
|
|
|
|
if [ -n "${GITHUB_ENV:-}" ]; then
|
|
echo "DEVELOPER_DIR=$developer_dir" >> "$GITHUB_ENV"
|
|
fi
|
|
|
|
echo "Using Apple developer directory at $developer_dir"
|
|
}
|
|
|
|
write_developer_dir_override
|
|
|
|
if [ -n "${GITHUB_PATH:-}" ]; then
|
|
for path in /opt/homebrew/bin /usr/local/bin; do
|
|
if [ -d "$path" ]; then
|
|
echo "$path" >> "$GITHUB_PATH"
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if command -v bazel >/dev/null 2>&1; then
|
|
echo "Using bazel at $(command -v bazel)"
|
|
bazel --version
|
|
exit 0
|
|
fi
|
|
|
|
if ! command -v bazelisk >/dev/null 2>&1; then
|
|
if ! command -v brew >/dev/null 2>&1; then
|
|
echo "ERROR: neither bazel nor bazelisk is on PATH, and Homebrew is unavailable"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing bazelisk with Homebrew"
|
|
brew install bazelisk
|
|
fi
|
|
|
|
BAZEL_BIN_DIR="${RUNNER_TEMP:-/tmp}/bazel-bin"
|
|
mkdir -p "$BAZEL_BIN_DIR"
|
|
ln -sf "$(command -v bazelisk)" "$BAZEL_BIN_DIR/bazel"
|
|
|
|
if [ -n "${GITHUB_PATH:-}" ]; then
|
|
echo "$BAZEL_BIN_DIR" >> "$GITHUB_PATH"
|
|
fi
|
|
|
|
export PATH="$BAZEL_BIN_DIR:$PATH"
|
|
echo "Using bazelisk as bazel at $BAZEL_BIN_DIR/bazel"
|
|
bazel --version
|