beads/.github/workflows/pr.yml
Julian Knutsen a4509deb2d
ci(bazel): nogo replaces go vet and golangci-lint (ga-96smfk.18) (#7341)
* ci(bazel): nogo replaces go vet and golangci-lint (ga-96smfk.18)

Lint and vet now run as nogo inside the Bazel build, so they gate wherever
the Bazel lanes execute (rbe-west), and the golangci-lint and go vet jobs
leave pr.yml and main.yml.

- //tools/nogo (own go.mod, joined to beads' for go_deps only through
  gazelle.go.work): go test's vet checks (cmd/go's defaultVetFlags, the set
  scripts/ci/go-test-vet.sh ran) plus the eight linters .golangci.yml
  enables, each a wrapper over the library version golangci-lint v2.10.1
  uses (depguard, errcheck, forbidigo, gosec, misspell, sloglint, unconvert,
  unparam).
- .golangci.yml stays the single lint policy: Bazel embeds it and
  tools/nogo/internal/golangci applies it as golangci-lint does (enabled
  set, settings, run.tests: false as library-unit-only analysis, lax
  generated-file detection, path/path-except/text exclusion rules), with
  strict decoding so an unimplemented key fails the build.
- gascity's rules_go //nolint-range patch and x/tools ctrlflow patch,
  byte-identical.
- Windows/darwin: cross-configured, not a golangci leg. The pure lane's
  release cross-compile (//tools/bazel:release_cross, every library and
  binary for all eight release platforms, cgo off) runs nogo on every
  compile, a superset of golangci-lint's windows and darwin legs.
  scripts/pr-lint (make ci-pr-lint, bd preflight) runs `bazel build
  --config=nogo //...` plus release_cross for windows_amd64,darwin_arm64.
  release_cross skips tools/nogo, a separate Go module `go build ./...`
  never compiled.
- pr.yml: scripts-go-checks (vet) and pr-lint-wrapper (x3) are gone, with
  their ci-gate entries; main.yml: pr-lint-wrapper (x6) and go-vet-cache.
  scripts/ci/go-test-vet.sh and install-golangci-lint.sh are deleted.
- pre-commit hook and .pre-commit-config.yaml run `make lint-changed
  LINT_CHANGED_SCOPE=staged` (nogo over the staged packages); Makefile adds
  lint, vet and lint-changed. pr-lint.sh no longer runs gofmt
  (//scripts/repochecks:fmt_test owns it; ga-96smfk.41).
- internal/testutil/integration: five gosec findings in integration-tagged
  library files golangci-lint never built, now linted by the integration
  lanes, carry reasoned //nolint directives.

Parity: with the exclusion rules removed, golangci-lint and nogo report the
same 3,916 findings natively and 3,859 each for windows and darwin (file,
line, linter, text); with .golangci.yml as committed both report none.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): equivalence.py leaves nested Go modules' tests out of go test's set

tools/nogo is its own Go module, so `go test ./...` in the root never runs
its tests; Bazel's unit lane does. Its packages are neither expected nor
extra.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 05:17:22 +00:00

2138 lines
111 KiB
YAML

name: PR
on:
pull_request:
# release/** is here because release-prep and release-fix PRs are based on
# the release branch, not on main. Without it they run almost no CI and the
# first full signal is the tag build, where a failure burns the tag.
branches: [ main, 'release/**', 'hotfix/**' ]
# Merge queue (engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md, "Merge Queue"):
# the ruleset's required gate must also report on each queue entry's
# merge-group commit, or a queued PR waits until the queue times it out.
# checks_requested is the queue asking for those checks; pinned
# explicitly (scripts/ci_merge_queue_test.go). The concurrency group
# below keys a merge group on its own gh-readonly-queue/* ref, so queue
# runs never cancel each other or a PR's own runs.
merge_group:
types: [ checks_requested ]
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BD_DISABLE_METRICS: "1"
BD_DISABLE_EVENT_FLUSH: "1"
# D2: "true" retires a PR Risk legacy tier on same-repo, non-Dependabot
# pull_requests and on merge groups (merge queue); pr.yml's gated Bazel lane(s) for it are then the tier's
# only pre-merge run, and pr.yml's gate goes red unless they ran remotely
# and passed. Committed, not repo variables, so a re-run can never change
# them; each must equal pr.yml's / pr-risk.yml's copy
# (scripts/pr_risk_bazel_coverage_test.go). Revert: commit "false" in both
# workflows (in-flight PRs pick it up on their next push or merge of main).
# Step 1: the embedded-Dolt test jobs (Bazel `embedded Dolt tier`).
BAZEL_RETIRES_LEGACY_EMBEDDED: "true"
# Step 2: the proxied-server and server-Dolt storage test jobs (Bazel
# `proxied-server tier` and `server-Dolt storage tier`).
BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS: "true"
# Step 3: pr.yml's own legacy jobs whose Bazel lanes run in the same pr.yml
# run: PR Core, build-artifacts and the pure-Go/js-wasm check (Bazel
# `test`, `pure-Go and js/wasm`); the `dolt-server lane`, the only run of
# the Dolt-backed domain, uow, tracker, doctor/fix and protocol suites, is
# held to the same rule. pr-risk.yml retires nothing for it; its copy only
# keeps the shared bazel-coverage job identical.
BAZEL_RETIRES_LEGACY_PR_LANES: "true"
# F4 side-by-side rollout: "false" keeps the native windows-latest jobs
# (test-windows-liveness, worktree-remove-windows) as the required pair and
# their Linux-cross-built "-prebuilt" twins (test-windows-liveness-prebuilt,
# worktree-remove-windows-prebuilt) advisory-only. Both pairs run and report
# on every PR regardless of this flag; flipping it to "true" swaps which
# pair ci-gate enforces (the other pair moves to CI_GATE_SKIPPED_OK) without
# touching ci-gate.needs or the env map below -- see the "Evaluate CI gate"
# step's run script. Committed, not a repo variable, for the same reason as
# the BAZEL_RETIRES_LEGACY_* flags above: a re-run can never change it.
WINDOWS_PREBUILT_REQUIRED: "true"
# Fork and Dependabot PRs: "true" covers them like same-repo PRs (the
# flags above then retire their legacy tiers too): rbe-west's mint
# (rbe-fork) gives their Bazel lanes remote execution, instance oss-fork
# or, for allowlisted authors, oss, and a run the mint does not serve
# (mode cache) is red, never a silent fall back to the legacy tiers.
# "false": they keep the legacy tiers, and the Bazel lanes run remotely
# beside them whenever rbe-fork is open (bazel.yml modes
# fork-ro/fork-rw), else locally with the read-only cache as before.
# "true" since ga-96smfk.15: after the canary every fork and Dependabot
# run took fork-ro/fork-rw (none fell to cache). Rollback if the mint
# becomes unreliable: commit "false" in both workflows.
BAZEL_COVERS_FORKS: "true"
# bazel.yml's bazel-cmd-dolt lane (the cmd/bd Dolt-server tier: the
# Dolt-gated cmd/bd tests no other lane runs) is advisory while this is
# "false": it runs and reports in the bazel call (continue-on-error, so a
# failure never turns the call's aggregate red), and ci-gate ignores its
# BAZEL_CMD_DOLT result. "true" adds BAZEL_CMD_DOLT to CI_GATE_REQUIRED in
# the "Evaluate CI gate" step's run script; bazel-gate.sh still accepts
# its skip in modes skip and local. Committed, not a repo variable, for
# the same reason as the flags above. The `bazel` job's cmd-dolt-required
# input must equal it (a `with:` cannot read env; policy-tested): "true"
# also drops //cmd/bd:bd_test from bazel-integration, because the required
# lane runs the same integration-build bd_test without the dolt skip, so
# each cmd/bd test runs once. Rollback: commit "false" here and false in
# that input together; bazel-integration runs bd_test again on the next run.
BAZEL_CMD_DOLT_REQUIRED: "true"
jobs:
# D2 step 3: stands down where bazel-coverage says pr_lanes (same-repo,
# non-Dependabot PRs and merge groups while BAZEL_RETIRES_LEGACY_PR_LANES
# is "true"): its
# consumers then stand down too. F3: the package gates (package-mcp,
# package-npm) are no longer among those consumers - they moved into
# bazel.yml and build their own bd (Bazel-built on same-repo PRs, `go
# build` otherwise), needing only the call's rbe job.
build-artifacts:
name: Build Artifacts
runs-on: ubuntu-latest
needs: bazel-coverage
if: needs.bazel-coverage.outputs.pr_lanes != 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
fetch-depth: 0
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Restore non-race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/non-race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
- name: Build reusable Linux artifacts
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: |
set -euo pipefail
mkdir -p artifacts
source ./.buildflags
go_version="$(go version)"
commit="$(git rev-parse HEAD)"
go build -tags gms_pure_go -o artifacts/bd-linux-gms-pure ./cmd/bd
chmod +x artifacts/bd-linux-gms-pure
(
cd artifacts
sha256sum bd-linux-gms-pure > SHA256SUMS
)
{
echo "commit=${commit}"
echo "go_version=${go_version}"
echo "build_tags=${BEADS_BUILD_TAGS}"
echo "artifact=bd-linux-gms-pure"
} > artifacts/build-manifest.txt
- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: ci-build-artifacts
path: artifacts/
retention-days: 1
if-no-files-found: error
# The checks that need the PR's base commit, so no hermetic Bazel target
# can hold them: check-migration-hygiene.sh's delta half (C: shipped
# migrations are frozen, D: ignored-plane twins, E: no prepared DML in new
# migrations, all over `git diff <merge-base>`) and the .beads/issues.jsonl
# guard. Everything else this job ran is a Bazel test in bazel.yml's `test`
# lane (ga-96smfk.20): //scripts/repochecks:build_tags_test,
# :go_install_guidance_test, :winget_portable_alias_test,
# :migration_hygiene_test (checks A and B) and :fmt_test, and
# //internal/versioncheck:versioncheck_test for check-versions.sh. No Go:
# both steps are bash and git.
#
# Each step has its own id and `if: ${{ !cancelled() }}`, so one failure
# does not hide the other, and its outcome is a job output that ci-gate
# requires (TestPRCIGateFastChecksTokens). FAST_CHECKS (the job's own
# `result`) is the backstop token for a job lost before any step set its
# output.
fast-checks:
name: Fast checks (frozen migrations, .beads diff)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 10
outputs:
migration-hygiene: ${{ steps.migration-hygiene.outcome }}
no-beads-changes: ${{ steps.no-beads-changes.outcome }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
# check-migration-hygiene and check-no-beads-changes diff against
# the base branch; a shallow checkout starves both.
fetch-depth: 0
# Migration hygiene, delta half: edits to migration files that already
# exist on the base branch (shipped migrations are frozen; fix forward
# with a new version), and the twin and prepared-DML rules for new
# migrations. Checks A and B (duplicate versions, nondeterministic SQL)
# read only the tree and run in Bazel. Details:
# scripts/check-migration-hygiene.sh.
- name: Run migration hygiene checks
id: migration-hygiene
if: ${{ !cancelled() }}
env:
BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }}
MIGRATION_HYGIENE_SCOPE: delta
run: ./scripts/check-migration-hygiene.sh
# Fast check to catch accidental .beads/issues.jsonl changes from
# contributors. Runs on both PR triggers: a pull_request diffs against
# origin/<base branch> (GITHUB_BASE_REF), a merge group (which has no
# base_ref) against the queue's merge_group.base_sha, the commit the
# group's head is built on (fetch-depth 0 above fetches it).
- name: Check for .beads/issues.jsonl changes
id: no-beads-changes
if: ${{ !cancelled() }}
env:
MERGE_GROUP_BASE_SHA: ${{ github.event.merge_group.base_sha }}
run: |
base="${MERGE_GROUP_BASE_SHA:-origin/${GITHUB_BASE_REF:-main}}"
# Fail closed: a pipe into grep -q would pass on a failed diff.
if ! git rev-parse --verify --quiet "$base^{commit}" >/dev/null; then
echo "::error::diff base $base is unavailable"
exit 1
fi
if git diff --name-only "$base"...HEAD | grep -q "^\.beads/issues\.jsonl$"; then
echo "This PR includes changes to .beads/issues.jsonl"
echo ""
echo "This file is the project's issue database and should not be modified in PRs."
echo ""
echo "To fix, run:"
echo " git checkout origin/main -- .beads/issues.jsonl"
echo " git commit --amend"
echo " git push --force"
echo ""
exit 1
fi
echo "No .beads/issues.jsonl changes detected"
# Lock in two CGO-disabled portability boundaries. cmd/bd carries a mix of
# cgo-only test helpers (embedded Dolt, sql.DB) and pure-Go tests; compiling
# and running its pure-Go subset prevents test contamination (mybd-ycx /
# GH#3683 follow-up). internal/hooks also declares a js/wasm boundary where
# process execution must fail explicitly, so this required leaf job compiles
# the complete package test binary and executes that exact contract under
# Node rather than allowing a missing platform implementation to recur.
#
# D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel's
# `pure-Go and js/wasm` lane (bazel-pure) runs the same boundaries, and
# also builds the whole tree with cgo off for every release target
# (scripts/ci/bazel-release-cross-compile.sh).
check-cmd-bd-puregeo-tests:
name: Check pure-Go and js/wasm boundaries (CGO_ENABLED=0)
runs-on: ubuntu-latest
needs: bazel-coverage
if: needs.bazel-coverage.outputs.pr_lanes != 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
with:
node-version: '24'
- name: Run js/wasm hook boundary
env:
CGO_ENABLED: "0"
GOARCH: wasm
GOOS: js
run: |
set -euo pipefail
# This required lane owns the exact js/wasm refusal contract. If the
# wasm test surface grows, widen this selector and its count guard
# together rather than assuming compilation executes new tests.
test_status=0
test_output="$(go test -tags gms_pure_go -count=1 -timeout=2m \
-exec="$(go env GOROOT)/lib/wasm/go_js_wasm_exec" \
-run '^TestRunHookReportsUnsupportedExecution$' \
-v ./internal/hooks 2>&1)" || test_status=$?
printf '%s\n' "$test_output"
(( test_status == 0 )) || exit "$test_status"
run_count=0
pass_count=0
nonpass_count=0
pass_pattern='^--- PASS: TestRunHookReportsUnsupportedExecution \([0-9.]+s\)$'
nonpass_pattern='^[[:space:]]*--- (FAIL|SKIP): '
while IFS= read -r line; do
if [[ "$line" == "=== RUN TestRunHookReportsUnsupportedExecution" ]]; then
((run_count += 1))
fi
if [[ "$line" =~ $pass_pattern ]]; then
((pass_count += 1))
fi
if [[ "$line" =~ $nonpass_pattern ]]; then
((nonpass_count += 1))
fi
done <<< "$test_output"
if (( run_count != 1 || pass_count != 1 || nonpass_count != 0 )); then
printf 'expected one exact js/wasm hook test run and pass with no failures or skips; got runs=%s passes=%s nonpasses=%s\n' \
"$run_count" "$pass_count" "$nonpass_count" >&2
exit 1
fi
- name: Build cmd/bd (CGO_ENABLED=0, gms_pure_go)
env:
CGO_ENABLED: "0"
run: go build -tags gms_pure_go -o /tmp/bd-puregeo ./cmd/bd
- name: Compile pure-Go test binaries (CGO_ENABLED=0, gms_pure_go)
env:
CGO_ENABLED: "0"
run: |
go test -tags gms_pure_go -c -o /tmp/bd-cmd-puregeo-test ./cmd/bd
go test -tags gms_pure_go -c -o /tmp/bd-embeddeddolt-puregeo-test ./internal/storage/embeddeddolt
go test -tags gms_pure_go -c -o /tmp/bd-tracker-puregeo-test ./internal/tracker
- name: Run pure-Go cmd/bd test subset (CGO_ENABLED=0)
env:
CGO_ENABLED: "0"
# Restrict to tests that exercise pure-Go code paths. Tests that
# need a Dolt store skip themselves at runtime when no test server
# is available; the goal here is to catch compile-time contamination,
# not run the full suite.
run: |
go test -tags gms_pure_go -count=1 -short -run '^Test(Help|CheckRemoteSafety|FormatDestroyToken|ShouldWireInitRemote|ExtractPrefix|IsNumericID|GetWorktreeGitDir|DriftItemStatuses|RunDriftChecks|IsServerProbablyRunning|CheckHooksDriftNotGitRepo|CheckServerDriftNoBeadsDir|CheckRemoteDriftNoBeadsDir|NocgoFactoriesHonorSharedServer|NocgoNewDoltStoreFromConfig_ErrorSuggestsCorrectFlag|NocgoNewReadOnlyStoreFromConfig_ErrorSuggestsCorrectFlag)' ./cmd/bd
# The lingering-handle liveness regression test is //go:build windows: the
# Ubuntu job above selects it by name but compiles it out, and main.yml's
# Windows job runs only on pushes to main (build/smoke, no go test). Run
# the liveness pair and native config fixture on Windows so their platform
# regressions actually execute at PR time. The init credential shell
# fixtures are a separate concern and run natively in
# pr-preflight-platforms, not here.
# F7b: same-repo Blacksmith (blacksmith-4vcpu-windows-2025) for same-repo
# PRs/merge_group, falling back to windows-latest for forks/Dependabot --
# same pattern as the Linux same-repo jobs above, with the Windows-2025
# label instead (public beta; GitHub's windows-2025 image minus the full
# Visual Studio IDE/EdgeDriver/WinAppDriver, VS Build Tools 2022 present,
# no Linux Docker).
#
# RISK (unverified from this sandbox, flagged in the F7b report): the first
# step below builds and runs ./cmd/bd with CGO_ENABLED=1 (embedded Dolt).
# windows-latest's cgo build works today via the toolchain GitHub documents
# for that image; Blacksmith's windows-2025 docs only confirm "VS Build
# Tools 2022" is present, not which cgo toolchain (MSVC/clang-cl vs an
# installed mingw-w64) backs `go build` with CGO_ENABLED=1 there. The
# fork-PR path (windows-latest) is an unaffected, always-on canary for this
# job; if the same-repo leg fails here specifically with a cgo/link error,
# that is the toolchain gap to roll back on (revert this runs-on line to
# the literal `windows-latest`).
test-windows-liveness:
name: Test (Windows) cmd/bd liveness regression
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}
# F7b review fix (S6): raised from 15 to 20, matching open PR #7143's own
# measurement on this exact job (retained runs take about 8m; one run's
# own step timing showed 451s total with a 403s compile step) and
# main.yml's test-windows (S8) for consistency.
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
# F7b review fix (S9): Blacksmith's windows-2025 image docs confirm "VS
# Build Tools 2022" but not which cgo toolchain backs CGO_ENABLED=1 go
# builds there (see the RISK comment above). Print the relevant tool
# versions early and clearly-labelled so a toolchain gap surfaces in
# this step's own log instead of failing deep into the liveness test
# below with an opaque cgo/link error.
- name: Check Windows cgo toolchain diagnostics
shell: bash
run: |
echo "::group::go env (CGO_ENABLED, CC, GOOS, GOARCH)"
go env CGO_ENABLED CC GOOS GOARCH
echo "::endgroup::"
echo "::group::gcc (mingw-w64) presence"
command -v gcc && gcc --version || echo "gcc not found on PATH"
echo "::endgroup::"
echo "::group::choco presence"
command -v choco && choco --version || echo "choco not found on PATH"
echo "::endgroup::"
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
# F7b review fix (S2): restore-only non-race Go build cache seeded by
# main.yml's test-windows Blacksmith leg (warm-non-race-cache.sh) on
# the exact same runner selection, so the cold cmd/bd compile below
# (the real long pole here per the reviewer's step-timing data) gets a
# true cache hit instead of starting cold every PR.
- name: Restore non-race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/non-race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
- name: Run native Windows global Prime override
shell: bash
env:
CGO_ENABLED: "1"
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: |
go_path=$(command -v go)
[[ "$("$go_path" env GOHOSTOS GOOS)" == $'windows\nwindows' ]]
test_status=0
test_output=$(./scripts/test.sh -v -timeout 5m -run '^TestPrimeBinaryPortfolio$/^TestPrime_HookJSON_GlobalPrimeOverride$' -count=1 ./cmd/bd) || test_status=$?
printf '%s\n' "$test_output"
((test_status == 0))
pass_pattern='^[[:space:]]*--- PASS: TestPrimeBinaryPortfolio/TestPrime_HookJSON_GlobalPrimeOverride \('
nonpass_pattern='^[[:space:]]*--- (FAIL|SKIP): '
pass_count=0
while IFS= read -r line; do
if [[ "$line" =~ $pass_pattern ]]; then
((pass_count += 1))
fi
if [[ "$line" =~ $nonpass_pattern ]]; then
exit 1
fi
done <<<"$test_output"
((pass_count == 1))
- name: Run Windows liveness regression test
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test -tags gms_pure_go -count=1 -run '^TestIsServerProbablyRunning' ./cmd/bd
# internal/doltversion carries Windows-specific branches (PATHEXT
# extension completion in Resolve, ERROR_BAD_EXE_FORMAT detection, the
# executable-bit carve-out) and its behavioral tests run there via .cmd
# stubs — but the Ubuntu test jobs compile those branches without ever
# executing them. Same pattern as the liveness job above: run exactly
# this package on windows-latest so the platform it targets actually
# exercises it at PR time. Small on purpose (~1 min).
#
# internal/storage/dbproxy/server carries the platform-portable path
# handling that #5820 introduced (testPlatformPath, external dolt config
# validation, DSN shaping); run exactly this package on windows-latest -
# the platform those paths target. Tests that need a dolt binary Skipf
# loudly (dolt is not installed on the Windows runners), and the
# unix-socket cases skip on Windows by design.
#
# F7a: fold of two small, independent windows-latest jobs
# (test-windows-doltversion, test-windows-dbproxy-server) into one. Neither
# was in ci-gate's needs/CI_GATE_REQUIRED before the fold (promoting either
# to required-for-merge, once it has run clean for a while, is a separate
# maintainer call), so this fold needs no gate changes. Not one of the
# Windows jobs F4 touches (test-windows-liveness, worktree-remove-windows,
# the preflight/doc-freshness matrices, the twins).
#
# Review SF-1 (2026-10-03): neither step carries continue-on-error, so a
# failing test already fails the job on its own; `if: ${{ !cancelled() }}`
# on the second step only ensures it still runs after the first fails,
# giving both packages' results in one log instead of stopping at the
# first failure. No aggregator step is needed.
# F7b: same-repo Blacksmith (blacksmith-2vcpu-windows-2025); both steps
# build with CGO_ENABLED=0 (or no cgo at all for doltversion), so this job
# carries none of test-windows-liveness's cgo-toolchain risk.
test-windows-small:
name: Test (Windows) small packages (doltversion, dbproxy server)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-windows-2025' || 'windows-latest' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
# F7b review fix (S9): see test-windows-liveness's identical step for
# the full rationale. Both packages here build with CGO_ENABLED=0 (or
# no cgo at all), so this is lower-risk than test-windows-liveness, but
# printing the toolchain state costs nothing and keeps the diagnostic
# convention uniform across every moved Windows job.
- name: Check Windows toolchain diagnostics
shell: bash
run: go env CGO_ENABLED CC GOOS GOARCH
- name: Run doltversion package tests on Windows
id: doltversion
if: ${{ !cancelled() }}
run: go test -tags gms_pure_go -count=1 ./internal/doltversion/
- name: Run dbproxy server package tests on Windows
id: dbproxy-server
if: ${{ !cancelled() }}
env:
CGO_ENABLED: "0"
run: go test -tags gms_pure_go -count=1 -v ./internal/storage/dbproxy/server/
# Destructive worktree removal depends on native Windows path identity.
# This focused process suite requires NTFS per-directory case sensitivity
# and fails (rather than skips) when the runner cannot provide it.
# F7b: same-repo Blacksmith (blacksmith-4vcpu-windows-2025). CGO_ENABLED=0
# below, so no cgo-toolchain risk; this leg's non-race GOCACHE restore-keys
# prefix now gets a hit from main.yml's test-windows job, whose `venue`
# matrix extension (F7b) saves that same key on this exact runner
# selection (restore-keys falls back to the most recent prefix match
# regardless of the exact sha, same as build-artifacts already does for
# the Linux preflight/doc-freshness legs).
#
# RISK (F7b review: not flagged in the original implementation --
# cmd/bd/worktree_remove_git_windows_test.go:233 shells out to
# `fsutil file SetCaseSensitiveInfo`, which requires the "Windows Subsystem
# for Linux" optional feature's per-directory case-sensitivity support to
# be enabled on the image. If that feature is not enabled on Blacksmith's
# windows-2025 image, this FAILS OUTRIGHT rather than skipping (the test
# does not treat an unsupported fsutil call as a skip condition). The
# diagnostic step below surfaces that gap in this job's own log instead of
# a bare test failure deep in the suite; if it reports the feature missing,
# roll back this job's runs-on to the literal `windows-latest` (same
# rollback as test-windows-liveness's cgo risk above) until Blacksmith
# confirms/enables it.
worktree-remove-windows:
name: Worktree remove boundary (Windows)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Check Windows case-sensitivity tooling diagnostics
shell: pwsh
run: |
Write-Output "::group::fsutil file SetCaseSensitiveInfo capability"
$tmp = Join-Path $env:RUNNER_TEMP "case-sensitivity-probe"
New-Item -ItemType Directory -Path $tmp -Force | Out-Null
& fsutil file SetCaseSensitiveInfo $tmp enable
if ($LASTEXITCODE -ne 0) {
Write-Output "::warning::fsutil file SetCaseSensitiveInfo failed (exit $LASTEXITCODE) - this job's worktree-remove tests require the Windows Subsystem for Linux optional feature's per-directory case-sensitivity support and will FAIL (not skip) below if it is unavailable on this image"
} else {
Write-Output "fsutil file SetCaseSensitiveInfo: supported"
}
Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue
Write-Output "::endgroup::"
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Restore non-race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/non-race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
- name: Run native Windows worktree removal boundary tests
env:
CGO_ENABLED: "0"
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test -tags gms_pure_go -count=1 -run '^TestWorktreeRemove' ./cmd/bd
# F4 side-by-side rollout (advisory phase): cross-compiles the Windows test
# binaries this file's native Windows jobs need, from a committed manifest
# (scripts/ci/windows-test-binaries.txt), on a Linux runner via mingw-w64 --
# the same toolchain release.yml's goreleaser job uses for the shipped
# bd-windows-amd64 binary (CC=x86_64-w64-mingw32-gcc; see .goreleaser.yml).
# The "-prebuilt" twin jobs below download this artifact and run it
# natively on windows-latest instead of compiling there, so the CGO build
# that otherwise runs once per Windows job runs here once instead.
#
# Deliberately advisory only: the native `test-windows-liveness` and
# `worktree-remove-windows` jobs above are untouched and still the only
# required pair while WINDOWS_PREBUILT_REQUIRED (top of this file) is
# "false". ci-gate does wait on this job's two twins below (they are in its
# `needs`), but neither twin's result is in CI_GATE_REQUIRED yet -- the
# side-by-side phase runs both paths on every PR so a policy test
# (TestWindowsTestBinariesSelectSameTestsAsNativeJobs, in
# scripts/windows_test_binaries_manifest_test.go) can confirm they select
# the same tests before anyone flips WINDOWS_PREBUILT_REQUIRED to "true".
#
# Manifest is intentionally partial in this phase: it covers only the two
# cmd/bd-backed jobs twinned below. Forks and Dependabot PRs get no
# secrets here, same as every job in this file -- cross-compiling and
# uploading an artifact needs none.
windows-test-binaries:
name: Build Windows test binaries (cross-compile)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Verify Go module checksums
run: go mod verify
- name: Install mingw cross-compiler
timeout-minutes: 12
run: |
updated=""
for attempt in 1 2 3; do
if sudo timeout 120 apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 update; then
updated=yes
break
fi
echo "::warning::apt-get update attempt $attempt failed or timed out"
if [ "$attempt" -lt 3 ]; then sleep 10; fi
done
if [ -z "$updated" ]; then
echo "::warning::apt-get update failed after 3 attempts; proceeding with cached index"
fi
sudo timeout 300 apt-get install -y gcc-mingw-w64-x86-64
- name: Restore Go build cache (Windows cross-compile)
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/xcompile-windows-amd64
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-xcompile-windows-amd64-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-xcompile-windows-amd64-
- name: Build Windows test binaries
env:
GOCACHE: ${{ runner.temp }}/go-cache/xcompile-windows-amd64
run: bash scripts/ci/build-windows-test-binaries.sh "$RUNNER_TEMP/win-bin"
- name: Upload Windows test binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: windows-test-binaries
path: ${{ runner.temp }}/win-bin
retention-days: 1
compression-level: 1
if-no-files-found: error
# Advisory twin of test-windows-liveness: runs the identical test selection,
# flags, and env on windows-latest, but against the binary
# windows-test-binaries cross-compiled instead of compiling here. Step
# names, -run patterns, -count, and the PASS/FAIL parsing block are kept
# byte-for-byte equivalent to the native job on purpose --
# TestWindowsTestBinariesSelectSameTestsAsNativeJobs checks the -run
# literals stay in sync.
# F7b: same-repo Blacksmith (blacksmith-2vcpu-windows-2025). This leg only
# runs a prebuilt binary (cross-compiled on Linux by windows-test-binaries
# via mingw-w64) rather than compiling with cgo on the Windows runner
# itself, so it carries none of test-windows-liveness's cgo-toolchain risk.
test-windows-liveness-prebuilt:
name: Test (Windows, prebuilt) cmd/bd liveness regression
needs: windows-test-binaries
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-windows-2025' || 'windows-latest' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Download Windows test binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: windows-test-binaries
path: ${{ runner.temp }}/win-bin
- name: Verify downloaded binaries
shell: bash
run: |
cd "$RUNNER_TEMP/win-bin"
sha256sum -c SHA256SUMS
# F7b review fix (S9): these binaries are cgo-linked on Linux via
# mingw-w64 (windows-test-binaries), not compiled on this runner, so
# the risk here is specifically whether a cross-compiled binary loads
# and runs at all on Blacksmith's windows-2025 image (missing runtime
# DLLs, etc.), not the cgo-toolchain risk test-windows-liveness
# carries. `-run '^$'` loads/links the binary and matches no tests, so
# a load failure surfaces here instead of inside the real test step.
- name: Check prebuilt Windows binary loads
shell: bash
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe" ./cmd/bd -run '^$' -count=1
- name: Run native Windows global Prime override (prebuilt)
shell: bash
run: |
export BEADS_TEST_PREBUILT_TEST_BINARY="$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe"
export BEADS_TEST_BD_BINARY="$RUNNER_TEMP/win-bin/bd.exe"
go_path=$(command -v go)
[[ "$("$go_path" env GOHOSTOS GOOS)" == $'windows\nwindows' ]]
test_status=0
test_output=$(./scripts/test.sh -v -timeout 5m -run '^TestPrimeBinaryPortfolio$/^TestPrime_HookJSON_GlobalPrimeOverride$' -count=1 ./cmd/bd) || test_status=$?
printf '%s\n' "$test_output"
((test_status == 0))
pass_pattern='^[[:space:]]*--- PASS: TestPrimeBinaryPortfolio/TestPrime_HookJSON_GlobalPrimeOverride \('
nonpass_pattern='^[[:space:]]*--- (FAIL|SKIP): '
pass_count=0
while IFS= read -r line; do
if [[ "$line" =~ $pass_pattern ]]; then
((pass_count += 1))
fi
if [[ "$line" =~ $nonpass_pattern ]]; then
exit 1
fi
done <<<"$test_output"
((pass_count == 1))
- name: Run Windows liveness regression test (prebuilt)
shell: bash
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe" ./cmd/bd -run '^TestIsServerProbablyRunning' -count=1
# Advisory twin of worktree-remove-windows: same package, -run pattern, and
# CGO_ENABLED=0 selection as the native job, but against the cgo=0 binary
# windows-test-binaries cross-compiled instead of compiling here.
# F7b: same-repo Blacksmith (blacksmith-2vcpu-windows-2025); same prebuilt-
# binary rationale as test-windows-liveness-prebuilt above.
worktree-remove-windows-prebuilt:
name: Worktree remove boundary (Windows, prebuilt)
needs: windows-test-binaries
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-windows-2025' || 'windows-latest' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Download Windows test binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: windows-test-binaries
path: ${{ runner.temp }}/win-bin
- name: Verify downloaded binaries
shell: bash
run: |
cd "$RUNNER_TEMP/win-bin"
sha256sum -c SHA256SUMS
# F7b review fix (S9): see test-windows-liveness-prebuilt's identical
# step for the full rationale.
- name: Check prebuilt Windows binary loads
shell: bash
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-nocgo.test.exe" ./cmd/bd -run '^$' -count=1
- name: Run native Windows worktree removal boundary tests (prebuilt)
shell: bash
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-nocgo.test.exe" ./cmd/bd -run '^TestWorktreeRemove' -count=1
# Check documentation references match actual CLI flags
#
# Stays a job: the generated CLI docs describe the release pinned in
# docs/cli-docs.pin, and check-doc-flags.sh validates them against bd built
# from that tag (scripts/resolve-docs-bd.sh: git fetch the tag, pure-Go go
# build), attributing drift against the merge-base. Neither input can enter
# a Bazel action key: releases publish no pure-Go linux binary to pin, and
# the attribution needs the PR's base. check-doc-freshness.sh, which this
# job also ran, is //scripts/repochecks:doc_freshness_test.
#
# F7a: moved to Blacksmith for same-repo PRs/merge_group. This job's module
# cache restore step was already absent before the fold (every run cold-
# builds bd), so there is no GitHub-saved cache to lose here.
check-doc-flags:
name: Check doc flags freshness
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
# Full history so check-cli-docs-drift.sh can regenerate docs at the
# merge-base and only fail PRs for drift they actually introduced.
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Build bd
run: CGO_ENABLED=0 go build -tags gms_pure_go -o bd ./cmd/bd/
- name: Validate docs against CLI
env:
DOC_DRIFT_PATCH_OUT: ${{ runner.temp }}/cli-docs-freshness.patch
# Merge queue: a merge group has no GITHUB_BASE_REF, and without a
# diff base check-cli-docs-drift.sh fails on any drift, including
# drift already on main that the PR run attributed away, which
# would eject every queued PR. Diff against the queue's base
# commit instead (empty on pull_request: origin/$GITHUB_BASE_REF).
BD_DOCS_DIFF_BASE: ${{ github.event.merge_group.base_sha }}
run: ./scripts/check-doc-flags.sh ./bd
# When the drift check fails, it writes the exact regenerated-docs fix
# (produced with CI's canonical build) so contributors can apply it with
# `git apply` instead of reproducing CI's environment locally. The
# docs-autofix.yml workflow_run job consumes this same artifact to push
# the fix to same-repo PR branches automatically.
- name: Upload docs fix patch
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: cli-docs-freshness-patch
path: ${{ runner.temp }}/cli-docs-freshness.patch
if-no-files-found: ignore
# The Linux leg is Bazel's (ga-96smfk.20): //scripts:doc_freshness_required_test
# (integration lane: the doc-freshness suite under -required-suite) and
# //scripts/gitattributespolicy:gitattributespolicy_required_host_test
# (-required-host -expected-goos linux), both on rbe-west's Linux workers.
# The macOS and Windows legs stay here, on Blacksmith for same-repo PRs and
# merge groups (GitHub-hosted for forks and Dependabot).
#
# F7b: same-repo Blacksmith for the Linux/Windows legs via the "matrix
# marker" form (spec F7/F7b §2.1): Actions does not expand `${{ }}` inside a
# matrix array/include value, so each leg's `include` entry instead carries
# a plain string `runner` marker, and the job's `runs-on` is a single
# chained ternary (sameRepoPlatformsMatrixMarkerRunsOn in
# scripts/ci_blacksmith_runner_test.go) that resolves per-marker, falling
# back to `matrix.os` for forks/Dependabot (each marker's own same-repo
# condition false) or any leg with no marker. Every leg now restores a
# non-race Go build cache seeded by main.yml's push-to-main savers on the
# exact same runner selection (S2 below).
#
# The macOS leg moves to same-repo Blacksmith macOS
# (blacksmith-6vcpu-macos-26, Apple Silicon) like the other two legs; forks,
# Dependabot and any non-PR event keep GitHub-hosted macos-latest. The label
# is pinned to macos-26 because that is the image GitHub's macos-latest
# resolves to today (macos-26-arm64), so both paths run the same OS and
# architecture; bump it together with GitHub's macos-latest migration.
# 6 vCPU (vs. macos-latest's 3) is already 2x the GitHub-hosted leg; the
# 12 vCPU size is not justified for a leg dominated by one incremental
# ./cmd/bd test compile. This reverses F7b review fix S3 (cost accepted):
# main.yml's blacksmith-macos-go-build-cache job is the push-to-main
# Blacksmith-macOS saver S3 said was missing, on this exact label, and the
# GitHub-hosted fork path still restores main.yml's `test` job macOS leg.
check-doc-freshness-platforms:
name: Check doc freshness (${{ matrix.os }})
runs-on: ${{ matrix.runner == 'same-repo-linux' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest') || matrix.runner == 'same-repo-windows' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-windows-2025' || 'windows-latest') || matrix.runner == 'same-repo-macos' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-6vcpu-macos-26' || 'macos-latest') || matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
expected_goos: darwin
runner: same-repo-macos
- os: windows-latest
expected_goos: windows
runner: same-repo-windows
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
# F7b review fix (S2): same restore-only non-race Go build cache as
# pr-preflight-platforms above, seeded by the same push-to-main savers
# on the exact same runner selections; this job's two "go test" steps
# below compile ./scripts and ./scripts/gitattributespolicy, so they
# benefit from the same warm cache (main.yml's warm-non-race-cache.sh
# run compiles both exact packages -- F7b spec 4.2).
- name: Restore non-race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/non-race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
- name: Exercise native date and Bash process boundary
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=integration,gms_pure_go' -count=1 -run '^(TestDocFreshness.*|TestRequiredSuiteContract)$' ./scripts -args -required-suite=doc-freshness
- name: Exercise repository text EOL policy boundary
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=integration,gms_pure_go' -count=1 ./scripts/gitattributespolicy -args -required-host -expected-goos '${{ matrix.expected_goos }}'
# F7b: same-repo Blacksmith via the "matrix marker" form (see
# check-doc-freshness-platforms above for the full explanation;
# sameRepoPlatformsMatrixMarkerRunsOn in scripts/ci_blacksmith_runner_test.go
# is this same chained ternary).
#
# F7b review (S1): an earlier revision of this job split the Windows leg
# into two `shard` entries on the theory that it would turn one ~9-minute
# leg into two ~4-5 minute parallel legs. Real step-timing data from PR
# runs disproved that: shard 2 (the three Windows-only steps moved below)
# only ever holds 15-25s of work, while shard 1 still takes 450-480s, so
# the split added a second billed Blacksmith Windows runner for no
# measurable critical-path win. The actual long pole on every OS is the
# cold `cmd/bd` test compile in "Exercise generated Git hook timeout
# process boundary" (250-300s); see S2 below (the restore-non-race-cache
# step) for the fix that actually targets it. Reverted to one leg per OS.
pr-preflight-platforms:
name: PR preflight process (${{ matrix.os }})
runs-on: ${{ matrix.runner == 'same-repo-linux' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest') || matrix.runner == 'same-repo-windows' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-windows-2025' || 'windows-latest') || matrix.runner == 'same-repo-macos' && ((github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-6vcpu-macos-26' || 'macos-latest') || matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
expected_goos: linux
runner: same-repo-linux
- os: macos-latest
expected_goos: darwin
runner: same-repo-macos
- os: windows-latest
expected_goos: windows
runner: same-repo-windows
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
# F7b review (S2): restore-only non-race Go build cache, seeded by the
# push-to-main saver on the exact same runner selection (Linux:
# main.yml's blacksmith-go-build-cache non-race leg; Windows:
# main.yml's test-windows Blacksmith leg; macOS: main.yml's
# blacksmith-macos-go-build-cache on Blacksmith, the test job's macOS
# leg on the GitHub-hosted fork path) so the cold cmd/bd compile below (the real long pole,
# 250-300s uncached) gets a true cache hit instead of starting cold.
# GOCACHE must match the seeder's exactly, and CGO_ENABLED is left at
# its platform default (same as the seeder) so the key families line
# up; see mainBlacksmithGoBuildCacheRunsOn / mainVenueBlacksmithWindows4vcpuRunsOn
# in ci_workflow_test.go for the seeder side of this contract.
- name: Restore non-race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/non-race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
- name: Exercise the real Bash process boundary
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=integration,gms_pure_go' -count=1 -run '^TestPRPreflight' ./scripts
- name: Check native user config diagnostics
shell: bash
env:
CGO_ENABLED: "0"
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: bash scripts/ci/test-user-config-diagnostic.sh '${{ matrix.expected_goos }}'
- name: Exercise test.sh prebuilt binary path
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=gms_pure_go' -count=1 -run '^TestTestScriptPrebuiltBinaryContract$' ./scripts
- name: Exercise generated Git hook timeout process boundary
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=gms_pure_go' -count=1 -run '^TestGeneratedHookTimeoutProcessBoundary$' ./cmd/bd
# Plain go test's own bd build fallback (BEADS_TEST_BD_BINARY unset),
# which Bazel never takes, on every OS developers run go test on: the
# tests tools/bazel/equivalence_allowlist.txt lists as skipped under
# Bazel. Same build as the step above, so no second compile.
- name: Exercise go test's bd build fallback
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test '-tags=gms_pure_go' -count=1 -run '^(TestGOMODCACHENotUnderTestHome|TestGoBuildBDCommandIsCWDIndependent)$' ./cmd/bd
# This step recompiles ./cmd/bd's test binary. It must share the restored
# GOCACHE with the hook-timeout step above (same tags, same platform
# default CGO_ENABLED, see the script's header) so it is a relink rather
# than a second cold compile: without GOCACHE here it fell back to the
# runner's empty default cache and cold-compiled all of ./cmd/bd on every
# PR (210-240s on macos-latest, ~120s on Windows; the leg's long pole).
# TestPRPreflightPlatformsRunStepsUseRestoredGoBuildCache pins this.
- name: Exercise native init gateway credential shell
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: bash scripts/ci/test-init-gateway-credential.sh "$RUNNER_OS"
- name: Exercise credential command fixtures on Windows
if: matrix.os == 'windows-latest'
shell: pwsh
env:
CGO_ENABLED: "0"
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: |
$go = (Get-Command go -CommandType Application -ErrorAction Stop | Select-Object -First 1).Source
$hostInfo = @(& $go env GOHOSTOS GOOS)
if ($LASTEXITCODE -ne 0 -or ($hostInfo -join ',') -ne 'windows,windows') {
throw 'Credential fixtures require native Windows Go'
}
$expected = @{
'github.com/steveyegge/beads/internal/testutil/credentialcmd' = @('TestProtocol')
'github.com/steveyegge/beads/internal/creds' = @(
'TestCommandSourceRealShell', 'TestCredentialCommandFixtureProtocol')
'github.com/steveyegge/beads/internal/storage/dolt' = @(
'TestApplyGatewayCredentialCommand', 'TestApplyGatewayCredentialJSONEnvelope',
'TestApplyGatewayCredentialFailsClosed', 'TestApplyGatewayCredentialPresetWins',
'TestApplyGatewayCredentialRejectsBadCharToken', 'TestApplyResolvedConfigGatewayCredential')
}
$selector = '^(' + (($expected.Values | ForEach-Object { $_ }) -join '|') + ')$'
$raw = & $go test -json -tags gms_pure_go -count=1 -run $selector @($expected.Keys)
$testStatus = $LASTEXITCODE
$events = @($raw | ForEach-Object { $_ | ConvertFrom-Json -ErrorAction Stop })
$events | Where-Object Output | ForEach-Object { [Console]::Write($_.Output) }
if ($testStatus -ne 0) { exit $testStatus }
if (@($events | Where-Object { $_.Action -in 'fail', 'skip' }).Count -ne 0) {
throw 'Credential fixtures must pass without skips'
}
foreach ($package in $expected.Keys) {
foreach ($test in $expected[$package]) {
$passes = @($events | Where-Object {
$_.Package -eq $package -and $_.Test -eq $test -and $_.Action -eq 'pass'
})
if ($passes.Count -ne 1) { throw "Expected one PASS for $package/$test" }
}
}
- name: Check benchmark environment scrubbing
if: matrix.os == 'windows-latest'
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: go test -tags gms_pure_go -count=1 -run '^(TestCleanEnvUsesHostKeySemantics|TestBenchmarkCommandBuildersStripDoltEnvOverrides)$' ./scripts/repro-dolt-prod-timeouts
- name: Check shared environment key semantics
if: matrix.os == 'windows-latest'
shell: bash
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: bash scripts/ci/test-windows-env-helpers.sh
# D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel /
# test (`bazel test //... --config=ci`, the same selection, checked by its
# equivalence step) runs it, and nogo (//tools/nogo) runs go test's vet
# checks beside every compile of that lane.
pr-core-wrapper:
name: PR Core (wrapper timing)
runs-on: ubuntu-latest
needs: [build-artifacts, bazel-coverage]
if: needs.bazel-coverage.outputs.pr_lanes != 'true'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Go
id: setup-go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
- name: Restore Go module cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Restore race Go build cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/race
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ github.sha }}
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-
- name: Install Dolt
run: ./scripts/ci/install-dolt.sh
- name: Configure Git and Dolt identity
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@beads.test"
dolt config --global --add user.name "CI Bot"
dolt config --global --add user.email "ci@beads.test"
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ci-build-artifacts
path: ci-build-artifacts
- name: Verify build artifacts
run: |
set -euo pipefail
cd ci-build-artifacts
sha256sum -c SHA256SUMS
chmod +x bd-linux-gms-pure
- name: Run PR core wrapper
env:
BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION: '1'
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
GOCACHE: ${{ runner.temp }}/go-cache/race
run: make ci-pr-core
# F7a: fold of build-examples + complexity-report, the two pr.yml jobs that
# are advisory-only (not in ci-gate's needs/CI_GATE_REQUIRED) and restore no
# GitHub-saved build cache, onto one Blacksmith runner for same-repo
# PRs/merge_group. Both keep their pre-fold step-level
# continue-on-error/timeout-minutes design: a job-level timeout or failure
# would CANCEL or red the job, and a cancelled/red advisory check is exactly
# the blocking-by-a-different-door outcome both were written to avoid. A
# generous job-level timeout-minutes is still set, because
# TestSameRepoBlacksmithRunners requires one of every job it pins (so a
# stuck Blacksmith runner cannot spend minutes forever) - it sits comfortably
# above the sum of the step timeouts below so it is a backstop, not a
# realistic ceiling.
#
# examples/ holds separate Go modules that reach the parent through a
# `replace` directive, so their go.mod/go.sum record the parent's whole
# dependency graph and go stale whenever the root module's does. Nothing in
# CI compiled them, so that drift was invisible: on 2026-08-01 BOTH example
# modules failed a plain `go build` on main with "updates to go.mod needed".
# Examples are the first code a new user copies; this keeps them buildable.
#
# To promote the examples check to a real gate: drop its step's
# continue-on-error and warning step, then add `advisory-reports` to
# ci-gate's `needs`, `CI_GATE_REQUIRED`, and its env map.
#
# The complexity report is an advisory architecture signal; it deliberately
# does not participate in ci-gate while maintainers evaluate the baseline
# and refactoring payoff.
advisory-reports:
name: Advisory reports (examples build, complexity)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
# Review N-2 (2026-10-03): step timeouts sum to 42 min; 60 (not 45) keeps
# job setup/post overhead from turning a stacked near-timeout stall into a
# job-level cancel, which would red this advisory check through "another
# door" instead of the step that actually stalled.
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
id: checkout
continue-on-error: true
timeout-minutes: 5
with:
# complexity.sh diffs against origin/main; examples/ does not need
# history but shares this checkout.
fetch-depth: 0
- name: Set up Go
id: setup-go
continue-on-error: true
timeout-minutes: 5
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
# The examples' dependency graph is the parent module's (via the
# `replace` directive), so the repo-wide module cache key is a
# near-perfect hit; without it this job cold-downloads the whole
# dolt-sized graph on every PR.
- name: Restore Go module cache
continue-on-error: true
timeout-minutes: 5
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Type-check every module under examples/
id: build-examples
if: steps.checkout.outcome == 'success' && steps.setup-go.outcome == 'success'
continue-on-error: true
timeout-minutes: 10
run: ./scripts/build-examples.sh
- name: Warn when example modules are stale or fail to build
if: steps.build-examples.outcome == 'failure'
run: |
echo "::warning title=Example modules out of date::examples/ failed to type-check against this tree. Run 'go mod tidy' in each module under examples/ (see scripts/build-examples.sh output above). Advisory only; this does not block the merge."
- name: Warn when the examples build could not run at all
if: steps.checkout.outcome != 'success' || steps.setup-go.outcome != 'success'
run: |
echo "::warning title=Example build check skipped::checkout or Go setup failed, so examples/ could not be checked this run (checkout: ${{ steps.checkout.outcome }}, setup-go: ${{ steps.setup-go.outcome }}). Advisory only; this does not block the merge."
- name: Install gocyclo
timeout-minutes: 5
continue-on-error: true
run: go install github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0
- name: Generate complexity report
id: generate-complexity
if: always()
timeout-minutes: 8
continue-on-error: true
run: |
set +e
COMPLEXITY_BASE_REF=origin/main ./scripts/ci/complexity.sh diff > complexity-report.txt 2>&1
status=$?
if [ "$status" -ne 0 ]; then
echo "complexity report unavailable (exit $status); see log above" >> complexity-report.txt
fi
exit 0
- name: Annotate unavailable complexity report
if: always()
timeout-minutes: 1
continue-on-error: true
run: |
if [ ! -s complexity-report.txt ] || grep -q 'complexity report unavailable' complexity-report.txt; then
echo "::warning title=Complexity report unavailable::Advisory complexity analysis did not complete; inspect the artifact or job log."
fi
- name: Upload complexity report
if: always()
timeout-minutes: 3
continue-on-error: true
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: complexity-report
path: complexity-report.txt
retention-days: 7
if-no-files-found: error
# `test-macos` / "Test (macos-latest)" used to run here and is deliberately
# removed (F4, PR CI -> 5 min). It was a non-required, PR-side mirror of
# main.yml's `test` job's macOS leg (full `go test -race -short ./...`),
# added after the 2026-08-01 incident where three separately-merged PRs each
# introduced a $TMPDIR=/var/folders regression that only reproduces on
# macOS and that main.yml's leg -- `if: github.event_name == 'push' &&
# github.ref == 'refs/heads/main'`, i.e. push-to-main only -- could not have
# caught pre-merge.
#
# Removing it is an accepted tradeoff, not a coverage-neutral cleanup:
# required merge-gate coverage is unaffected (this job was never in
# ci-gate's needs/CI_GATE_REQUIRED), but PRs lose the one pre-merge signal
# for macOS-only `go test -race ./...` regressions of this kind; such a
# regression can land on main again and will only be caught by main.yml's
# push-triggered leg, after the fact. The other macOS matrix legs left in
# this file (check-doc-freshness-platforms, pr-preflight-platforms) run on
# every PR but exercise narrow, specific scripts, not the full suite, so
# they are not a substitute. If this tradeoff turns out to be wrong,
# reinstate a PR-side mirror rather than relying on main.yml alone.
# F7a: fold of a 3-host matrix (native, msys2, cygwin) into one sequential
# job on a single windows-latest runner. Review SF-1 (2026-10-03): only the
# Cygwin *setup* step keeps `continue-on-error: true` (a flaky installer
# download is infrastructure noise, not a code failure). The native and
# msys2 install/exercise steps and the Cygwin *exercise* step carry no
# continue-on-error, so a genuine failure in any of them already fails the
# job on its own - no hand-written aggregator step needed. Each of those
# steps keeps `if: ${{ !cancelled() }}` (plus a check that its own leg's
# setup succeeded) so a failure in one leg does not stop the later legs
# from attempting to run - the fail-fast: false behavior the matrix used to
# give for free. windows-make-shell is not a Windows job F4 touches (it
# does not intersect test-windows-liveness, worktree-remove-windows, the
# preflight/doc-freshness matrices, or the twins).
# F7b: same-repo Blacksmith (blacksmith-4vcpu-windows-2025).
#
# RISK (unverified from this sandbox, flagged in the F7b report): the
# native-Make step below assumes Chocolatey is preinstalled (`choco
# install ...`), as it is on GitHub's windows-latest image. Blacksmith's
# windows-2025 image is documented as GitHub's windows-2025 minus the full
# Visual Studio IDE/EdgeDriver/WinAppDriver; Chocolatey is a base-image
# tool unrelated to those, so it is expected to still be present, but this
# is not independently confirmed. The msys2/setup-msys2 and
# cygwin/cygwin-install-action steps download their own tooling and do not
# depend on any preinstalled image contents, so they carry no equivalent
# risk. The fork-PR path (windows-latest) remains an always-on canary; if
# only the same-repo leg's native-Make step fails here, that is the gap to
# roll back on (revert this runs-on line to the literal `windows-latest`).
windows-make-shell:
name: Windows Make shell (native, msys2, cygwin)
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
# F7b review fix (S9): print the preinstalled tool versions this job
# depends on before relying on them, so a Blacksmith image gap (see the
# RISK comment above) surfaces here instead of failing deep in a later
# step with an opaque "command not found".
- name: Check Windows tooling diagnostics
shell: pwsh
run: |
Write-Output "::group::choco"
choco --version
Write-Output "::endgroup::"
Write-Output "::group::go env (CGO_ENABLED, CC)"
go env CGO_ENABLED CC
Write-Output "::endgroup::"
- name: Install native GNU Make
id: install-native
if: ${{ !cancelled() }}
shell: pwsh
run: choco install make --version=4.4.1 --yes --no-progress
# F7b review fix (B1): msys2/setup-msys2 caches its installed packages
# by default (action.yml: cache.default = true), which means this step
# would SAVE an actions/cache entry from a same-repo PR the moment it
# moved onto a Blacksmith runner -- confirmed via a real GitHub cache
# list entry (msys2-pkgs-upd:false-conf:...) with a
# refs/pull/.../merge ref. `runner.environment == 'github-hosted'`
# disables that implicit save on Blacksmith (fail-closed: only the
# literal "github-hosted" value keeps caching on, matching the
# fail-closed convention F7c review fix N1 set for actions/setup-go's
# own `cache` input) while leaving the always-on fork-PR
# (windows-latest) leg's caching behavior unchanged. Pinned by
# TestBlacksmithReachablePRJobsDisableDefaultCachingActions.
- name: Set up MSYS2 GNU Make
id: install-msys2
if: ${{ !cancelled() }}
timeout-minutes: 10
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
with:
msystem: MSYS
install: git make
path-type: minimal
cache: ${{ runner.environment == 'github-hosted' }}
- name: Set up Cygwin GNU Make
if: ${{ !cancelled() }}
id: cygwin
# cygwin-install-action downloads setup-x86_64.exe from cygwin.com. That
# download times out often enough to red the required check for a reason
# unrelated to the change under test. Treat a setup failure as a
# (non-blocking) warning: the smoke step below is gated on this step
# succeeding, so a genuine Cygwin Make regression still fails loudly,
# while a flaky installer download only skips the leg with a warning.
# Review SF-2 (2026-10-03): a 10-minute step timeout caps how long a
# hung download can block the native/msys2 legs' exercise steps
# behind it, instead of consuming the whole 30-minute job timeout.
continue-on-error: true
timeout-minutes: 10
uses: cygwin/cygwin-install-action@3f0a3f9f988f7e96b8c18098ae05eaec175f5b52 # v6
with:
packages: git make
add-to-path: 'false'
- name: Warn when Cygwin setup was skipped by a download failure
if: ${{ !cancelled() && steps.cygwin.outcome == 'failure' }}
shell: bash
run: |
echo "::warning title=Cygwin Make-shell leg skipped::cygwin-install-action could not download the Cygwin installer (network flake); skipping the Cygwin-hosted Make smoke test. This is an infrastructure failure, not a code failure."
- name: Exercise native Windows Make
id: native
if: ${{ !cancelled() && steps.install-native.outcome == 'success' }}
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$make = (Get-Command make.exe -ErrorAction Stop).Source
$hostOutput = & $make --no-print-directory -f NUL --eval '$(info MAKE_HOST=$(MAKE_HOST))' --eval 'noop:;' noop
$makeHost = (($hostOutput | Where-Object { $_ -like 'MAKE_HOST=*' }) -replace '^MAKE_HOST=', '').Trim()
if ($LASTEXITCODE -ne 0 -or ($makeHost -ne 'Windows32' -and $makeHost -notmatch '-mingw32$')) {
throw "Expected native Windows GNU Make, found '$makeHost' at '$make'"
}
$git = (Get-Command git.exe -ErrorAction Stop).Source
if ($git -notmatch ' ') {
throw "Expected the hosted Git for Windows path to contain a space, found '$git'"
}
$profile = Join-Path $env:RUNNER_TEMP 'profile with spaces'
New-Item -ItemType Directory -Force -Path $profile | Out-Null
$poison = Join-Path $profile 'poison bash env.sh'
Set-Content -LiteralPath $poison -Encoding utf8 -Value 'exit 97'
$env:USERPROFILE = $profile
$env:BASH_ENV = $poison
$env:BASHOPTS = 'failglob'
$env:SHELLOPTS = 'nounset'
$env:GIT_EXEC_PATH = Join-Path $profile 'missing git exec path'
$env:PATH = "$(Split-Path $git);$env:SystemRoot\System32"
& $make --no-print-directory help | Out-Null
if ($LASTEXITCODE -ne 0) {
throw 'Native Make failed while parsing or running help'
}
@'
include Makefile
.RECIPEPREFIX := >
.PHONY: windows-make-shell-smoke
windows-make-shell-smoke:
>@case "$(SHELL)" in */bin/bash.exe) ;; *) exit 1;; esac
>@test -n "$$BASH_VERSION"
>@test "$$(command -v sed)" = /usr/bin/sed
>@test "$$(command -v env)" = /usr/bin/env
>@test -z "$${BASH_ENV+x}"
>@case "$$-" in *u*) exit 1;; esac
>@shopt -q failglob && exit 1 || :
>@test -z "$${GIT_EXEC_PATH+x}"
>@env printf '%s\n' 'native Windows Make shell smoke passed'
'@ | & $make --no-print-directory -f - windows-make-shell-smoke
if ($LASTEXITCODE -ne 0) {
throw 'Native Make shell smoke failed'
}
function Get-TreeManifest {
param([Parameter(Mandatory)][string]$Root)
@(
Get-ChildItem -LiteralPath $Root -Recurse -Force | ForEach-Object {
$relative = [IO.Path]::GetRelativePath($Root, $_.FullName).Replace('\', '/')
if ($_.PSIsContainer) {
"D $relative"
} else {
$hash = (Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash
"F $relative $hash"
}
}
) | Sort-Object
}
$proofRoot = Join-Path $env:RUNNER_TEMP ("make install proof " + [guid]::NewGuid().ToString('N'))
$fixtureRepo = Join-Path $proofRoot 'fixture repo'
$buildDir = Join-Path $fixtureRepo 'build output'
$fakeGoDir = Join-Path $proofRoot 'fake go bin'
$installRoot = Join-Path $proofRoot 'install sandbox'
$installProfile = Join-Path $installRoot 'profile with spaces'
New-Item -ItemType Directory -Force -Path $buildDir, $fakeGoDir, $installProfile | Out-Null
Copy-Item -LiteralPath (Join-Path $env:GITHUB_WORKSPACE 'Makefile') -Destination $fixtureRepo
Copy-Item -LiteralPath (Join-Path $env:GITHUB_WORKSPACE 'go.mod') -Destination $fixtureRepo
$sentinel = Join-Path $buildDir 'bd.exe'
$fakeGo = Join-Path $fakeGoDir 'go'
$fakeGoScript = @'
#!/usr/bin/env bash
set -euo pipefail
[[ "${1-}" == build ]] || exit 91
shift
output=
while (($#)); do
case "$1" in
-o)
[[ $# -ge 2 ]] || exit 92
output=$2
shift 2
;;
*) shift ;;
esac
done
[[ "$(cygpath -aw "$output")" == "$(cygpath -aw "$BEADS_FAKE_GO_EXPECTED_OUTPUT")" ]] || {
printf 'fake go received output %q, expected %q\n' "$output" "$BEADS_FAKE_GO_EXPECTED_OUTPUT" >&2
exit 93
}
printf native-build-sentinel > "$(cygpath -u "$output")"
'@
if (-not $fakeGoScript.StartsWith('#!', [StringComparison]::Ordinal)) {
throw 'Fake Go shebang must start at byte zero after YAML extraction'
}
[IO.File]::WriteAllText(
$fakeGo,
($fakeGoScript -replace "`r`n", "`n"),
[Text.UTF8Encoding]::new($false)
)
$priorPath = $env:PATH
Push-Location $fixtureRepo
try {
$env:BEADS_FAKE_GO_EXPECTED_OUTPUT = $sentinel
$env:PATH = "$fakeGoDir;$priorPath"
& $make --no-print-directory "BUILD_DIR=$buildDir" GIT_BUILD=build-proof CC=proof build
if ($LASTEXITCODE -ne 0) {
throw 'Native Make build failed for a spaced BUILD_DIR'
}
} finally {
$env:PATH = $priorPath
Remove-Item -LiteralPath Env:BEADS_FAKE_GO_EXPECTED_OUTPUT
Pop-Location
}
if (-not (Test-Path -LiteralPath $sentinel -PathType Leaf)) {
throw "Native Make did not build bd.exe at the exact spaced destination '$sentinel'"
}
$sentinelHash = (Get-FileHash -LiteralPath $sentinel -Algorithm SHA256).Hash
& $git -C $fixtureRepo init --quiet
& $git -C $fixtureRepo config core.hooksPath .githooks
if ($LASTEXITCODE -ne 0) {
throw 'Could not initialize the isolated install fixture repository'
}
& $git -C $fixtureRepo -c user.name=install-proof -c user.email=install-proof@example.invalid `
-c commit.gpgsign=false commit --allow-empty --quiet -m 'Initialize install proof'
if ($LASTEXITCODE -ne 0) {
throw 'Could not commit the isolated install fixture repository'
}
$fixtureBefore = @(Get-TreeManifest -Root $fixtureRepo)
$env:USERPROFILE = $installProfile
Push-Location $fixtureRepo
try {
& $make --no-print-directory -o build "BUILD_DIR=$buildDir" GIT_BUILD=install-proof install-force
if ($LASTEXITCODE -ne 0) {
throw 'Native Make install-force failed for a spaced USERPROFILE'
}
} finally {
Pop-Location
}
$installed = Join-Path $installProfile '.local\bin\bd.exe'
if (-not (Test-Path -LiteralPath $installed -PathType Leaf)) {
throw "Native Make did not install bd.exe at the exact destination '$installed'"
}
if ((Get-FileHash -LiteralPath $installed -Algorithm SHA256).Hash -ne $sentinelHash) {
throw 'Native Make installed bd.exe with unexpected contents'
}
$expectedFirstInstall = @(
'D profile with spaces'
'D profile with spaces/.local'
'D profile with spaces/.local/bin'
"F profile with spaces/.local/bin/bd.exe $sentinelHash"
) | Sort-Object
$actualFirstInstall = @(Get-TreeManifest -Root $installRoot)
if (Compare-Object -ReferenceObject $expectedFirstInstall -DifferenceObject $actualFirstInstall) {
throw "Native Make changed paths outside the exact first install destination:`n$($actualFirstInstall -join "`n")"
}
$fixtureAfterFirstInstall = @(Get-TreeManifest -Root $fixtureRepo)
if (Compare-Object -ReferenceObject $fixtureBefore -DifferenceObject $fixtureAfterFirstInstall) {
throw 'Native Make split the spaced first-install path or otherwise mutated the fixture repository'
}
$legacyAlias = Join-Path $installProfile '.local\bin\BD'
Set-Content -LiteralPath $legacyAlias -Encoding ascii -NoNewline -Value 'legacy-extensionless-alias'
$installBeforeFailedReplacement = @(Get-TreeManifest -Root $installRoot)
$fixtureBeforeFailedReplacement = @(Get-TreeManifest -Root $fixtureRepo)
$missingBuildDir = Join-Path $fixtureRepo 'missing build output'
if (Test-Path -LiteralPath $missingBuildDir) {
throw "Failure-injection source unexpectedly exists: '$missingBuildDir'"
}
Push-Location $fixtureRepo
try {
& $make --no-print-directory -o build "BUILD_DIR=$missingBuildDir" GIT_BUILD=install-proof install-force
if ($LASTEXITCODE -eq 0) {
throw 'Native Make replacement unexpectedly succeeded without a source bd.exe'
}
} finally {
Pop-Location
}
$installAfterFailedReplacement = @(Get-TreeManifest -Root $installRoot)
if (Compare-Object -ReferenceObject $installBeforeFailedReplacement -DifferenceObject $installAfterFailedReplacement) {
throw "Failed native Make replacement changed the live install tree:`n$($installAfterFailedReplacement -join "`n")"
}
$fixtureAfterFailedReplacement = @(Get-TreeManifest -Root $fixtureRepo)
if (Compare-Object -ReferenceObject $fixtureBeforeFailedReplacement -DifferenceObject $fixtureAfterFailedReplacement) {
throw 'Failed native Make replacement mutated the fixture repository'
}
Set-Content -LiteralPath $sentinel -Encoding ascii -NoNewline -Value 'native-install-sentinel-v2'
$replacementHash = (Get-FileHash -LiteralPath $sentinel -Algorithm SHA256).Hash
$fixtureBeforeReplacement = @(Get-TreeManifest -Root $fixtureRepo)
Push-Location $fixtureRepo
try {
& $make --no-print-directory -o build "BUILD_DIR=$buildDir" GIT_BUILD=install-proof install-force
if ($LASTEXITCODE -ne 0) {
throw 'Native Make replacement install-force failed with a case-variant legacy alias'
}
} finally {
Pop-Location
}
if (Test-Path -LiteralPath $legacyAlias) {
throw "Native Make left the case-variant legacy alias '$legacyAlias'"
}
if (-not (Test-Path -LiteralPath $installed -PathType Leaf)) {
throw "Native Make replacement left no bd.exe at '$installed'"
}
if ((Get-FileHash -LiteralPath $installed -Algorithm SHA256).Hash -ne $replacementHash) {
throw 'Native Make replacement installed bd.exe with unexpected contents'
}
$expectedReplacement = @(
'D profile with spaces'
'D profile with spaces/.local'
'D profile with spaces/.local/bin'
"F profile with spaces/.local/bin/bd.exe $replacementHash"
) | Sort-Object
$actualReplacement = @(Get-TreeManifest -Root $installRoot)
if (Compare-Object -ReferenceObject $expectedReplacement -DifferenceObject $actualReplacement) {
throw "Native Make replacement changed paths outside the exact install destination:`n$($actualReplacement -join "`n")"
}
$fixtureAfterReplacement = @(Get-TreeManifest -Root $fixtureRepo)
if (Compare-Object -ReferenceObject $fixtureBeforeReplacement -DifferenceObject $fixtureAfterReplacement) {
throw 'Native Make split the spaced replacement path or otherwise mutated the fixture repository'
}
$junctionRoot = Join-Path $proofRoot 'junction install sandbox'
$junctionProfile = Join-Path $junctionRoot 'profile with spaces'
$junctionParent = Join-Path $junctionProfile '.local'
$junctionTarget = Join-Path $junctionRoot 'bin target with spaces'
New-Item -ItemType Directory -Force -Path $junctionParent, $junctionTarget | Out-Null
$junctionBin = Join-Path $junctionParent 'bin'
New-Item -ItemType Junction -Path $junctionBin -Target $junctionTarget | Out-Null
$junctionLegacyAlias = Join-Path $junctionTarget 'bd'
Set-Content -LiteralPath $junctionLegacyAlias -Encoding ascii -NoNewline -Value 'junction-legacy-alias'
Set-Content -LiteralPath $sentinel -Encoding ascii -NoNewline -Value 'native-install-sentinel-v3'
$junctionHash = (Get-FileHash -LiteralPath $sentinel -Algorithm SHA256).Hash
$fixtureBeforeJunctionInstall = @(Get-TreeManifest -Root $fixtureRepo)
$env:USERPROFILE = $junctionProfile
Push-Location $fixtureRepo
try {
& $make --no-print-directory -o build "BUILD_DIR=$buildDir" GIT_BUILD=install-proof install-force
if ($LASTEXITCODE -ne 0) {
throw 'Native Make install-force failed through a junction install directory'
}
} finally {
Pop-Location
}
if (Test-Path -LiteralPath $junctionLegacyAlias) {
throw "Native Make left the legacy alias behind the install junction '$junctionLegacyAlias'"
}
$junctionInstalled = Join-Path $junctionTarget 'bd.exe'
$junctionVisibleInstalled = Join-Path $junctionBin 'bd.exe'
foreach ($path in @($junctionInstalled, $junctionVisibleInstalled)) {
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
throw "Native Make junction install left no bd.exe at '$path'"
}
if ((Get-FileHash -LiteralPath $path -Algorithm SHA256).Hash -ne $junctionHash) {
throw "Native Make junction install wrote unexpected contents at '$path'"
}
}
$expectedJunctionTarget = @("F bd.exe $junctionHash")
$actualJunctionTarget = @(Get-TreeManifest -Root $junctionTarget)
if (Compare-Object -ReferenceObject $expectedJunctionTarget -DifferenceObject $actualJunctionTarget) {
throw "Native Make junction install left unexpected target entries:`n$($actualJunctionTarget -join "`n")"
}
$fixtureAfterJunctionInstall = @(Get-TreeManifest -Root $fixtureRepo)
if (Compare-Object -ReferenceObject $fixtureBeforeJunctionInstall -DifferenceObject $fixtureAfterJunctionInstall) {
throw 'Native Make junction install mutated the fixture repository'
}
$directoryAlias = Join-Path $installProfile '.local/bin/BD'
New-Item -ItemType Directory -Path $directoryAlias | Out-Null
$directorySentinel = Join-Path $directoryAlias 'keep.txt'
Set-Content -LiteralPath $directorySentinel -Encoding ascii -NoNewline -Value 'preserve-bd-directory'
$directorySentinelHash = (Get-FileHash -LiteralPath $directorySentinel -Algorithm SHA256).Hash
Set-Content -LiteralPath $sentinel -Encoding ascii -NoNewline -Value 'native-install-sentinel-v4'
$directoryInstallHash = (Get-FileHash -LiteralPath $sentinel -Algorithm SHA256).Hash
$fixtureBeforeDirectoryInstall = @(Get-TreeManifest -Root $fixtureRepo)
$env:USERPROFILE = $installProfile
Push-Location $fixtureRepo
try {
& $make --no-print-directory -o build "BUILD_DIR=$buildDir" GIT_BUILD=install-proof install-force
if ($LASTEXITCODE -ne 0) {
throw 'Native Make install-force failed with a directory named BD'
}
} finally {
Pop-Location
}
$expectedDirectoryInstall = @(
'D profile with spaces'
'D profile with spaces/.local'
'D profile with spaces/.local/bin'
'D profile with spaces/.local/bin/BD'
"F profile with spaces/.local/bin/BD/keep.txt $directorySentinelHash"
"F profile with spaces/.local/bin/bd.exe $directoryInstallHash"
) | Sort-Object
$actualDirectoryInstall = @(Get-TreeManifest -Root $installRoot)
if (Compare-Object -ReferenceObject $expectedDirectoryInstall -DifferenceObject $actualDirectoryInstall) {
throw "Native Make changed the preserved BD directory or install tree:`n$($actualDirectoryInstall -join "`n")"
}
$fixtureAfterDirectoryInstall = @(Get-TreeManifest -Root $fixtureRepo)
if (Compare-Object -ReferenceObject $fixtureBeforeDirectoryInstall -DifferenceObject $fixtureAfterDirectoryInstall) {
throw 'Native Make install with a BD directory mutated the fixture repository'
}
Write-Output 'Native Make install proof passed: first install, failed copy, case-variant alias, junction, preserved BD directory'
- name: Exercise MSYS2-hosted Make
id: msys2
if: ${{ !cancelled() && steps.install-msys2.outcome == 'success' }}
shell: msys2 {0}
run: |
set -euo pipefail
make_host="$(
make --no-print-directory -f /dev/null \
--eval '$(info $(MAKE_HOST))' \
--eval 'noop:;' noop |
sed -n '1p'
)"
case "$make_host" in
*-msys|*-cygwin) ;;
*) echo "Expected a POSIX-hosted MSYS2 GNU Make, found '$make_host'" >&2; exit 1 ;;
esac
profile="$(cygpath -u "$RUNNER_TEMP")/profile with spaces"
mkdir -p "$profile"
bash_env="$profile/compat bash env.sh"
printf '%s\n' 'exit 97' > "$bash_env"
export BASH_ENV="$bash_env"
export GIT_EXEC_PATH="$profile/missing git exec path"
export PATH=/usr/bin
make --no-print-directory help >/dev/null
cat > "$profile/smoke.mk" <<'MAKE_EOF'
include Makefile
.RECIPEPREFIX := >
.PHONY: windows-make-shell-smoke
windows-make-shell-smoke:
>@case "$(SHELL)" in */sh) ;; *) exit 1;; esac
>@test -n "$$BASH_VERSION"
>@test "$$(command -v sed)" = /usr/bin/sed
>@test "$$(command -v env)" = /usr/bin/env
>@test -f "$$BASH_ENV"
>@test -n "$$GIT_EXEC_PATH"
>@case "$$PATH" in *';'*) exit 1;; esac
>@env printf '%s\n' 'MSYS2 Make shell smoke passed'
MAKE_EOF
make --no-print-directory -f "$profile/smoke.mk" windows-make-shell-smoke
- name: Exercise Cygwin-hosted Make
id: cygwin-test
# Only run when the Cygwin toolchain actually installed; a skipped install
# (download flake) leaves this leg un-exercised rather than failing on a
# missing bash. A real install success followed by a Make regression here
# still fails the job as before.
if: ${{ !cancelled() && steps.cygwin.outcome == 'success' }}
shell: pwsh
env:
CYGWIN_ROOT: ${{ steps.cygwin.outputs.root }}
run: |
$ErrorActionPreference = 'Stop'
$bash = Join-Path $env:CYGWIN_ROOT 'bin\bash.exe'
$script = @'
set -euo pipefail
export PATH=/usr/bin
cd "$(cygpath -u "$GITHUB_WORKSPACE")"
make_host="$(
make --no-print-directory -f /dev/null \
--eval '$(info $(MAKE_HOST))' \
--eval 'noop:;' noop |
sed -n '1p'
)"
case "$make_host" in
*-cygwin) ;;
*) echo "Expected Cygwin GNU Make, found '$make_host'" >&2; exit 1 ;;
esac
profile="$(mktemp -d)"
trap 'rm -rf -- "$profile"' EXIT
bash_env="$profile/cygwin bash env.sh"
printf '%s\n' 'exit 97' > "$bash_env"
export BASH_ENV="$bash_env"
export GIT_EXEC_PATH="$profile/missing git exec path"
make --no-print-directory help >/dev/null
cat > "$profile/smoke.mk" <<'MAKE_EOF'
include Makefile
.RECIPEPREFIX := >
.PHONY: windows-make-shell-smoke
windows-make-shell-smoke:
>@case "$(SHELL)" in */sh) ;; *) exit 1;; esac
>@test -n "$$BASH_VERSION"
>@test "$$(command -v sed)" = /usr/bin/sed
>@test "$$(command -v env)" = /usr/bin/env
>@test -f "$$BASH_ENV"
>@test -n "$$GIT_EXEC_PATH"
>@case "$$PATH" in *';'*) exit 1;; esac
>@env printf '%s\n' 'Cygwin Make shell smoke passed'
MAKE_EOF
make --no-print-directory -f "$profile/smoke.mk" windows-make-shell-smoke
'@
$script = $script.Replace("`r`n", "`n")
& $bash --noprofile --norc -c $script
if ($LASTEXITCODE -ne 0) {
throw 'Cygwin Make shell smoke failed'
}
# The Bazel lane (bazel.yml), gated alongside the legacy jobs it mirrors
# (PR Core, build-artifacts, the pure-Go/js-wasm check, and
# pr-risk.yml's embedded-Dolt, proxied-server and
# server-Dolt storage tiers), all of which stay required ids, but stand
# down on same-repo PRs with a non-Dependabot actor, and on merge groups,
# while their D2 flag is "true" (bazel-coverage): pr-risk.yml's embedded-Dolt test jobs
# (BAZEL_RETIRES_LEGACY_EMBEDDED, step 1), its proxied-server and
# server-Dolt storage test jobs (BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS,
# step 2), and this workflow's PR Core, build-artifacts and pure-Go/js-wasm
# jobs (BAZEL_RETIRES_LEGACY_PR_LANES, step 3). ci-gate then requires this call's lanes for them (embedded;
# proxied and server-storage; test, pure and doltserver) to have run
# remotely and passed. bazel.yml has no pull_request/merge_group trigger
# of its own: this call is its only PR run. It gets the four RBE secrets
# and nothing else; its rbe job decides remote, cache (forks, Dependabot:
# local execution with the anonymous read-only cache, no embedded,
# proxied or server-storage lane) or skip, and exports that for ci-gate.
# Its bazel-integration lane (main.yml's integration jobs, which run only
# on push to main) is on and required here in modes remote and cache:
# same-repo PRs and merge groups run it remotely, fork and Dependabot PRs
# locally with the read-only cache. Test results are cached: a PR or
# merge group re-runs only tests whose inputs changed (nightly re-runs
# everything; .bazelrc test:fresh). Its bd artifact is renamed
# (bazel-ci-build-artifacts) so it cannot collide with build-artifacts'
# upload. F3: the package gates build their own bd (via this call's rbe
# job) and do not consume this artifact; it is kept for the F3.5.3
# SHA256SUMS comparison and for debugging.
bazel:
name: Bazel
permissions:
contents: read
uses: ./.github/workflows/bazel.yml
secrets:
RBE_WEST_EXECUTOR: ${{ secrets.RBE_WEST_EXECUTOR }}
RBE_TLS_CERT: ${{ secrets.RBE_TLS_CERT }}
RBE_TLS_KEY: ${{ secrets.RBE_TLS_KEY }}
RBE_TLS_CA: ${{ secrets.RBE_TLS_CA }}
RBE_POOL_APP_PRIVATE_KEY: ${{ secrets.RBE_POOL_APP_PRIVATE_KEY }}
with:
build-artifact-name: bazel-ci-build-artifacts
integration: "on"
# Must equal BAZEL_CMD_DOLT_REQUIRED (top of this file; policy-tested):
# true leaves //cmd/bd:bd_test to the then-required bazel-cmd-dolt.
cmd-dolt-required: true
# F3: only pr.yml opts in; the package-mcp/package-npm jobs run inside
# this call, needing only its rbe job.
package-gates: "on"
# D2: pr-risk.yml's bazel-coverage job, verbatim (policy-tested
# identical). Where it says a tier is covered, PR Risk skips that tier's
# legacy test jobs (embedded, dolt_server), or this workflow skips its own
# (pr_lanes: build-artifacts, PR Core, the pure-Go/js-wasm check), so
# ci-gate requires the tier's Bazel lanes to have run remotely and passed
# in this run.
bazel-coverage:
name: Bazel tier coverage
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
# Dependabot and any other event stay GitHub-hosted. This job restores no
# GitHub-saved cache, so Blacksmith's inability to see one does not cost
# it anything. Must stay byte-identical to pr-risk.yml's copy
# (TestPRRiskBazelCoverageJob) and to the TestSameRepoBlacksmithRunners
# pin.
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
timeout-minutes: 5
outputs:
embedded: ${{ steps.decide.outputs.embedded }}
dolt_server: ${{ steps.decide.outputs.dolt_server }}
pr_lanes: ${{ steps.decide.outputs.pr_lanes }}
steps:
# GitHub's == is case-insensitive. FORK is bazel.yml's rbe job's
# expression, verbatim. Nothing mutable is read: not RBE_WEST_WORKERS
# and not the executor secret (either, evaluated per run, would let one
# workflow's re-run disagree with the other's). A same-repo PR whose run
# lacks the secret is covered anyway, so pr.yml's gate goes red (mode
# cache) instead of a tier silently moving back. Fork and Dependabot
# runs get no Actions secrets by design: they are covered only while
# BAZEL_COVERS_FORKS is "true" (rbe-fork gives their lanes remote
# execution), and then a closed rbe-fork turns them red the same way;
# it never moves them back to a legacy tier silently. github.actor
# (unlike triggering_actor) stays the PR's actor on a re-run.
- name: Decide which legacy tiers the Bazel lanes cover
id: decide
env:
RETIRED_EMBEDDED: ${{ env.BAZEL_RETIRES_LEGACY_EMBEDDED == 'true' }}
RETIRED_DOLT_SERVER: ${{ env.BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS == 'true' }}
RETIRED_PR_LANES: ${{ env.BAZEL_RETIRES_LEGACY_PR_LANES == 'true' }}
COVERS_FORKS: ${{ env.BAZEL_COVERS_FORKS == 'true' }}
PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
MERGE_GROUP: ${{ github.event_name == 'merge_group' }}
FORK: ${{ github.event.pull_request.head.repo.fork == true }}
DEPENDABOT: ${{ github.actor == 'dependabot[bot]' }}
run: |
for v in RETIRED_EMBEDDED RETIRED_DOLT_SERVER RETIRED_PR_LANES COVERS_FORKS PULL_REQUEST MERGE_GROUP FORK DEPENDABOT; do
case "${!v}" in
true|false) ;;
*) echo "::error::$v is '${!v}', want true or false"; exit 1 ;;
esac
done
# Covered: the Bazel lanes are this run's only run of the retired
# tiers. Same-repo PRs (the CI secrets); fork and Dependabot PRs
# too while BAZEL_COVERS_FORKS is "true"; and every merge group: it
# runs on the queue's gh-readonly-queue/* branch of this repository
# with the CI secrets, its actor is github-merge-queue[bot] (never
# Dependabot), and bazel.yml's rbe job takes mode remote for it
# like for a same-repo PR, so a missing secret or the farm switch
# off turns pr.yml's gate red rather than dropping a tier.
covered=false
if [ "$MERGE_GROUP" = true ]; then
covered=true
elif [ "$PULL_REQUEST" = true ]; then
if [ "$FORK" = false ] && [ "$DEPENDABOT" = false ]; then
covered=true
elif [ "$COVERS_FORKS" = true ]; then
covered=true
fi
fi
embedded=false
if [ "$covered" = true ] && [ "$RETIRED_EMBEDDED" = true ]; then
embedded=true
fi
dolt_server=false
if [ "$covered" = true ] && [ "$RETIRED_DOLT_SERVER" = true ]; then
dolt_server=true
fi
pr_lanes=false
if [ "$covered" = true ] && [ "$RETIRED_PR_LANES" = true ]; then
pr_lanes=true
fi
{
echo "embedded=$embedded"
echo "dolt_server=$dolt_server"
echo "pr_lanes=$pr_lanes"
} >> "$GITHUB_OUTPUT"
echo "Legacy tiers retired in favour of the Bazel lanes: embedded Dolt **$embedded**, proxied and server Dolt **$dolt_server**, pr.yml's PR Core/build/pure-Go/domain+uow/contract jobs **$pr_lanes** (pull_request: $PULL_REQUEST, merge_group: $MERGE_GROUP, fork: $FORK, dependabot: $DEPENDABOT, forks covered: $COVERS_FORKS, retired embedded: $RETIRED_EMBEDDED, retired proxied/server: $RETIRED_DOLT_SERVER, retired pr.yml jobs: $RETIRED_PR_LANES)" | tee -a "$GITHUB_STEP_SUMMARY"
ci-gate:
name: CI Gate / Required
# F3: same-repo PRs and merge_group get the org's Blacksmith pool; forks,
# Dependabot and any other event stay GitHub-hosted. This job restores no
# GitHub-saved cache. Must match the TestSameRepoBlacksmithRunners pin;
# the gate's NAME must never change (ruleset requires exactly "CI Gate /
# Required").
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}
# F3: now on Blacksmith for same-repo PRs; a hang used to burn only the
# default 360 minutes of a free GitHub-hosted runner, now Blacksmith
# minutes too.
timeout-minutes: 10
needs:
- build-artifacts
- fast-checks
- check-cmd-bd-puregeo-tests
- test-windows-liveness
- worktree-remove-windows
- test-windows-liveness-prebuilt
- worktree-remove-windows-prebuilt
- check-doc-flags
- check-doc-freshness-platforms
- pr-preflight-platforms
- pr-core-wrapper
- windows-make-shell
- bazel
- bazel-coverage
if: ${{ always() }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Evaluate CI gate
env:
CI_GATE_NAME: PR baseline gate
CI_GATE_REQUIRED: >-
BUILD_ARTIFACTS
FAST_CHECKS
CHECK_MIGRATION_HYGIENE
CHECK_NO_BEADS_CHANGES
CHECK_CMD_BD_PUREGEO_TESTS
CHECK_DOC_FLAGS
CHECK_DOC_FRESHNESS_PLATFORMS
PR_PREFLIGHT_PLATFORMS
PACKAGE_MCP
PACKAGE_NPM
PR_CORE_WRAPPER
WINDOWS_MAKE_SHELL
BAZEL
BAZEL_TEST
BAZEL_PURE
BAZEL_EMBEDDED
BAZEL_INTEGRATION
BAZEL_DOLTSERVER
BAZEL_PROXIED
BAZEL_SERVER_STORAGE
BAZEL_COVERAGE
BAZEL_EMBEDDED_RETIRED
BAZEL_DOLT_SERVER_RETIRED
BAZEL_PR_LANES_RETIRED
BUILD_ARTIFACTS: ${{ needs.build-artifacts.result }}
# fast-checks' two base-diff steps; each token reads that step's
# outcome (via the job's outputs), with a 'skipped' fallback for a
# lost job (see FAST_CHECKS below). TestPRCIGateFastChecksTokens
# pins this mapping. The repository guards the job used to run
# (build tags, versions, migration checks A and B, gofmt) are Bazel
# tests and gate through BAZEL_TEST.
CHECK_MIGRATION_HYGIENE: ${{ needs.fast-checks.outputs.migration-hygiene || 'skipped' }}
CHECK_NO_BEADS_CHANGES: ${{ needs.fast-checks.outputs.no-beads-changes || 'skipped' }}
# Backstop: if fast-checks itself is lost (e.g. a cancelled runner)
# before any step sets an output, the two tokens above read
# 'skipped' (neither is in CI_GATE_SKIPPED_OK, so the gate still
# reds) - FAST_CHECKS gives ci-gate.sh one clear line naming the
# job.
FAST_CHECKS: ${{ needs.fast-checks.result }}
CHECK_CMD_BD_PUREGEO_TESTS: ${{ needs.check-cmd-bd-puregeo-tests.result }}
TEST_WINDOWS_LIVENESS: ${{ needs.test-windows-liveness.result }}
WORKTREE_REMOVE_WINDOWS: ${{ needs.worktree-remove-windows.result }}
# F4 side-by-side rollout: always evaluated, like the native pair
# above; WINDOWS_PREBUILT_REQUIRED (top of this file) decides below
# which pair is in CI_GATE_REQUIRED and which is in
# CI_GATE_SKIPPED_OK.
TEST_WINDOWS_LIVENESS_PREBUILT: ${{ needs.test-windows-liveness-prebuilt.result }}
WORKTREE_REMOVE_WINDOWS_PREBUILT: ${{ needs.worktree-remove-windows-prebuilt.result }}
CHECK_DOC_FLAGS: ${{ needs.check-doc-flags.result }}
CHECK_DOC_FRESHNESS_PLATFORMS: ${{ needs.check-doc-freshness-platforms.result }}
PR_PREFLIGHT_PLATFORMS: ${{ needs.pr-preflight-platforms.result }}
# F3: package-mcp/package-npm now run inside the bazel call; their
# job.status surfaces as a call output exactly like the Bazel lanes
# below, never "skipped" on pr.yml (package-gates is always "on"
# here).
PACKAGE_MCP: ${{ needs.bazel.outputs.package-mcp || 'skipped' }}
PACKAGE_NPM: ${{ needs.bazel.outputs.package-npm || 'skipped' }}
PR_CORE_WRAPPER: ${{ needs.pr-core-wrapper.result }}
WINDOWS_MAKE_SHELL: ${{ needs.windows-make-shell.result }}
# bazel.yml's lanes report their job.status as outputs; a lane that
# did not report (skipped, or lost before its last step) reads as
# skipped, which passes only in the modes bazel-gate.sh allows.
BAZEL_TEST: ${{ needs.bazel.outputs.bazel-test || 'skipped' }}
BAZEL_PURE: ${{ needs.bazel.outputs.bazel-pure || 'skipped' }}
BAZEL_EMBEDDED: ${{ needs.bazel.outputs.bazel-embedded || 'skipped' }}
BAZEL_INTEGRATION: ${{ needs.bazel.outputs.bazel-integration || 'skipped' }}
BAZEL_DOLTSERVER: ${{ needs.bazel.outputs.bazel-doltserver || 'skipped' }}
BAZEL_PROXIED: ${{ needs.bazel.outputs.bazel-proxied || 'skipped' }}
BAZEL_SERVER_STORAGE: ${{ needs.bazel.outputs.bazel-server-storage || 'skipped' }}
# Advisory unless BAZEL_CMD_DOLT_REQUIRED (top of this file) is
# "true": see the run script.
BAZEL_CMD_DOLT: ${{ needs.bazel.outputs.bazel-cmd-dolt || 'skipped' }}
# Inputs of bazel-gate.sh, which sets BAZEL (the call's aggregate,
# red on a missing or inconsistent mode) and the expected skips
# from bazel.yml's own rbe job decision.
BAZEL_CALL: ${{ needs.bazel.result }}
BAZEL_RBE_MODE: ${{ needs.bazel.outputs.rbe-mode }}
BAZEL_RBE_ENABLED: ${{ needs.bazel.outputs.rbe-enabled }}
# D2: which legacy tiers PR Risk, or this workflow (pr_lanes),
# retired for this PR (BAZEL_*_RETIRED below).
BAZEL_COVERAGE: ${{ needs.bazel-coverage.result }}
BAZEL_COVERS_EMBEDDED: ${{ needs.bazel-coverage.outputs.embedded }}
BAZEL_COVERS_DOLT_SERVER: ${{ needs.bazel-coverage.outputs.dolt_server }}
BAZEL_COVERS_PR_LANES: ${{ needs.bazel-coverage.outputs.pr_lanes }}
run: |
skipped_ok=""
# F4 side-by-side rollout: WINDOWS_PREBUILT_REQUIRED (top of this
# file) flips which pair of Windows jobs ci-gate enforces with a
# single committed flag, instead of three edits per job
# (ci-gate.needs, CI_GATE_REQUIRED, and this step's env map) done
# twice. Both pairs are unconditionally in ci-gate.needs and always
# evaluated above (neither is in the static CI_GATE_REQUIRED list);
# only which pair is added to CI_GATE_REQUIRED (enforced) vs.
# skipped_ok (merely advisory -- a failure there cannot redden the
# gate) changes here.
if [[ "$WINDOWS_PREBUILT_REQUIRED" == "true" ]]; then
CI_GATE_REQUIRED="$CI_GATE_REQUIRED TEST_WINDOWS_LIVENESS_PREBUILT WORKTREE_REMOVE_WINDOWS_PREBUILT"
skipped_ok="$skipped_ok TEST_WINDOWS_LIVENESS WORKTREE_REMOVE_WINDOWS"
else
CI_GATE_REQUIRED="$CI_GATE_REQUIRED TEST_WINDOWS_LIVENESS WORKTREE_REMOVE_WINDOWS"
skipped_ok="$skipped_ok TEST_WINDOWS_LIVENESS_PREBUILT WORKTREE_REMOVE_WINDOWS_PREBUILT"
fi
# The cmd/bd Dolt-server tier (bazel.yml's bazel-cmd-dolt) is
# advisory until BAZEL_CMD_DOLT_REQUIRED (top of this file) is
# "true"; it is never in the static list above.
if [[ "$BAZEL_CMD_DOLT_REQUIRED" == "true" ]]; then
CI_GATE_REQUIRED="$CI_GATE_REQUIRED BAZEL_CMD_DOLT"
fi
export CI_GATE_REQUIRED
# Bazel lanes skipped by design in the call's execution mode (all
# of them in mode skip, the remote-only embedded, proxied and
# server-storage tiers in modes local and cache, and integration
# in mode local), and the aggregate unless the mode is missing or
# invalid.
skipped_ok="$skipped_ok $(bash .github/scripts/bazel-gate.sh skips)"
BAZEL="$(bash .github/scripts/bazel-gate.sh aggregate)"
export BAZEL
# D2 step 3: this workflow's legacy jobs that stand down where
# bazel-coverage says pr_lanes (exactly "true"); their Bazel lanes
# are then required below.
if [[ "$BAZEL_COVERS_PR_LANES" == "true" ]]; then
skipped_ok="$skipped_ok BUILD_ARTIFACTS CHECK_CMD_BD_PUREGEO_TESTS PR_CORE_WRAPPER"
fi
# Where a legacy tier is retired (by PR Risk or by this
# workflow), this run's Bazel lanes for it are the tier's only
# pre-merge run: each must have run remotely (mode remote, or
# fork-ro/fork-rw with an rbe-fork certificate where
# BAZEL_COVERS_FORKS covers a PR without the CI secrets) and
# passed. Mode skip (the farm switch off), cache (no secret, or
# rbe-fork closed or refusing), or any other result, is red
# whatever bazel-gate.sh allows.
# retired ID FLAG COVERED TIER LANE...: set and export ID.
retired() {
local id="$1" flag="$2" covered="$3" tier="$4" result=success lane
shift 4
if [[ "$covered" == "true" ]]; then
[[ "$BAZEL_RBE_MODE" =~ ^(remote|fork-ro|fork-rw)$ ]] || result="not-run-remotely"
for lane in "$@"; do
[[ "${!lane:-}" == "success" ]] || result="not-run-remotely"
done
if [[ "$result" != "success" ]]; then
echo "::error::The legacy $tier is retired ($flag) and its Bazel lanes ($*) did not all run remotely and pass (mode '${BAZEL_RBE_MODE:-none}'). In mode cache on a PR without the CI secrets, rbe-fork was closed or refused this run: re-run all jobs later. If remote execution is off on purpose, commit $flag: \"false\" (or BAZEL_COVERS_FORKS: \"false\" for forks) in pr.yml and pr-risk.yml and push this PR again."
fi
fi
printf -v "$id" '%s' "$result"
export "${id?}"
}
retired BAZEL_EMBEDDED_RETIRED BAZEL_RETIRES_LEGACY_EMBEDDED "$BAZEL_COVERS_EMBEDDED" "PR Risk embedded Dolt tier" BAZEL_EMBEDDED
retired BAZEL_DOLT_SERVER_RETIRED BAZEL_RETIRES_LEGACY_DOLT_SERVER_TIERS "$BAZEL_COVERS_DOLT_SERVER" "PR Risk proxied-server and server-Dolt storage tiers" BAZEL_PROXIED BAZEL_SERVER_STORAGE
retired BAZEL_PR_LANES_RETIRED BAZEL_RETIRES_LEGACY_PR_LANES "$BAZEL_COVERS_PR_LANES" "PR Core, build-artifacts and pure-Go/js-wasm jobs (and the dolt-server lane)" BAZEL_TEST BAZEL_PURE BAZEL_DOLTSERVER
export CI_GATE_SKIPPED_OK="$skipped_ok"
bash .github/scripts/ci-gate.sh