Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ jobs:
go-version-file: go.mod

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@e99025eb970cfa124b8284a35463d87426917478
with:
stable: true
run: ./scripts/setup-macos-homebrew.sh
- name: Install Postgres
run: brew install postgresql@16

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
python3 scripts/test-app-attest-entitlements.py
./scripts/sync-install-embed.sh check
./scripts/test-prod-env-refresh.sh
./scripts/test-setup-macos-homebrew.sh
- name: Test startup observer against local stubs
run: python3 -m unittest discover -s scripts/startup_measurement -t scripts -p 'test_*.py'
- name: Test advisory threat review with local HTTP fixtures
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
go-version-file: go.mod

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@e99025eb970cfa124b8284a35463d87426917478
with:
stable: true
run: ./scripts/setup-macos-homebrew.sh
- name: Install Postgres
run: brew install postgresql@16

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

## Unreleased — CI and contributor workflow

- Set up Homebrew in the macOS integration and benchmark workflows with `scripts/setup-macos-homebrew.sh` instead of the `Homebrew/actions/setup-homebrew` action. The organization Actions policy does not allow that action, so both workflows stopped at startup. The script uses an installed `brew` or installs Homebrew from a pinned, checksum-verified installer.
- Run provider unit, SDK and prompt-parity checks on independent workers with compatible build caches, retaining MiMo fixture preparation and isolated native gates.
- Separate prerequisite-dependent MiMo qualification from ordinary provider tests, retaining required prepared-fixture checks and explicit qualification gaps. Normalize the rollback test's filesystem identity and synchronize the zombie-stream timing test with the initial cancellation.
- Pin the production prompt fixture's EOF format during regeneration; parity still compares the complete corpus bytes and unchanged token/contract expectations.
Expand Down
15 changes: 10 additions & 5 deletions docs/developer/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ test-only resource (`libs/mlx-swift-lm/Package.swift`). Those files are not
provider product resources. Build SDK tests separately from provider tests
when validating the media working-set change; see [test gates](test.md).

The macOS integration and benchmark workflows explicitly initialize Homebrew
with the pinned `Homebrew/actions/setup-homebrew` action before installing
`postgresql@16`. The action exposes an existing installation or installs
Homebrew when the runner image does not provide it; the job no longer depends
on GitHub-hosted image defaults.
The macOS integration and benchmark workflows run
`scripts/setup-macos-homebrew.sh` before they install `postgresql@16`. The
script uses `brew` if it is on `PATH`, at `/opt/homebrew/bin/brew` or at
`/usr/local/bin/brew`. If it finds no `brew`, it downloads the official
Homebrew installer from a pinned commit, checks its SHA-256, and runs it with
`NONINTERACTIVE=1`. In both cases it writes the `brew shellenv` values to
`$GITHUB_ENV` and `$GITHUB_PATH` for later steps. The workflows do not use the
`Homebrew/actions/setup-homebrew` action, because the organization Actions
policy does not allow it. To move the installer pin, change the commit and the
SHA-256 in the script together.

macOS jobs that download artifacts, verify source signatures through the
GitHub API, or post benchmark results run `scripts/install-macos-github-cli.sh`
Expand Down
14 changes: 10 additions & 4 deletions docs/developer/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,7 @@ make benchmark-wrapper-test # python3 -m unittest discover -s gemma_contb
python3 scripts/test-provider-release-resolution.py # signed-validation and publication routing before credentials
./scripts/sync-install-embed.sh check # coordinator/api/install.sh byte-identical to scripts/install.sh
./scripts/test-prod-env-refresh.sh # deploy/gcp/prod/refresh-env.sh contract
./scripts/test-setup-macos-homebrew.sh # scripts/setup-macos-homebrew.sh with brew already installed
./scripts/test-publish-model.sh # scripts/publish-model.sh dry-run contract
```

Expand Down Expand Up @@ -2789,10 +2790,15 @@ Model findings and live API failures remain non-blocking in the separate

### macOS E2E Postgres setup

The integration and benchmark jobs initialize Homebrew before installing
`postgresql@16` and deriving its binary path with `brew --prefix`. A missing
Homebrew executable is a runner-setup failure before E2E tests execute. See
`.github/workflows/integration.yml` and `.github/workflows/benchmarks.yml`.
The integration and benchmark jobs run `scripts/setup-macos-homebrew.sh`
before they install `postgresql@16` and get its binary path with
`brew --prefix`. The script finds Homebrew or installs it from a pinned,
checksum-verified installer. If Homebrew is still missing, the step fails
before E2E tests run. See `.github/workflows/integration.yml` and
`.github/workflows/benchmarks.yml`.
`./scripts/test-setup-macos-homebrew.sh` tests the path where `brew` is
already installed. It uses a fake `brew` in a temporary directory, makes no
download, and runs in the "Release Integrity" CI job.

### Retained unsigned release recovery checks

Expand Down
62 changes: 62 additions & 0 deletions scripts/setup-macos-homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Find Homebrew on a macOS CI runner, or install it from a pinned installer,
# and export its environment to later steps. Replaces the setup-homebrew
# action, which the organization Actions policy does not allow.
set -euo pipefail

: "${GITHUB_PATH:?GITHUB_PATH is required}"
: "${GITHUB_ENV:?GITHUB_ENV is required}"

# Homebrew/install commit and the SHA-256 of its install.sh. Change both together.
installer_commit=f6632bc2e9afc0ba20cdee1f2d28bcd7672b3245
installer_sha256=fa4ed743b4ca38316c8f32fd6623baa5bbb928fd4a47ad9f49c2be78ea833449

find_brew() {
local candidate
if candidate="$(command -v brew)"; then
printf '%s\n' "$candidate"
return 0
fi
for candidate in /opt/homebrew/bin/brew /usr/local/bin/brew; do
if [ -x "$candidate" ]; then
printf '%s\n' "$candidate"
return 0
fi
done
return 1
}

install_brew() {
if [ "$(uname -s)" != Darwin ]; then
echo 'Homebrew bootstrap requires macOS' >&2
exit 2
fi
: "${RUNNER_TEMP:?RUNNER_TEMP is required}"
local installer
installer="$(mktemp "$RUNNER_TEMP/homebrew-install.XXXXXX")"
trap 'rm -f "$installer"' EXIT
curl --fail --silent --show-error --location --retry 3 --max-time 180 \
"https://raw.githubusercontent.com/Homebrew/install/$installer_commit/install.sh" \
--output "$installer"
# Verify before executing.
printf '%s %s\n' "$installer_sha256" "$installer" | shasum -a 256 --check
NONINTERACTIVE=1 HOMEBREW_NO_ANALYTICS=1 /bin/bash "$installer"
}

if ! brew_bin="$(find_brew)"; then
install_brew
if ! brew_bin="$(find_brew)"; then
echo 'Homebrew installer finished but brew was not found' >&2
exit 1
fi
fi

eval "$("$brew_bin" shellenv bash)"
: "${HOMEBREW_PREFIX:?brew shellenv did not set HOMEBREW_PREFIX}"
"$brew_bin" --version
{
printf 'HOMEBREW_PREFIX=%s\n' "$HOMEBREW_PREFIX"
printf 'HOMEBREW_CELLAR=%s\n' "${HOMEBREW_CELLAR:-$HOMEBREW_PREFIX/Cellar}"
printf 'HOMEBREW_REPOSITORY=%s\n' "${HOMEBREW_REPOSITORY:-$HOMEBREW_PREFIX}"
} >> "$GITHUB_ENV"
printf '%s\n' "$HOMEBREW_PREFIX/sbin" "$HOMEBREW_PREFIX/bin" >> "$GITHUB_PATH"
50 changes: 50 additions & 0 deletions scripts/test-setup-macos-homebrew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Offline test: when brew is already on PATH, setup-macos-homebrew.sh exports
# its environment and downloads nothing.
set -euo pipefail

ROOT=$(cd "$(dirname "$0")/.." && pwd)
TEST_ROOT=$(mktemp -d "${TMPDIR:-/tmp}/darkbloom-homebrew.XXXXXX")
trap 'rm -rf "$TEST_ROOT"' EXIT

prefix="$TEST_ROOT/homebrew"
mkdir -p "$prefix/bin" "$TEST_ROOT/tools"
cat > "$prefix/bin/brew" <<FAKE
#!/usr/bin/env bash
case "\$1" in
shellenv)
printf 'export HOMEBREW_PREFIX="%s";\n' "$prefix"
printf 'export HOMEBREW_CELLAR="%s/Cellar";\n' "$prefix"
printf 'export HOMEBREW_REPOSITORY="%s";\n' "$prefix"
;;
--version) echo 'Homebrew 0.0.0-test' ;;
*) echo "unexpected brew call: \$*" >&2; exit 1 ;;
esac
FAKE
# Any download means the script took the install path.
printf '#!/usr/bin/env bash\necho "curl must not run" >&2\nexit 1\n' > "$TEST_ROOT/tools/curl"
chmod +x "$prefix/bin/brew" "$TEST_ROOT/tools/curl"

github_path="$TEST_ROOT/github_path"
github_env="$TEST_ROOT/github_env"
: > "$github_path"
: > "$github_env"

env -u RUNNER_TEMP PATH="$prefix/bin:$TEST_ROOT/tools:$PATH" \
GITHUB_PATH="$github_path" GITHUB_ENV="$github_env" \
"$ROOT/scripts/setup-macos-homebrew.sh" >/dev/null

grep -Fxq "HOMEBREW_PREFIX=$prefix" "$github_env"
grep -Fxq "HOMEBREW_CELLAR=$prefix/Cellar" "$github_env"
grep -Fxq "HOMEBREW_REPOSITORY=$prefix" "$github_env"
grep -Fxq "$prefix/bin" "$github_path"
grep -Fxq "$prefix/sbin" "$github_path"

# Missing GitHub output files must fail before any other work.
if env -u GITHUB_ENV PATH="$prefix/bin:$TEST_ROOT/tools:$PATH" GITHUB_PATH="$github_path" \
"$ROOT/scripts/setup-macos-homebrew.sh" >/dev/null 2>&1; then
echo 'setup accepted a missing GITHUB_ENV' >&2
exit 1
fi

echo 'setup-macos-homebrew: ok'
Loading