beads/.github/workflows/pr.yml
Julian Knutsen e72cd8b315
ci: merge-queue readiness for the required gates; cache test results (fresh nightly) (#7264)
* ci: make the required gates merge-queue ready

The default-branch ruleset requires "CI Gate / Required" and "PR Risk
Gate / Required". Prepare both for a GitHub merge queue (ALLGREEN,
squash), so enabling the ruleset's merge_queue rule is the only step left.

- pr.yml, pr-risk.yml: merge_group pinned to types [checks_requested].
- D2: bazel-coverage covers every merge_group run (same repository, CI
  secrets, actor github-merge-queue[bot], bazel.yml mode remote), so the
  retired legacy tiers stay retired in the queue and ci-gate requires
  their Bazel lanes to have run remotely and passed; a missing secret or
  the farm switch off is red, as on a same-repo PR.
- Diff bases on merge_group: the package gates diff
  merge_group.base_sha..head_sha (not HEAD^, which misses all but the
  last commit of a rebase-method entry), the .beads/issues.jsonl guard
  now runs on merge_group against base_sha (ci-gate no longer excuses
  its skip), and check-doc-flags passes BD_DOCS_DIFF_BASE so CLI-docs
  drift already on main cannot eject every queued PR.
- Test result reuse: on a merge_group run and on attempt 2+ of a PR run,
  the six always-execute Bazel lanes append --config=reuse-test-results
  (--cache_test_results=auto), so tests whose action key is unchanged
  reuse the farm's recorded PASS and only what the merge changed runs.
  Failures are never reused, eviction retries stay 0, and each PR's first
  attempt, push to main and nightly still execute every test.
- scripts/ci_merge_queue_test.go simulates merge_group through the shared
  evalGHExpr evaluator (now with true/false/null literals, hyphenated
  identifiers and case-insensitive ==) and the workflows' own scripts:
  triggers and gate names, concurrency groups, every pull_request field
  read, the coverage and rbe decisions, result reuse, the package-gate,
  .beads and doc-drift diff bases.
- engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md: new "Merge Queue" section (how
  to queue, settings, what runs, result reuse rationale, ejection and
  flakes, rollback).

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

* ci: cache Bazel test results except nightly; queue trust and sizing

Review follow-ups to the merge-queue readiness change.

- Test results (S1): --nocache_test_results also stops Bazel writing
  results, so a PR's first run never fed the cache and the merge-queue
  reuse config could only hit on later reuse runs. Drop it from
  test:embedded, test:doltserver-proxied, test:doltserver-integration and
  test:sole-run (which keeps --experimental_remote_cache_eviction_retries=0),
  and drop test:reuse-test-results and BAZEL_REUSE_RESULTS. Results are now
  cached (read and write) on PRs, merge groups and pushes to main.
  nightly.yml passes the new fresh-test-results input, so every `bazel
  test` appends --config=fresh (--nocache_test_results) and the suite
  re-executes nightly. The docker lane keeps --nocache_test_results.
  Measured locally with a disk cache: a default run writes and the next
  reads ("(cached) PASSED"); a fresh run neither reads nor writes.
- Security headers (S2): bazel.yml now states that a merge_group run
  executes the queued commit's workflows, so a queued fork or Dependabot
  PR's CI edits run with every CI secret, the pre-warm app key included
  (merging-level trust), and records the maintainer rule: review fork
  changes to .github/, .bazelrc, tools/bazel, MODULE.bazel, BUILD files
  and CI scripts before queueing. Same note in the topology doc.
- Queue sizing (S3): recommend max_entries_to_build 3 and
  check_response_timeout_minutes 60 (max_entries_to_merge 5, ALLGREEN,
  SQUASH unchanged).
- Nits: the .beads guard fails closed on a missing diff base, and its
  test runs under GitHub's default `bash -e`; evalGHExpr follows GitHub's
  loose equality (true == 'true' is false, false == '' is true, missing
  context keys are null) with a typed-context variant; the
  detect-package-gates comment notes the SQUASH/HEAD^ equivalence and
  path-filter scope; the doc covers re-run reuse, flake re-sampling via
  dispatch, stale queue runs and how to confirm reuse on the farm.

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-05 13:54:15 -07:00

2639 lines
136 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, the pure-Go/js-wasm check, domain+uow and
# contract corpus (Bazel `test`, `pure-Go and js/wasm`, `dolt-server
# lane`). 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. "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.
BAZEL_COVERS_FORKS: "false"
# 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
# F7a: fold of five independent, no-cache pr.yml checks that previously ran
# as five separate ubuntu-latest jobs (check-build-tags,
# check-version-consistency, check-migration-hygiene,
# check-no-beads-changes, fmt-check) into one Blacksmith job with five
# steps. Each step gets its own id and `if: ${{ !cancelled() }}` so one
# check's failure does not block the others from running, and the job
# exposes each step's outcome as a job output so ci-gate can still red the
# exact same CI_GATE_REQUIRED token it did before the fold -
# TestPRCIGateFastChecksTokens pins the mapping. FAST_CHECKS (the job's own
# `result`) is an added backstop token: if the whole job is lost (e.g. a
# cancelled runner) before any step sets its output, the per-check outputs
# read empty and the CI_GATE_REQUIRED fallback below treats that as
# "skipped" - which is NOT skipped_ok, so the gate still reds, but
# FAST_CHECKS gives ci-gate.sh one clear error line ("FAST_CHECKS=cancelled")
# instead of five confusing ones.
fast-checks:
name: Fast checks (build tags, versions, migrations, beads diff, fmt)
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:
build-tags: ${{ steps.build-tags.outcome }}
version-consistency: ${{ steps.version-consistency.outcome }}
migration-hygiene: ${{ steps.migration-hygiene.outcome }}
no-beads-changes: ${{ steps.no-beads-changes.outcome }}
fmt: ${{ steps.fmt.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
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
# Fast shell/Make guard for direct source-time build-tag declarations.
# Workflow `run` steps are checked structurally in the required policy
# wrapper.
- name: Check build-tag policy
id: build-tags
if: ${{ !cancelled() }}
run: |
./scripts/check-build-tags.sh
./scripts/check-go-install-guidance.sh
./scripts/check-winget-portable-alias.sh
# Fast check to ensure all version files are in sync
- name: Check all versions match
id: version-consistency
if: ${{ !cancelled() }}
run: ./scripts/check-versions.sh
# Migration hygiene: duplicate version numbers, nondeterministic SQL
# (UUID()/NOW()/RAND(), the #4259 root-cause class), and edits to
# migration files that already exist on the base branch (shipped
# migrations are frozen; fix forward with a new version). Fails at PR
# time, before any test even compiles. 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 }}
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"
- name: Check gofmt
id: fmt
if: ${{ !cancelled() }}
run: make fmt-check
# 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
# check-release-target-cross-compilation still `go build`s ./... with
# CGO_ENABLED=0 on every PR.
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
# Compile every shipped release target on every PR, so a platform-gating
# mistake is caught here instead of at tag time (#5662).
#
# Coverage boundary, recorded so the green is not over-read: every leg below
# builds CGO_ENABLED=0, but .goreleaser.yml builds bd-linux-amd64,
# bd-linux-arm64 and bd-windows-amd64 with CGO_ENABLED=1, and the darwin pair
# is built natively at CGO_ENABLED=1 by release.yml's goreleaser-macos job.
# Five of these eight legs are therefore a weaker proxy than the binary they
# stand for: the cgo half of the tree (beads_cgo.go ->
# internal/storage/embeddeddolt) is never compiled here, so a break confined
# to it still passes this check. Only android/arm64, windows/arm64 and
# freebsd/amd64 replicate their release configuration exactly.
#
# The build scope is deliberately ./... and not the ./cmd/bd that every
# .goreleaser.yml build id declares as main:. Compiling the whole tree per
# platform is intentional extra coverage, not an oversight.
#
# F7a: folded from 8 per-target jobs into 2 per-group jobs. The target list
# moved out of this matrix and into scripts/ci/release-targets.txt, which
# scripts/ci/check-release-cross-compile.sh reads and
# TestReleaseTargetCrossCompilationMatrixMatchesGoreleaser pins against
# .goreleaser.yml, so the manifest (not this YAML) is now the single
# source of truth for the target set. Moved to Blacksmith for same-repo
# PRs/merge_group: this job restores no GitHub-saved build cache (only a
# best-effort module-cache restore, whose misses are cheap network
# fetches, not lost compute). Runner choice must match the
# TestSameRepoBlacksmithRunners pin.
check-release-target-cross-compilation:
name: Check release target cross-compilation (${{ matrix.group }})
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: 20
strategy:
fail-fast: false
matrix:
group: [unix, desktop]
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: Build complete release target tree for group ${{ matrix.group }}
run: ./scripts/ci/check-release-cross-compile.sh ${{ matrix.group }}
# 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
#
# 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
./scripts/check-doc-freshness.sh
# 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
# 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: 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 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
# 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
# F3: package-mcp and package-npm (and the detect job that fed them) moved
# into bazel.yml, which pr.yml calls with package-gates: "on" below. They
# now depend on nothing but the rbe job's decision, so they no longer wait
# on build-artifacts, bazel-coverage or the rest of the bazel call.
#
# F7a: moved to Blacksmith for same-repo PRs/merge_group. setup-go runs with
# cache: false and the module download step below always hits the network,
# so this job restores no GitHub-saved cache.
pr-policy-wrapper:
name: PR Policy (wrapper timing)
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:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'go.mod'
cache: false
# The module fetch is the only part of this job that talks to the network,
# and setup-go above runs with cache: false, so every run pulls the whole
# module graph from the proxy. Doing it here, retried, means a proxy blip
# costs seconds instead of failing a required check.
#
# Deliberately NOT wrapped around the build: `make ci-pr-policy` runs a
# `go build ./cmd/bd` (scripts/ci/pr-policy.sh, build_docs_binary), and a
# compile error is not transient. Retrying it would make a genuinely broken
# build take three attempts to report and look like a slow one. The fetch
# has a legitimate transient failure mode; the build does not.
#
# 3 attempts x 120s + 2 backoffs x 10s = 380s worst case. 8m leaves ~100s
# of headroom, matching the bounded apt-get steps in migration-test.yml.
- name: Download modules
timeout-minutes: 8
run: |
downloaded=""
for attempt in 1 2 3; do
if timeout 120 go mod download; then
downloaded=yes
break
fi
echo "::warning::go mod download attempt $attempt failed or timed out"
# No backoff after the final attempt - there is nothing left to wait for.
if [ "$attempt" -lt 3 ]; then
sleep 10
fi
done
# Unlike the best-effort apt-get retries elsewhere in this repo, this
# one is load-bearing: nothing downstream can build without the
# modules. Fail here, naming the fetch, so a module outage is not
# reported as a build failure.
if [ -z "$downloaded" ]; then
echo "::error::go mod download failed after 3 attempts - module fetch failure, not a build failure"
exit 1
fi
- name: Run PR policy wrapper
run: make ci-pr-policy
# 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 scripts-go-checks runs what Bazel does not
# (./scripts/... and the allowlisted tests under go test, go test's vet).
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
# PR Core's duties the Bazel lanes do not take over (D2 step 3), on every
# PR whatever bazel-coverage says, in PR Core's environment (dolt, git and
# dolt identity, scripts/ci/lib/test-env.sh):
# - `go test ./scripts/...` with PR Core's flags: the repository policy
# tests, several of which check part or all of their rules under go test
# only (scripts/bazel_skip_allowlist_test.go keeps such parts there);
# - go test's own vet checks over ./... (rules_go's go_test runs none);
# - the Go tests `bazel test --config=ci` does not run or skips
# (tools/bazel/equivalence_allowlist.txt), each required to pass.
# F7b: same-repo Blacksmith (blacksmith-4vcpu-ubuntu-2404) for same-repo
# PRs/merge_group, falling back to ubuntu-latest for forks/Dependabot, same
# pattern as advisory-reports/pr-policy-wrapper/pr-core-wrapper above.
# main.yml's blacksmith-go-build-cache job seeds this leg's race and
# non-race GOCACHEs; go-vet-cache's venue matrix seeds the vet leg's.
scripts-go-checks:
name: Go checks (${{ matrix.check }})
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: 30
strategy:
fail-fast: false
matrix:
check: [scripts-test, vet, allowlisted]
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
if: matrix.check == 'scripts-test'
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: Restore vet Go build cache
if: matrix.check == 'vet'
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/go-cache/vet
key: beads-go-vet-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-vet-${{ github.sha }}
# The non-race build cache fallback this used to list can never hit:
# actions/cache versions an entry by its path list, and that cache
# saves to a different path (.../go-cache/non-race), so the prefix
# match is always filtered out (SF-5).
restore-keys: beads-go-vet-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-vet-
- name: Restore non-race Go build cache
if: matrix.check == 'allowlisted'
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: Install Dolt
if: matrix.check == 'scripts-test' || matrix.check == 'allowlisted'
run: ./scripts/ci/install-dolt.sh
- name: Configure Git and Dolt identity
if: matrix.check == 'scripts-test' || matrix.check == 'allowlisted'
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: Go test the scripts packages
if: matrix.check == 'scripts-test'
env:
BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION: '1'
GOCACHE: ${{ runner.temp }}/go-cache/race
run: bash scripts/ci/scripts-go-test.sh
- name: Go vet with go test's checks
if: ${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'vet' }}
env:
GOCACHE: ${{ runner.temp }}/go-cache/vet
run: bash scripts/ci/go-test-vet.sh
- name: Run the Go tests the Bazel lane skips
if: ${{ !cancelled() && steps.setup-go.outcome == 'success' && matrix.check == 'allowlisted' }}
env:
GOCACHE: ${{ runner.temp }}/go-cache/non-race
run: bash scripts/ci/allowlisted-go-tests.sh
# F7b: same-repo Blacksmith (blacksmith-4vcpu-ubuntu-2404) for same-repo
# PRs/merge_group, falling back to ubuntu-latest for forks/Dependabot.
# main.yml's pr-lint-wrapper `venue` matrix seeds this leg's golangci-lint
# and lint-native GOCACHEs.
pr-lint-wrapper:
name: PR Lint (${{ matrix.target }})
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: 20
permissions:
contents: read
strategy:
fail-fast: false
matrix:
target: [native, windows, darwin]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
# --new-from-merge-base below walks real history.
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: Install golangci-lint
run: ./scripts/ci/install-golangci-lint.sh
# Keyed on file content and the leg; a miss on the exact content key
# falls back to the leg's most recent entry, which golangci-lint
# revalidates against the current config and inputs. pr.yml never saves
# this cache (§0); main.yml's pr-lint-wrapper matrix is the only saver,
# on an exact-key miss. The key omits the sha (SF-4) so main.yml only
# saves when .golangci.yml or go.sum change.
- name: Restore golangci-lint cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/golangci-lint
${{ matrix.target == 'native' && format('{0}/go-cache/lint-{1}', runner.temp, matrix.target) || '' }}
key: beads-golangci-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-v2.10.1-${{ matrix.target }}-${{ hashFiles('.golangci.yml', 'go.sum') }}
restore-keys: beads-golangci-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-v2.10.1-${{ matrix.target }}-
# Scope the wrapper's lint to what this PR introduces, matching the
# (now-deleted) `lint` job's only-new-issues scope. main.yml runs the
# same wrapper with this unset, so the whole tree is still swept on
# every push to main. Both PR triggers (pull_request, merge_group)
# target main.
- name: Run PR lint wrapper
env:
BD_LINT_NEW_FROM_MERGE_BASE: origin/main
BD_LINT_TARGETS: ${{ matrix.target }}
GOCACHE: ${{ runner.temp }}/go-cache/lint-${{ matrix.target }}
run: make ci-pr-lint
# 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
# Focused job for the hexagonal storage layer (internal/storage/domain/* and
# internal/storage/uow). These packages back the proxied-server init path and
# also live behind the existing ./... matrix, but TestDomainDB requires the
# Dolt sql-server image cached locally (testcontainers checks `docker image
# inspect` and skips otherwise). Pulling the image up front guarantees the
# suite actually runs and surfaces failures here with a clear job name.
#
# D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel's
# `dolt-server lane` runs the same packages against a local dolt
# sql-server, which test-dolt-server-fingerprint (every PR) keeps equal to
# the container this job uses.
test-domain-uow:
name: Test (storage domain + uow)
runs-on: ubuntu-latest
needs: [build-artifacts, bazel-coverage]
if: needs.bazel-coverage.outputs.pr_lanes != 'true'
# The race-enabled storage package has outgrown Go's implicit 10-minute
# timeout. Keep both per-package deadlines inside one finite job budget.
timeout-minutes: 30
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: Install Dolt CLI
run: ./scripts/ci/install-dolt.sh
- name: Verify dolt on PATH
run: dolt version
- 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: Pull Dolt sql-server image
# Keep tag in sync with internal/testutil/testdoltcommon.go:DoltDockerImage.
# Without this, RequireDoltContainer reports doltNoImage and TestDomainDB skips.
run: ./scripts/ci/pull-dolt-image.sh
- 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: Test domain + uow + tracker
env:
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
# internal/storage/domain, internal/storage/uow, and internal/tracker
# run as concurrent package test binaries in this one invocation.
# testcontainers-go shares one Ryuk reaper per host; a failed
# handshake in one process can reap a sibling's live Dolt container
# mid-suite (be-2on). The runner is destroyed after the job, so the
# reaper buys nothing here and only costs this race.
TESTCONTAINERS_RYUK_DISABLED: "true"
run: go test -tags gms_pure_go -race -count=1 -timeout 15m -v ./internal/storage/domain/... ./internal/storage/uow/... ./internal/tracker/...
# The doctor/fix DB-backed suite spins its own Dolt container in
# TestMain. BEADS_FIX_REQUIRE_DOLT=1 turns a missing container into a
# hard failure so the suite can never silently skip in CI again
# (bd-nxt5e: it was dark for months); this job pulls the image above.
- name: Test doctor/fix (Dolt-backed, hard-require container)
env:
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
BEADS_FIX_REQUIRE_DOLT: "1"
# Pinned for consistency with the step above: this single-package
# step has no sibling test binary to race for the reaper (be-2on).
TESTCONTAINERS_RYUK_DISABLED: "true"
run: go test -tags gms_pure_go -race -count=1 -timeout 10m -v ./cmd/bd/doctor/fix/
# Compares the Dolt sql-server container image the container-backed tests
# use and the local test server backend (the pinned dolt CLI, what every
# Bazel dolt-server lane starts) against the one checked-in fingerprint,
# so an image bump cannot drift the container side unnoticed. REQUIRE
# makes the container half fail, not skip. Every PR, whatever bazel-coverage
# says: it was test-domain-uow's first step, and the Bazel lanes that
# replace that job (D2 step 3) have no docker.
#
# F7a: moved to Blacksmith for same-repo PRs/merge_group. Restores no
# GitHub-saved cache (Dolt CLI and the sql-server image are fetched fresh
# every run via scripts/ci/install-dolt.sh and pull-dolt-image.sh).
test-dolt-server-fingerprint:
name: Test (Dolt server fingerprint)
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: 15
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: Install Dolt CLI
run: ./scripts/ci/install-dolt.sh
- name: Verify dolt on PATH
run: dolt version
- 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: Pull Dolt sql-server image
# Keep tag in sync with internal/testutil/testdoltcommon.go:DoltDockerImage.
run: ./scripts/ci/pull-dolt-image.sh
- name: Test Dolt server fingerprint (container + local)
env:
BEADS_TEST_REQUIRE_DOLT_CONTAINER: "1"
run: go test -tags gms_pure_go -count=1 -timeout 5m -v -run '^TestDoltServerFingerprint$' ./internal/testutil/
# `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.
# Producer-side guard for the Beads<->consumer CLI contract. Runs the whole
# cmd/bd/protocol package: the golden corpus (regenerated from this branch's
# bd and byte-compared to the committed testdata/corpus/, so an unreviewed
# wire change is a hard failure — run `make corpus-regen`), the double-run
# determinism check, and the TestProtocol_/TestJSONContract_ behavioral
# conformance suite that pins the CLI's JSON payloads and semantics.
#
# Run the PACKAGE, never a -run subset: a filter here is what let the
# conformance tests sit red on main for ~3 months while every CI run was
# green (they matched no job's -run, and every broad ./... job skips them
# for want of a Dolt store). Package scope means a newly added protocol test
# is gated the moment it lands.
#
# Needs the Dolt sql-server image (the protocol harness spins a container).
# ~10 min: each test builds an isolated Dolt-backed workspace. If that ever
# becomes unacceptable on PRs, shard this job by an exhaustive `go test
# -list` partition — do not reintroduce a hand-written -run regex.
#
# D2 step 3: stands down where bazel-coverage says pr_lanes; Bazel's
# `dolt-server lane` runs the package (//cmd/bd/protocol:protocol_dolt_test).
contract-corpus:
name: Contract corpus (golden + determinism + conformance)
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: Install Dolt CLI
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: Pull Dolt sql-server image
# Keep tag in sync with internal/testutil/testdoltcommon.go:DoltDockerImage.
run: ./scripts/ci/pull-dolt-image.sh
- name: Protocol conformance + corpus golden + determinism
# Require a live Dolt store here: this is the gate that must exercise the
# conformance, golden and double-run checks, so a failed container is a
# hard failure, not a silent skip (see requireDoltStore in the
# cmd/bd/protocol tests).
#
# -timeout is explicit because the package runs well past `go test`'s
# 10m default; without it a slow runner reports a panic, not a verdict.
env:
BEADS_PROTOCOL_REQUIRE_DOLT: "1"
run: go test -tags gms_pure_go -count=1 -timeout 30m ./cmd/bd/protocol
# 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, domain+uow and
# contract corpus, 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, pure-Go/js-wasm,
# domain+uow and contract corpus 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,
# domain+uow and contract corpus), 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
- check-release-target-cross-compilation
- 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-policy-wrapper
- pr-core-wrapper
- scripts-go-checks
- pr-lint-wrapper
- test-domain-uow
- test-dolt-server-fingerprint
- contract-corpus
- 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_BUILD_TAGS
CHECK_VERSION_CONSISTENCY
CHECK_MIGRATION_HYGIENE
CHECK_NO_BEADS_CHANGES
FMT_CHECK
CHECK_CMD_BD_PUREGEO_TESTS
CHECK_RELEASE_TARGET_CROSS_COMPILATION
CHECK_DOC_FLAGS
CHECK_DOC_FRESHNESS_PLATFORMS
PR_PREFLIGHT_PLATFORMS
PACKAGE_MCP
PACKAGE_NPM
PR_POLICY_WRAPPER
PR_CORE_WRAPPER
SCRIPTS_GO_CHECKS
PR_LINT_WRAPPER
TEST_DOMAIN_UOW
TEST_DOLT_SERVER_FINGERPRINT
CONTRACT_CORPUS
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 }}
# F7a: fast-checks folds five formerly-separate jobs into one job
# with five steps; each token below now reads that step's outcome
# (via the job's outputs) instead of a sibling job's result, with a
# 'skipped' fallback for a lost job (see FAST_CHECKS below).
# TestPRCIGateFastChecksTokens pins this mapping.
CHECK_BUILD_TAGS: ${{ needs.fast-checks.outputs.build-tags || 'skipped' }}
CHECK_VERSION_CONSISTENCY: ${{ needs.fast-checks.outputs.version-consistency || 'skipped' }}
CHECK_MIGRATION_HYGIENE: ${{ needs.fast-checks.outputs.migration-hygiene || 'skipped' }}
CHECK_NO_BEADS_CHANGES: ${{ needs.fast-checks.outputs.no-beads-changes || 'skipped' }}
FMT_CHECK: ${{ needs.fast-checks.outputs.fmt || 'skipped' }}
# Backstop: if fast-checks itself is lost (e.g. a cancelled runner)
# before any step sets an output, the five tokens above all read
# 'skipped' (none are in CI_GATE_SKIPPED_OK by default, so the gate
# still reds) - FAST_CHECKS gives ci-gate.sh one clear line naming
# the job instead of five step-shaped ones.
FAST_CHECKS: ${{ needs.fast-checks.result }}
CHECK_CMD_BD_PUREGEO_TESTS: ${{ needs.check-cmd-bd-puregeo-tests.result }}
CHECK_RELEASE_TARGET_CROSS_COMPILATION: ${{ needs.check-release-target-cross-compilation.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_POLICY_WRAPPER: ${{ needs.pr-policy-wrapper.result }}
PR_CORE_WRAPPER: ${{ needs.pr-core-wrapper.result }}
SCRIPTS_GO_CHECKS: ${{ needs.scripts-go-checks.result }}
PR_LINT_WRAPPER: ${{ needs.pr-lint-wrapper.result }}
TEST_DOMAIN_UOW: ${{ needs.test-domain-uow.result }}
TEST_DOLT_SERVER_FINGERPRINT: ${{ needs.test-dolt-server-fingerprint.result }}
CONTRACT_CORPUS: ${{ needs.contract-corpus.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 TEST_DOMAIN_UOW CONTRACT_CORPUS"
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, pure-Go/js-wasm, domain+uow and contract corpus jobs" BAZEL_TEST BAZEL_PURE BAZEL_DOLTSERVER
export CI_GATE_SKIPPED_OK="$skipped_ok"
bash .github/scripts/ci-gate.sh