* ci(F4): advisory Linux-cross-built Windows test binaries, macOS cache restore Side-by-side rollout slice of the PR CI -> 5 min plan (F4): - Add pr.yml `windows-test-binaries`: a Linux job that cross-compiles bd.exe and two go-test-c binaries (cgo and nocgo) for windows/amd64 via mingw (CC/CXX=x86_64-w64-mingw32-*, matching release.yml's goreleaser setup), driven by a committed manifest (scripts/ci/windows-test-binaries.txt) and build script (scripts/ci/build-windows-test-binaries.sh). Artifacts are uploaded and consumed by two new advisory "-prebuilt" twins (test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt) that run the identical test selection/flags/env (including BEADS_TEST_REPO_ROOT) against the prebuilt binaries via scripts/ci/run-go-test-binary.sh and scripts/test.sh's new BEADS_TEST_PREBUILT_TEST_BINARY short-circuit. - The original native Windows jobs are untouched and remain required; the new jobs are advisory only (not in CI_GATE_REQUIRED) for this rollout phase. Flipping to the cross-built path later is a one-line CI_GATE_REQUIRED change. - Add main.yml `windows-test-binaries-cache`: seeds the Go build cache for the cross-compile toolchain/packages on a schedule, mirroring the existing module/build cache warmers; reorder build-artifacts' warm-cache step to precede the module-cache save for a cleaner build -> warm -> save grouping. - Restore macOS's native build-cache save step in main.yml (lost during an earlier job consolidation). - Remove the non-required "Test (macos-latest)" full-suite job from PRs; the native macOS gate jobs still run, so required coverage is unaffected. This does drop a non-required pre-merge macOS race signal; see docs/notes for the accepted tradeoff. - Add scripts/windows_test_binaries_manifest_test.go: policy tests pinning the manifest's three advisory-phase entries, pinning the mingw toolchain to release.yml's, checking consumer jobs only reference manifest-listed binaries, checking upload/download artifact names and `needs` match, checking the prebuilt jobs select exactly the same tests (-run literals) as their native counterparts, and checking none of the new jobs reference secrets (fork safety). All mutation-tested. - Add two scripts/ci_workflow_apt_get_timeout_test.go budget entries for the new "Install mingw cross-compiler" steps. - Fix two latent Bazel-only scripts_test failures surfaced while wiring the new test file into scripts/BUILD.bazel: materialize cmd/bd's sources via the existing //cmd/bd:go_srcs filegroup so sourceRepoRoot(t)-based package-directory checks work under Bazel's runfiles root, and strip Bazel's own TEST_TIMEOUT env var before exercising scripts/test.sh's hardcoded default in test_script_test.go (name collision with test.sh's own override knob). Verified: go test ./scripts/...; bazel --nohome_rc test //scripts:scripts_test; actionlint; shellcheck; make ci-pr-policy; make bazel-sync-check; a from-scratch /tmp clone cross-build using the exact job commands (cold 130.2s, warm/cache-hit 30.3s, PE32+ x86-64 validity via file/objdump, byte-identical SHA-256 across cold/warm/traced runs); wine -test.list confirms TestPrimeBinaryPortfolio/TestIsServerProbablyRunning* present in the cgo binary and the full TestWorktreeRemove* family (including Windows-specific variants) present in the nocgo binary. Scoping note: only 2 of the spec's 4 consumer jobs (liveness, worktree-remove) get prebuilt twins, and only 3 of 8 spec-listed manifest binaries are built this slice; preflight, doc-freshness and credential-fixture consumers are deferred as documented follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(ci): address F4 review findings (SF-1..SF-6 + nits) Addresses the F4 review (~/beads-bazel-plan/f4/review.md): no blockers, six substantive findings plus several nits. - SF-1: main.yml's windows-test-binaries-cache job now seeds the Windows cross-compile cache from both runner selections pr.yml's consumer job can land on (Blacksmith for same-repo PRs/merge_group, ubuntu-latest for forks/Dependabot) via a 2-leg matrix with identical keys/paths, instead of a single ubuntu-latest leg Blacksmith runners can never see. - SF-2: removed the two consumer-less "Warm non-race Go build cache (test-only packages)" steps from main.yml (build-artifacts, test macOS leg); they had no real consumer and cost ~270s on main's macOS leg for nothing. - SF-3: scripts/ci/run-go-test-binary.sh now injects the same -test.timeout=10m default (when -timeout is omitted) and unconditional -test.paniconexit0 flag `go test` itself injects; added timeout-minutes to test-windows-liveness-prebuilt; added a direct regression test (TestRunGoTestBinaryDefaultsTimeoutWhenOmitted) for the omitted-timeout branch, which no path through scripts/test.sh can reach (test.sh always supplies its own -timeout default first). - SF-4: scripts/test.sh's BEADS_TEST_PREBUILT_TEST_BINARY branch now runs run-go-test-binary.sh as a child process (capturing and re-exiting its status) instead of `exec`-ing it, so the EXIT trap (beads_test_env_cleanup) still runs and the per-run BEADS_TEST_ENV_ROOT temp dir (and, with BEADS_TEST_SHARED_SERVER=1, the shared dolt sql-server) is cleaned up instead of leaked/orphaned. - SF-5: closed the five surviving mutations (cgo/nocgo swap between the Windows prebuilt twins, dropped -count=1, an unguarded twin in ci-gate.needs, a goreleaser compiler change, a PKGDIR change) with dedicated policy tests, and replaced the three-edits-per-job required/ advisory toggle with a single committed WINDOWS_PREBUILT_REQUIRED flag (pr.yml top-level env) in the style of the existing BAZEL_RETIRES_LEGACY_* flags: both Windows pairs are now unconditionally in ci-gate.needs and always evaluated, and only which pair lands in CI_GATE_REQUIRED vs. CI_GATE_SKIPPED_OK is decided by the flag, in one place. - SF-6: dropped the //cmd/bd:go_srcs data dep from scripts_test; the prebuilt-binary contract test now exercises ./scripts/ci (already a data dep of this target) instead of ./cmd/bd, since it never builds or runs the real package. - Nits: removed dangling ~/beads-bazel-plan references and a nonexistent test name from committed comments; log the resolved mingw-w64 version when cross-compiling; removed a no-op shellcheck disable comment; documented why run-go-test-binary.sh's BEADS_TEST_REPO_ROOT re-export doesn't race beads_test_env_enter's unset; rewrote the pr.yml tombstone comment for the removed macOS PR job to state the actual, narrower tradeoff instead of an overclaiming "main.yml covers this" statement. Verified: bazel --nohome_rc test //scripts:scripts_test passes; actionlint clean on pr.yml/main.yml; shellcheck clean on all edited scripts (only pre-existing, unrelated warnings remain elsewhere); make bazel-sync-check and make ci-pr-policy both pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix(scripts): isolate prebuilt-binary contract test from ambient hermetic env TestTestScriptPrebuiltTestBinaryContract's "cleans up BEADS_TEST_ENV_ROOT after the binary exits" subtest (added for F4 review finding SF-4) passed locally but failed in CI's scripts-go-checks/scripts-test leg. scripts/ci/scripts-go-test.sh (the CI driver for this package's `go test ./scripts/...` run) calls beads_test_env_enter in its own shell before invoking go test, so BEADS_TEST_ENV_ACTIVE=1 and an outer BEADS_TEST_ENV_ROOT are already present in this test binary's own os.Environ(). runTestScriptPrebuiltBinary built the scripts/test.sh subprocess's env from os.Environ() (minus TEST_TIMEOUT), so that ambient state leaked through. Inside the subprocess, scripts/test.sh's own beads_test_env_enter call (test.sh:17) saw the already-active guard and no-opped: no new root, no new EXIT trap armed in that process - so the fake binary observed the outer, still-alive root, and the subtest's "directory is gone after test.sh exits" assertion failed, even though the SF-4 fix (run the prebuilt binary as a child instead of exec'ing it) is correct. Every real production caller of scripts/test.sh's prebuilt path (pr.yml's Windows liveness/worktree-remove prebuilt steps) runs it as the first command of a fresh GitHub Actions `run:` step, never nested under an already-entered hermetic env, so this nesting is purely an artifact of this test binary's own ambient environment under scripts-go-test.sh, not a real CI behavior gap. Strip BEADS_TEST_ENV_ACTIVE/_ROOT/_DISABLE/_KEEP (alongside the existing TEST_TIMEOUT filter) from the child env in runTestScriptPrebuiltBinary so the subtest deterministically exercises scripts/test.sh's real top-level, non-nested invocation regardless of what ambient hermetic-env state this test binary itself happens to be running under. Verified: reproduced the CI failure locally by exporting BEADS_TEST_ENV_ACTIVE=1/BEADS_TEST_ENV_ROOT before `go test ./scripts/...`; confirmed the fix resolves it; re-ran bazel test //scripts:scripts_test and scripts/ci/scripts-go-test.sh directly, both pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bench-ready-indexes | ||
| check-versions | ||
| checkworkflowtags | ||
| ci | ||
| gitattributespolicy | ||
| hooks | ||
| internal/testbash | ||
| migration-test | ||
| pr-lint | ||
| prlintmake | ||
| repro-be-1he-slow-path | ||
| repro-dolt-hang | ||
| repro-dolt-prod-timeouts | ||
| workflowtags | ||
| bazel-autofix-push.sh | ||
| bazel_autofix_push_test.go | ||
| bazel_cache_mode_test.go | ||
| bazel_farm_workflow_test.go | ||
| bazel_policy_test.go | ||
| bazel_skip_allowlist_test.go | ||
| build-examples.sh | ||
| BUILD.bazel | ||
| bump-version.sh | ||
| check-build-tags.sh | ||
| check-cli-docs-drift.sh | ||
| check-doc-flags.sh | ||
| check-doc-freshness.sh | ||
| check-go-install-guidance.sh | ||
| check-migration-hygiene.sh | ||
| check-testing-short.sh | ||
| check-versions.sh | ||
| check-winget-portable-alias.sh | ||
| check_build_tags_test.go | ||
| check_doc_freshness_test.go | ||
| check_testing_short_test.go | ||
| check_winget_portable_alias_test.go | ||
| ci_capability_selector_test.go | ||
| ci_workflow_apt_get_timeout_test.go | ||
| ci_workflow_test.go | ||
| clean-test-tmp.sh | ||
| complexity_script_test.go | ||
| conformance.sh | ||
| conformance_script_test.go | ||
| cross-version-smoke-test.sh | ||
| docs-autofix-push.sh | ||
| docs.md | ||
| gen-winres.sh | ||
| generate-cli-docs.sh | ||
| generate-newsletter.py | ||
| generate-newsletter_README.md | ||
| gh-body-lint | ||
| host_tools_test.go | ||
| install-hooks.sh | ||
| install.sh | ||
| install_dolt_test.go | ||
| migrate-jsonl-to-dolt.sh | ||
| migrate-legacy-to-current.sh | ||
| mutation-equivalence.sh | ||
| pr-preflight.sh | ||
| pr_lanes_bazel_coverage_test.go | ||
| pr_preflight_test.go | ||
| pr_risk_bazel_coverage_test.go | ||
| pull_dolt_image_test.go | ||
| README.md | ||
| release.sh | ||
| release_script_test.go | ||
| required_suite_test.go | ||
| resolve-docs-bd.sh | ||
| sign-windows.sh | ||
| test-cgo.sh | ||
| test-git-remote.sh | ||
| test-icu-path.sh | ||
| test.sh | ||
| test_script_test.go | ||
| update-nix-vendorhash.sh | ||
| update-versions.sh | ||
| update-winget.sh | ||
| upgrade-smoke-test.sh | ||
| upgrade_smoke_loop_test.go | ||
| verify-cgo.sh | ||
| windows_test_binaries_manifest_test.go | ||
Beads Scripts
Utility scripts for maintaining the beads project.
ci/
Repository-owned CI command wrappers. These scripts are the source of truth for the target CI tiers; Make targets are aliases for local discoverability.
make ci-pr-core
make ci-pr-policy
make ci-pr-lint
make ci-package-mcp
make ci-package-npm
Each wrapper auto-detects the repository root, sources .buildflags when it
invokes Go in the default build mode, and records per-command timing through
scripts/ci/lib/timing.sh.
ci-pr-lint keeps its supported Bash/Make entrypoint but delegates native and
Windows/non-CGO target selection to the checkout-owned scripts/pr-lint Go
driver. This is the same shell-free lint authority used by bd preflight in a
Beads source checkout.
Broad Go test wrappers also source scripts/ci/lib/test-env.sh, which creates a
temporary HOME/XDG/Dolt root, isolates Git global/system config, clears runtime
Beads/Dolt environment variables, and sets BEADS_TEST_SKIP=dolt before tests
run. This keeps local make test and make ci-pr-core results comparable to
the fast PR-core contract even on shared agent hosts. Set
BEADS_TEST_ENV_RUN_DOLT=1 only when intentionally running the Dolt-dependent
tests through these broad wrappers, or BEADS_TEST_ENV_DISABLE=1 when debugging
against your real local configuration.
The broad Go wrappers also cap package and test parallelism to 4 by default
(GO_TEST_PKG_PARALLEL and GO_TEST_PARALLEL). This avoids turning high-core
shared hosts into a different test topology than GitHub Actions.
make ci-pr-policy includes scripts/check-testing-short.sh, which enforces
that testing.Short() is only used for runtime, stress, or large-fixture skips.
Use build tags, environment checks, or named wrappers for integration/e2e/API
boundaries.
Package gate wrappers validate publishable/package-adjacent surfaces:
make ci-package-mcpbuilds or consumes abdbinary, puts it onPATHasbd, then runs locked MCP packageuv sync, Ruff, mypy, pytest, and build checks.make ci-package-npmbuilds or consumes the native binary expected bynpm-package/bin/bd, runs the npm package test suite, and checksnpm pack --dry-run.
Set BEADS_TEST_BD_BINARY=/path/to/bd for MCP and npm package gates to reuse a
prebuilt candidate binary instead of rebuilding it inside the wrapper.
pr-preflight.sh
Read-only PR safety check for agents and maintainers.
# Before implementing or opening a related PR
./scripts/pr-preflight.sh --search "topic keywords" --repo gastownhall/beads
# Before changing, closing, or merging an existing PR
./scripts/pr-preflight.sh 123 --repo gastownhall/beads
It reports contributor/fork status, draft/review/merge/check state, risky diff
signals such as .beads/ changes or missing tests, and the required
contributor-protection next steps. It does not replace code review or local
validation.
Base-branch health is supplemented by a warn-only PR-gate sample: the last 60
completed pull_request-event runs, grouped per workflow. A single workflow
whose decisive runs (>= 5, across >= 3 distinct head branches) are all
failure-class is reported as a broken PR gate — the case where a job that
exists only in the PR workflow is red for every PR while the base branch shows
green. This detector never blocks (deliberately: automation classifies
unrecognized [block] lines as genuine merge blockers and would park merge
lanes on a false positive); it is skipped entirely while the base branch is
red.
gh-body-lint
Lint Markdown files before posting them with gh ... --body-file.
./scripts/gh-body-lint body.md
./scripts/gh-body-lint --fix body.md
The lint catches literal \n sequences, which render poorly on GitHub, and
GH#123 references, which do not auto-link like #123 or owner/repo#123.
release.sh (⭐ The Easy Button)
One-command release from version bump to local installation.
Usage
# Full release (does everything)
./scripts/release.sh 0.9.3
# Preview what would happen
./scripts/release.sh 0.9.3 --dry-run
What It Does
This master script automates the entire release process:
- ✅ Stops running Dolt servers (avoids version conflicts)
- ✅ Runs tests and linting
- ✅ Bumps version in all files
- ✅ Commits and pushes version bump
- ✅ Creates and pushes git tag
- ✅ Verifies or opens the Homebrew core formula PR
- ✅ Upgrades local Homebrew installation
- ✅ Verifies everything works
After this script completes, your system is running the new version!
Examples
# Release version 0.9.3
./scripts/release.sh 0.9.3
# Preview a release (no changes made)
./scripts/release.sh 1.0.0 --dry-run
Prerequisites
- Clean git working directory
- All changes committed
- golangci-lint installed
- Homebrew installed (for local upgrade)
- Push access to gastownhall/beads
Output
The script provides colorful, step-by-step progress output:
- 🟨 Yellow: Current step
- 🟩 Green: Step completed
- 🟥 Red: Errors
- 🟦 Blue: Section headers
What Happens Next
After the script finishes:
- GitHub Actions builds binaries for all platforms (~5 minutes)
- PyPI package is published automatically
- Homebrew core formula is verified or tracked through its canonical PR
- Users can
brew upgrade beadsto get the new version after Homebrew merges - GitHub Release is created with binaries and changelog
bump-version.sh
Bumps the version number across all beads components in a single command.
Usage
# Show usage
./scripts/bump-version.sh
# Update versions (shows diff, no commit)
./scripts/bump-version.sh 0.9.3
# Update versions and auto-commit
./scripts/bump-version.sh 0.9.3 --commit
What It Does
Updates version in all these files:
cmd/bd/version.go- bd CLI version constantplugins/beads/.claude-plugin/plugin.json- Claude plugin versionplugins/beads/.codex-plugin/plugin.json- Codex plugin version.claude-plugin/marketplace.json- Claude marketplace plugin versionintegrations/beads-mcp/pyproject.toml- MCP server versionREADME.md- Alpha status versionPLUGIN.md- Version requirements
Features
- Validates semantic versioning format (MAJOR.MINOR.PATCH)
- Verifies all versions match after update
- Shows git diff of changes
- Auto-commits with standardized message (optional)
- Cross-platform compatible (macOS and Linux)
Examples
# Bump to 0.9.3 and review changes
./scripts/bump-version.sh 0.9.3
# Review the diff, then manually commit
# Bump to 1.0.0 and auto-commit
./scripts/bump-version.sh 1.0.0 --commit
git push origin main
Why This Script Exists
Previously, version bumps only updated cmd/bd/version.go, leaving other components out of sync. This script ensures all version numbers stay consistent across the project.
Safety
- Checks for uncommitted changes before proceeding
- Refuses to auto-commit if there are existing uncommitted changes
- Validates version format before making any changes
- Verifies all versions match after update
- Shows diff for review before commit
sign-windows.sh
Signs Windows executables with an Authenticode certificate using osslsigncode.
Usage
# Sign a Windows executable
./scripts/sign-windows.sh path/to/bd.exe
# Environment variables required for signing:
export WINDOWS_SIGNING_CERT_PFX_BASE64="<base64-encoded-pfx>"
export WINDOWS_SIGNING_CERT_PASSWORD="<certificate-password>"
What It Does
This script is called automatically by GoReleaser during the release process:
- Decodes the PFX certificate from base64
- Signs the Windows executable using osslsigncode
- Timestamps the signature using DigiCert's RFC3161 server
- Replaces the original binary with the signed version
- Verifies the signature was applied correctly
Prerequisites
osslsigncodeinstalled (apt install osslsigncodeorbrew install osslsigncode)- EV code signing certificate exported as PFX file
- GitHub secrets configured:
WINDOWS_SIGNING_CERT_PFX_BASE64- base64-encoded PFX fileWINDOWS_SIGNING_CERT_PASSWORD- certificate password
Graceful Degradation
If the signing secrets are not configured:
- The script prints a warning and exits successfully
- GoReleaser continues without signing
- The release proceeds with unsigned Windows binaries
This allows releases to work before a certificate is acquired.
Why This Script Exists
Windows code signing helps reduce antivirus false positives that affect Go binaries.
Kaspersky and other AV software commonly flag unsigned Go executables as potentially
malicious due to heuristic detection. See docs/reference/antivirus.md for details.
Future Scripts
Additional maintenance scripts may be added here as needed.