Compare commits
1 commit
main
...
ci/bazel-w
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16e8f1fe12 |
13 changed files with 281 additions and 1521 deletions
153
.github/workflows/main.yml
vendored
153
.github/workflows/main.yml
vendored
|
|
@ -13,98 +13,6 @@ env:
|
|||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
# F4.7: pr.yml's `windows-test-binaries` job only restores the module cache
|
||||
# and the Windows cross-compile GOCACHE; PR workflows never save caches
|
||||
# (forks and same-repo PRs alike would otherwise be able to poison a
|
||||
# shared key). This is the seeder, mirroring build-artifacts' and test's
|
||||
# module/GOCACHE save pattern for the one new cache key xcompile added.
|
||||
#
|
||||
# Two legs, not one: pr.yml's windows-test-binaries job (pr.yml:522) lands
|
||||
# on `blacksmith-8vcpu-ubuntu-2404` for same-repo PRs/merge_group and
|
||||
# `ubuntu-latest` for forks/Dependabot. `runner.os`/`runner.arch` alone
|
||||
# look identical between those two (both report Linux/X64), but Blacksmith
|
||||
# runners cannot see caches `actions/cache` saved from a GitHub-hosted
|
||||
# runner (and vice versa): the cache storage is scoped to the runner
|
||||
# infrastructure, not just the key. A single ubuntu-latest seeder leg would
|
||||
# therefore only ever warm the fork-PR path and leave every same-repo PR
|
||||
# (the common case) cold on every run. Seeding from both runner selections,
|
||||
# with identical keys/paths, covers both consumer legs. The ternary form
|
||||
# (rather than a literal Blacksmith label in a matrix array) is required
|
||||
# for actionlint: it resolves literal matrix arrays of runner labels and
|
||||
# fails on an undeclared self-hosted label, but treats a ternary
|
||||
# expression as a dynamic value it can't resolve, and skips validation --
|
||||
# the same reason every other Blacksmith `runs-on` in this repo uses the
|
||||
# ternary form.
|
||||
windows-test-binaries-cache:
|
||||
name: Save Windows test binaries cache
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: [blacksmith, github]
|
||||
runs-on: ${{ matrix.runner == 'blacksmith' && '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
|
||||
id: 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 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)
|
||||
id: restore-xcompile-go-build-cache
|
||||
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: Save Go module cache
|
||||
if: ${{ !cancelled() && steps.restore-go-module-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@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') }}
|
||||
|
||||
- name: Save Go build cache (Windows cross-compile)
|
||||
if: ${{ !cancelled() && steps.restore-xcompile-go-build-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@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 }}
|
||||
|
||||
|
||||
# macOS full -race -short suite. Linux runs the same suite under Bazel
|
||||
# (bazel.yml's `test` lane, on every push to main, executed on rbe-west),
|
||||
|
|
@ -202,30 +110,22 @@ jobs:
|
|||
# Windows uses -tags gms_pure_go to avoid the ICU regex dependency.
|
||||
# go-icu-regex's regex_windows.go also uses Go stdlib regexp (build tag: windows).
|
||||
# CGO is still required for gozstd (bundled C source) and the embedded dolt engine.
|
||||
# F7b: pr.yml's standalone Windows jobs (test-windows-liveness,
|
||||
# worktree-remove-windows, etc.) moved to same-repo Blacksmith
|
||||
# (blacksmith-*vcpu-windows-2025); this job's own module/non-race GOCACHE
|
||||
# saves already cover the fork/github path (windows-latest), but Blacksmith
|
||||
# runners cannot see caches `actions/cache` saved from a GitHub-hosted
|
||||
# runner (and vice versa) even for an identical key, so the `venue` matrix
|
||||
# dimension here seeds the Blacksmith selection too -- same reasoning as
|
||||
# windows-test-binaries-cache's `runner` matrix.
|
||||
# pr.yml's Windows jobs (test-windows-liveness, worktree-remove-windows,
|
||||
# etc.) run on Blacksmith Windows for every PR, forks included
|
||||
# (ga-96smfk.22), so this job seeds their module and non-race GOCACHEs on
|
||||
# that one runner selection: Blacksmith runners cannot see caches
|
||||
# `actions/cache` saved from a GitHub-hosted runner, and no GitHub-hosted
|
||||
# Windows consumer is left.
|
||||
test-windows:
|
||||
name: Test (Windows - smoke, ${{ matrix.venue }})
|
||||
name: Test (Windows - smoke)
|
||||
# F7b review fix (B2): push-to-main, same-repo only, like every saver
|
||||
# here (the repository check closes the fork gap). Pinned by
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
runs-on: ${{ matrix.venue == 'blacksmith' && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}
|
||||
# F7b review fix (S8): this job now runs on paid Blacksmith Windows
|
||||
# (4x billing) for its blacksmith venue leg; it previously had no
|
||||
# timeout-minutes at all. 20 matches test-windows-liveness's timeout
|
||||
# (S6) for consistency.
|
||||
runs-on: ${{ 'blacksmith-4vcpu-windows-2025' }}
|
||||
# F7b review fix (S8): paid Blacksmith Windows (4x billing). 20 matches
|
||||
# test-windows-liveness's timeout (S6) for consistency.
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
venue: [blacksmith, github]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
|
|
@ -245,11 +145,8 @@ jobs:
|
|||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# F7b review fix (S9): same Windows toolchain diagnostic as pr.yml's
|
||||
# moved Windows jobs, run here on the Blacksmith leg too (the venue
|
||||
# this job's github leg already exercises on windows-latest every push
|
||||
# without issue, so only the blacksmith leg's image is unverified).
|
||||
# Windows jobs.
|
||||
- name: Check Windows toolchain diagnostics
|
||||
if: matrix.venue == 'blacksmith'
|
||||
shell: bash
|
||||
run: go env CGO_ENABLED CC GOOS GOARCH
|
||||
|
||||
|
|
@ -291,11 +188,8 @@ jobs:
|
|||
# (blacksmith-4vcpu-windows-2025), so their cold `cmd/bd` test compiles
|
||||
# (the real long pole; see pr-preflight-platforms' S2 comment) get a
|
||||
# true cache hit. Confirmed to run under Git Bash on Windows (reviewer
|
||||
# verification); Blacksmith-leg only -- the github (windows-latest)
|
||||
# venue leg has no PR-side consumer for this namespace, so warming it
|
||||
# there would be wasted GitHub-hosted cache churn for no reader.
|
||||
# verification).
|
||||
- name: Warm non-race GOCACHE (Windows preflight/liveness consumers)
|
||||
if: matrix.venue == 'blacksmith'
|
||||
shell: bash
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
|
|
@ -317,30 +211,22 @@ jobs:
|
|||
|
||||
# macOS saver: pr.yml's pr-preflight-platforms and
|
||||
# check-doc-freshness-platforms macOS legs run on blacksmith-6vcpu-macos-26
|
||||
# for same-repo PRs/merge_group and on macos-latest for fork/Dependabot PRs,
|
||||
# and Blacksmith and GitHub-hosted runners cannot see each other's
|
||||
# actions/cache entries, so the `venue` matrix seeds both (same convention as
|
||||
# test-windows). This job is their only seeder
|
||||
# (and the Blacksmith leg also seeds the `test` job's module and non-race
|
||||
# caches), and runs only the shared warm-up those legs compile
|
||||
# for every PR, forks included (ga-96smfk.22). This job is their only
|
||||
# seeder (and also seeds the `test` job's module and non-race caches), and runs only the shared warm-up those legs compile
|
||||
# (warm-non-race-cache.sh, the same script the Windows seeder uses)
|
||||
# plus the non-test ./cmd/bd build -- no tests, so it stays a few minutes of
|
||||
# macOS time per push. Same push-to-main-only job guard (B2) and go.sum +
|
||||
# UTC-day cache keys (S7) as test-windows, so a PR can never
|
||||
# write this namespace and ordinary push traffic writes at most one
|
||||
# non-race entry per day per venue. Pinned by
|
||||
# non-race entry per day. Pinned by
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest,
|
||||
# TestBlacksmithSaverCacheKeysAreNotPerCommit and
|
||||
# TestBlacksmithMacOSSaverMatchesPRLegs.
|
||||
blacksmith-macos-go-build-cache:
|
||||
name: Warm macOS Go build cache (${{ matrix.venue }})
|
||||
runs-on: ${{ matrix.venue == 'blacksmith' && 'blacksmith-6vcpu-macos-26' || 'macos-latest' }}
|
||||
name: Warm macOS Go build cache
|
||||
runs-on: ${{ 'blacksmith-6vcpu-macos-26' }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
venue: [blacksmith, github]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
|
|
@ -371,9 +257,8 @@ jobs:
|
|||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
# Records each venue's toolchain in the log so an image drift between
|
||||
# Blacksmith and GitHub's macos-latest is visible next to the cache it
|
||||
# seeds.
|
||||
# Records the toolchain in the log so an image drift is visible next
|
||||
# to the cache it seeds.
|
||||
- name: Check macOS toolchain diagnostics
|
||||
run: |
|
||||
sw_vers
|
||||
|
|
|
|||
384
.github/workflows/pr.yml
vendored
384
.github/workflows/pr.yml
vendored
|
|
@ -23,24 +23,16 @@ concurrency:
|
|||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
# 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, so a re-run can never
|
||||
# change it.
|
||||
WINDOWS_PREBUILT_REQUIRED: "true"
|
||||
# bazel.yml's bazel-cmd-dolt lane (the cmd/bd Dolt-server tier: the
|
||||
# Dolt-gated cmd/bd tests no other lane runs) is advisory while this is
|
||||
# "false": it runs and reports in the bazel call (continue-on-error, so a
|
||||
# failure never turns the call's aggregate red), and ci-gate ignores its
|
||||
# BAZEL_CMD_DOLT result. "true" adds BAZEL_CMD_DOLT to CI_GATE_REQUIRED in
|
||||
# the "Evaluate CI gate" step's run script; bazel-gate.sh still accepts
|
||||
# its skip in modes skip and local. Committed, not a repo variable, for
|
||||
# the same reason as WINDOWS_PREBUILT_REQUIRED above. The `bazel` job's cmd-dolt-required
|
||||
# its skip in modes skip and local. Committed, not a repo variable, so a
|
||||
# re-run can never change it. 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
|
||||
|
|
@ -132,26 +124,18 @@ jobs:
|
|||
# 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`).
|
||||
# Blacksmith Windows (blacksmith-4vcpu-windows-2025: GitHub's windows-2025
|
||||
# image minus the full Visual Studio IDE/EdgeDriver/WinAppDriver, VS Build
|
||||
# Tools 2022 present, no Linux Docker) for every PR and merge group, forks
|
||||
# and Dependabot included (ga-96smfk.22): Windows and macOS jobs run on
|
||||
# Blacksmith, everything Linux under Bazel on rbe-west. The first step
|
||||
# builds ./cmd/bd with CGO_ENABLED=1 (embedded Dolt); the toolchain
|
||||
# diagnostic step below prints which cgo toolchain backs it. Since
|
||||
# ga-96smfk.22 this job (not a cross-compiled "-prebuilt" twin) is the
|
||||
# required run of these tests.
|
||||
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' }}
|
||||
runs-on: ${{ 'blacksmith-4vcpu-windows-2025' }}
|
||||
# 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
|
||||
|
|
@ -263,12 +247,12 @@ jobs:
|
|||
# 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
|
||||
# Blacksmith Windows (blacksmith-2vcpu-windows-2025) for every PR; 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' }}
|
||||
runs-on: ${{ 'blacksmith-2vcpu-windows-2025' }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
|
@ -304,13 +288,12 @@ jobs:
|
|||
# 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).
|
||||
# Blacksmith Windows (blacksmith-4vcpu-windows-2025) for every PR.
|
||||
# CGO_ENABLED=0 below, so no cgo-toolchain risk; its non-race GOCACHE
|
||||
# restore-keys prefix gets a hit from main.yml's test-windows job, which
|
||||
# saves that key on this exact runner selection (restore-keys falls back
|
||||
# to the most recent prefix match regardless of the exact sha). Since
|
||||
# ga-96smfk.22 this job is the required run of these tests.
|
||||
#
|
||||
# RISK (F7b review: not flagged in the original implementation --
|
||||
# cmd/bd/worktree_remove_git_windows_test.go:233 shells out to
|
||||
|
|
@ -321,12 +304,11 @@ jobs:
|
|||
# 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.
|
||||
# roll back this job's runs-on to the literal `windows-latest` 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' }}
|
||||
runs-on: ${{ 'blacksmith-4vcpu-windows-2025' }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
|
@ -373,203 +355,6 @@ jobs:
|
|||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: go test -tags gms_pure_go -count=1 -run '^TestWorktreeRemove' ./cmd/bd
|
||||
|
||||
# F4 side-by-side rollout (advisory phase): cross-compiles the Windows test
|
||||
# binaries this file's native Windows jobs need, from a committed manifest
|
||||
# (scripts/ci/windows-test-binaries.txt), on a Linux runner via mingw-w64 --
|
||||
# the same toolchain release.yml's goreleaser job uses for the shipped
|
||||
# bd-windows-amd64 binary (CC=x86_64-w64-mingw32-gcc; see .goreleaser.yml).
|
||||
# The "-prebuilt" twin jobs below download this artifact and run it
|
||||
# natively on windows-latest instead of compiling there, so the CGO build
|
||||
# that otherwise runs once per Windows job runs here once instead.
|
||||
#
|
||||
# Deliberately advisory only: the native `test-windows-liveness` and
|
||||
# `worktree-remove-windows` jobs above are untouched and still the only
|
||||
# required pair while WINDOWS_PREBUILT_REQUIRED (top of this file) is
|
||||
# "false". ci-gate does wait on this job's two twins below (they are in its
|
||||
# `needs`), but neither twin's result is in CI_GATE_REQUIRED yet -- the
|
||||
# side-by-side phase runs both paths on every PR so a policy test
|
||||
# (TestWindowsTestBinariesSelectSameTestsAsNativeJobs, in
|
||||
# scripts/windows_test_binaries_manifest_test.go) can confirm they select
|
||||
# the same tests before anyone flips WINDOWS_PREBUILT_REQUIRED to "true".
|
||||
#
|
||||
# Manifest is intentionally partial in this phase: it covers only the two
|
||||
# cmd/bd-backed jobs twinned below. Forks and Dependabot PRs get no
|
||||
# secrets here, same as every job in this file -- cross-compiling and
|
||||
# uploading an artifact needs none.
|
||||
windows-test-binaries:
|
||||
name: Build Windows test binaries (cross-compile)
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Restore Go module cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.mod', 'go.sum') }}
|
||||
restore-keys: beads-go-mod-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
- name: Verify Go module checksums
|
||||
run: go mod verify
|
||||
|
||||
- name: Install mingw cross-compiler
|
||||
timeout-minutes: 12
|
||||
run: |
|
||||
updated=""
|
||||
for attempt in 1 2 3; do
|
||||
if sudo timeout 120 apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 update; then
|
||||
updated=yes
|
||||
break
|
||||
fi
|
||||
echo "::warning::apt-get update attempt $attempt failed or timed out"
|
||||
if [ "$attempt" -lt 3 ]; then sleep 10; fi
|
||||
done
|
||||
if [ -z "$updated" ]; then
|
||||
echo "::warning::apt-get update failed after 3 attempts; proceeding with cached index"
|
||||
fi
|
||||
sudo timeout 300 apt-get install -y gcc-mingw-w64-x86-64
|
||||
|
||||
- name: Restore Go build cache (Windows cross-compile)
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/xcompile-windows-amd64
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-xcompile-windows-amd64-${{ github.sha }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-xcompile-windows-amd64-
|
||||
|
||||
- name: Build Windows test binaries
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/xcompile-windows-amd64
|
||||
run: bash scripts/ci/build-windows-test-binaries.sh "$RUNNER_TEMP/win-bin"
|
||||
|
||||
- name: Upload Windows test binaries
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: windows-test-binaries
|
||||
path: ${{ runner.temp }}/win-bin
|
||||
retention-days: 1
|
||||
compression-level: 1
|
||||
if-no-files-found: error
|
||||
|
||||
# Advisory twin of test-windows-liveness: runs the identical test selection,
|
||||
# flags, and env on windows-latest, but against the binary
|
||||
# windows-test-binaries cross-compiled instead of compiling here. Step
|
||||
# names, -run patterns, -count, and the PASS/FAIL parsing block are kept
|
||||
# byte-for-byte equivalent to the native job on purpose --
|
||||
# TestWindowsTestBinariesSelectSameTestsAsNativeJobs checks the -run
|
||||
# literals stay in sync.
|
||||
# F7b: same-repo Blacksmith (blacksmith-2vcpu-windows-2025). This leg only
|
||||
# runs a prebuilt binary (cross-compiled on Linux by windows-test-binaries
|
||||
# via mingw-w64) rather than compiling with cgo on the Windows runner
|
||||
# itself, so it carries none of test-windows-liveness's cgo-toolchain risk.
|
||||
test-windows-liveness-prebuilt:
|
||||
name: Test (Windows, prebuilt) cmd/bd liveness regression
|
||||
needs: windows-test-binaries
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-windows-2025' || 'windows-latest' }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Download Windows test binaries
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: windows-test-binaries
|
||||
path: ${{ runner.temp }}/win-bin
|
||||
|
||||
- name: Verify downloaded binaries
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/win-bin"
|
||||
sha256sum -c SHA256SUMS
|
||||
|
||||
# F7b review fix (S9): these binaries are cgo-linked on Linux via
|
||||
# mingw-w64 (windows-test-binaries), not compiled on this runner, so
|
||||
# the risk here is specifically whether a cross-compiled binary loads
|
||||
# and runs at all on Blacksmith's windows-2025 image (missing runtime
|
||||
# DLLs, etc.), not the cgo-toolchain risk test-windows-liveness
|
||||
# carries. `-run '^$'` loads/links the binary and matches no tests, so
|
||||
# a load failure surfaces here instead of inside the real test step.
|
||||
- name: Check prebuilt Windows binary loads
|
||||
shell: bash
|
||||
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe" ./cmd/bd -run '^$' -count=1
|
||||
|
||||
- name: Run native Windows global Prime override (prebuilt)
|
||||
shell: bash
|
||||
run: |
|
||||
export BEADS_TEST_PREBUILT_TEST_BINARY="$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe"
|
||||
export BEADS_TEST_BD_BINARY="$RUNNER_TEMP/win-bin/bd.exe"
|
||||
go_path=$(command -v go)
|
||||
[[ "$("$go_path" env GOHOSTOS GOOS)" == $'windows\nwindows' ]]
|
||||
test_status=0
|
||||
test_output=$(./scripts/test.sh -v -timeout 5m -run '^TestPrimeBinaryPortfolio$/^TestPrime_HookJSON_GlobalPrimeOverride$' -count=1 ./cmd/bd) || test_status=$?
|
||||
printf '%s\n' "$test_output"
|
||||
((test_status == 0))
|
||||
pass_pattern='^[[:space:]]*--- PASS: TestPrimeBinaryPortfolio/TestPrime_HookJSON_GlobalPrimeOverride \('
|
||||
nonpass_pattern='^[[:space:]]*--- (FAIL|SKIP): '
|
||||
pass_count=0
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" =~ $pass_pattern ]]; then
|
||||
((pass_count += 1))
|
||||
fi
|
||||
if [[ "$line" =~ $nonpass_pattern ]]; then
|
||||
exit 1
|
||||
fi
|
||||
done <<<"$test_output"
|
||||
((pass_count == 1))
|
||||
|
||||
- name: Run Windows liveness regression test (prebuilt)
|
||||
shell: bash
|
||||
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-cgo.test.exe" ./cmd/bd -run '^TestIsServerProbablyRunning' -count=1
|
||||
|
||||
# Advisory twin of worktree-remove-windows: same package, -run pattern, and
|
||||
# CGO_ENABLED=0 selection as the native job, but against the cgo=0 binary
|
||||
# windows-test-binaries cross-compiled instead of compiling here.
|
||||
# F7b: same-repo Blacksmith (blacksmith-2vcpu-windows-2025); same prebuilt-
|
||||
# binary rationale as test-windows-liveness-prebuilt above.
|
||||
worktree-remove-windows-prebuilt:
|
||||
name: Worktree remove boundary (Windows, prebuilt)
|
||||
needs: windows-test-binaries
|
||||
runs-on: ${{ (github.event_name == 'merge_group' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')) && 'blacksmith-2vcpu-windows-2025' || 'windows-latest' }}
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Download Windows test binaries
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: windows-test-binaries
|
||||
path: ${{ runner.temp }}/win-bin
|
||||
|
||||
- name: Verify downloaded binaries
|
||||
shell: bash
|
||||
run: |
|
||||
cd "$RUNNER_TEMP/win-bin"
|
||||
sha256sum -c SHA256SUMS
|
||||
|
||||
# F7b review fix (S9): see test-windows-liveness-prebuilt's identical
|
||||
# step for the full rationale.
|
||||
- name: Check prebuilt Windows binary loads
|
||||
shell: bash
|
||||
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-nocgo.test.exe" ./cmd/bd -run '^$' -count=1
|
||||
|
||||
- name: Run native Windows worktree removal boundary tests (prebuilt)
|
||||
shell: bash
|
||||
run: bash scripts/ci/run-go-test-binary.sh "$RUNNER_TEMP/win-bin/cmd-bd-nocgo.test.exe" ./cmd/bd -run '^TestWorktreeRemove' -count=1
|
||||
|
||||
# Check documentation references match actual CLI flags
|
||||
#
|
||||
# Stays a job: the generated CLI docs describe the release pinned in
|
||||
|
|
@ -631,35 +416,19 @@ jobs:
|
|||
# (integration lane: the doc-freshness suite under -required-suite) and
|
||||
# //scripts/gitattributespolicy:gitattributespolicy_required_host_test
|
||||
# (-required-host -expected-goos linux), both on rbe-west's Linux workers.
|
||||
# The macOS and Windows legs stay here, on Blacksmith for same-repo PRs and
|
||||
# merge groups (GitHub-hosted for forks and Dependabot).
|
||||
#
|
||||
# F7b: same-repo Blacksmith for the Linux/Windows legs via the "matrix
|
||||
# marker" form (spec F7/F7b §2.1): Actions does not expand `${{ }}` inside a
|
||||
# matrix array/include value, so each leg's `include` entry instead carries
|
||||
# a plain string `runner` marker, and the job's `runs-on` is a single
|
||||
# chained ternary (sameRepoPlatformsMatrixMarkerRunsOn in
|
||||
# scripts/ci_blacksmith_runner_test.go) that resolves per-marker, falling
|
||||
# back to `matrix.os` for forks/Dependabot (each marker's own same-repo
|
||||
# condition false) or any leg with no marker. Every leg now restores a
|
||||
# non-race Go build cache seeded by main.yml's push-to-main savers on the
|
||||
# exact same runner selection (S2 below).
|
||||
#
|
||||
# The macOS leg moves to same-repo Blacksmith macOS
|
||||
# (blacksmith-6vcpu-macos-26, Apple Silicon) like the other two legs; forks,
|
||||
# Dependabot and any non-PR event keep GitHub-hosted macos-latest. The label
|
||||
# is pinned to macos-26 because that is the image GitHub's macos-latest
|
||||
# resolves to today (macos-26-arm64), so both paths run the same OS and
|
||||
# architecture; bump it together with GitHub's macos-latest migration.
|
||||
# 6 vCPU (vs. macos-latest's 3) is already 2x the GitHub-hosted leg; the
|
||||
# 12 vCPU size is not justified for a leg dominated by one incremental
|
||||
# ./cmd/bd test compile. This reverses F7b review fix S3 (cost accepted):
|
||||
# main.yml's blacksmith-macos-go-build-cache job is the push-to-main
|
||||
# Blacksmith-macOS saver S3 said was missing, on this exact label, and the
|
||||
# GitHub-hosted fork path still restores main.yml's `test` job macOS leg.
|
||||
# The macOS and Windows legs stay here, on Blacksmith for every PR and
|
||||
# merge group, forks and Dependabot included (ga-96smfk.22). Each leg's
|
||||
# `include` entry names its Blacksmith label in `runner` (`os` keeps the
|
||||
# check names stable and selects the Windows-only steps). Every leg
|
||||
# restores a non-race Go build cache seeded by main.yml's push-to-main
|
||||
# savers on the exact same label (S2 below): test-windows for Windows,
|
||||
# blacksmith-macos-go-build-cache for macOS. The macOS label is pinned to
|
||||
# macos-26 (Apple Silicon, the image GitHub's macos-latest resolves to);
|
||||
# 6 vCPU is enough for a leg dominated by one incremental ./cmd/bd test
|
||||
# compile.
|
||||
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 }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
|
@ -667,10 +436,10 @@ jobs:
|
|||
include:
|
||||
- os: macos-latest
|
||||
expected_goos: darwin
|
||||
runner: same-repo-macos
|
||||
runner: blacksmith-6vcpu-macos-26
|
||||
- os: windows-latest
|
||||
expected_goos: windows
|
||||
runner: same-repo-windows
|
||||
runner: blacksmith-4vcpu-windows-2025
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
|
|
@ -711,10 +480,14 @@ jobs:
|
|||
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).
|
||||
# Blacksmith macOS and Windows legs, labels in the matrix (see
|
||||
# check-doc-freshness-platforms above). The Linux leg is retired
|
||||
# (ga-96smfk.22): every Linux step's tests run under Bazel on rbe-west
|
||||
# (//scripts:scripts_test, //cmd/bd:bd_test, //internal/config:config_test).
|
||||
# Only the two
|
||||
# tests of go test's own bd build fallback
|
||||
# (tools/bazel/equivalence_allowlist.txt) skip under Bazel; they keep
|
||||
# running here on macOS and Windows.
|
||||
#
|
||||
# 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
|
||||
|
|
@ -728,21 +501,18 @@ jobs:
|
|||
# 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 }}
|
||||
runs-on: ${{ matrix.runner }}
|
||||
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
|
||||
runner: blacksmith-6vcpu-macos-26
|
||||
- os: windows-latest
|
||||
expected_goos: windows
|
||||
runner: same-repo-windows
|
||||
runner: blacksmith-4vcpu-windows-2025
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
|
|
@ -761,16 +531,14 @@ jobs:
|
|||
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.
|
||||
# push-to-main saver on the exact same Blacksmith label (Windows:
|
||||
# main.yml's test-windows; macOS: main.yml's
|
||||
# blacksmith-macos-go-build-cache) 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 mainBlacksmithWindows4vcpuRunsOn 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:
|
||||
|
|
@ -1032,10 +800,8 @@ jobs:
|
|||
# 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).
|
||||
# give for free.
|
||||
# Blacksmith Windows (blacksmith-4vcpu-windows-2025) for every PR.
|
||||
#
|
||||
# RISK (unverified from this sandbox, flagged in the F7b report): the
|
||||
# native-Make step below assumes Chocolatey is preinstalled (`choco
|
||||
|
|
@ -1046,12 +812,11 @@ jobs:
|
|||
# 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`).
|
||||
# risk. If only the 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' }}
|
||||
runs-on: ${{ 'blacksmith-4vcpu-windows-2025' }}
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
|
@ -1085,8 +850,7 @@ jobs:
|
|||
# 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
|
||||
# own `cache` input). Pinned by
|
||||
# TestBlacksmithReachablePRJobsDisableDefaultCachingActions.
|
||||
- name: Set up MSYS2 GNU Make
|
||||
id: install-msys2
|
||||
|
|
@ -1611,8 +1375,6 @@ jobs:
|
|||
- fast-checks
|
||||
- test-windows-liveness
|
||||
- worktree-remove-windows
|
||||
- test-windows-liveness-prebuilt
|
||||
- worktree-remove-windows-prebuilt
|
||||
- check-doc-flags
|
||||
- check-doc-freshness-platforms
|
||||
- pr-preflight-platforms
|
||||
|
|
@ -1634,6 +1396,8 @@ jobs:
|
|||
PR_PREFLIGHT_PLATFORMS
|
||||
PACKAGE_MCP
|
||||
PACKAGE_NPM
|
||||
TEST_WINDOWS_LIVENESS
|
||||
WORKTREE_REMOVE_WINDOWS
|
||||
WINDOWS_MAKE_SHELL
|
||||
BAZEL
|
||||
BAZEL_TEST
|
||||
|
|
@ -1660,12 +1424,6 @@ jobs:
|
|||
FAST_CHECKS: ${{ needs.fast-checks.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 }}
|
||||
|
|
@ -1697,22 +1455,6 @@ jobs:
|
|||
BAZEL_RBE_ENABLED: ${{ needs.bazel.outputs.rbe-enabled }}
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1186,38 +1186,53 @@ What stays a job, and why:
|
|||
`go build`), and attributes drift against the merge-base. Releases publish
|
||||
no pure-Go Linux binary a Bazel repository could pin by sha256.
|
||||
- The macOS and Windows legs of `check-doc-freshness-platforms` (no remote
|
||||
workers for those hosts), on Blacksmith for same-repo PRs and merge groups.
|
||||
workers for those hosts), on Blacksmith for every PR and merge group.
|
||||
|
||||
`check-doc-freshness.sh` compares review dates with today's date, which is
|
||||
not in the action key: a cached pass stands until one of its inputs changes,
|
||||
and nightly's `--config=fresh` run re-checks it against the date.
|
||||
|
||||
### Same-Repo Blacksmith macOS Legs
|
||||
### Blacksmith Windows and macOS Jobs
|
||||
|
||||
pr.yml's two mixed-OS matrix jobs, `pr-preflight-platforms` and
|
||||
`check-doc-freshness-platforms`, run their macOS leg on
|
||||
`blacksmith-6vcpu-macos-26` (Apple Silicon) for same-repo PRs and
|
||||
merge_group, through the same `runner: same-repo-macos` matrix marker and
|
||||
same-repo expression their Linux/Windows legs use. Forks, Dependabot and
|
||||
every other event keep GitHub-hosted `macos-latest`. They are the only PR
|
||||
Every Windows and macOS job runs on Blacksmith for every PR and merge group,
|
||||
forks and Dependabot included (ga-96smfk.22); everything Linux runs under
|
||||
Bazel on rbe-west. pr.yml's Windows jobs (`test-windows-liveness`,
|
||||
`test-windows-small`, `worktree-remove-windows`, `windows-make-shell`) name
|
||||
their `blacksmith-*vcpu-windows-2025` label literally; the two mixed-OS
|
||||
matrix jobs, `pr-preflight-platforms` and `check-doc-freshness-platforms`,
|
||||
run a macOS leg on `blacksmith-6vcpu-macos-26` (Apple Silicon) and a Windows
|
||||
leg on `blacksmith-4vcpu-windows-2025`, each leg naming its label in the
|
||||
matrix (`runs-on: ${{ matrix.runner }}`). There is no GitHub-hosted fallback:
|
||||
Blacksmith serves this org's fork PRs (gascity's fork PRs run their CI on
|
||||
`blacksmith-*` labels). Fork runs get no secrets and a read-only token
|
||||
(`TestBlacksmithJobsReadNoSecrets` keeps every Blacksmith job free of secret
|
||||
reads), each job runs in a fresh VM, and the repository's fork-PR approval
|
||||
setting stays the boundary for who may run code there (a fork's own workflow
|
||||
file controls `runs-on` anyway). `release.yml` and `nightly.yml` are not PR
|
||||
checks and keep their own runners.
|
||||
|
||||
The Linux leg of `pr-preflight-platforms` and the Linux-cross-compiled
|
||||
Windows test binaries (`windows-test-binaries`, its "-prebuilt" twins,
|
||||
main.yml's `windows-test-binaries-cache` and the `WINDOWS_PREBUILT_REQUIRED`
|
||||
flag) are retired: Bazel runs the Linux leg's tests, and the native Windows
|
||||
pair (`test-windows-liveness`, `worktree-remove-windows`) is the required
|
||||
run of the twins' tests.
|
||||
macOS jobs; `release.yml` stays on `macos-latest`.
|
||||
|
||||
- **Label.** Pinned to `macos-26` because GitHub's `macos-latest` resolves to
|
||||
`macos-26-arm64` today, so both paths run the same OS and architecture and
|
||||
the PR legs and their saver never straddle a Blacksmith `-latest` alias
|
||||
move. Bump it when GitHub moves `macos-latest`. 6 vCPU is already twice
|
||||
`macos-latest`'s 3 vCPU; 12 vCPU is not justified for legs dominated by one
|
||||
incremental `./cmd/bd` test compile.
|
||||
move. Bump it when GitHub moves `macos-latest`. 12 vCPU is not justified
|
||||
for legs dominated by one incremental `./cmd/bd` test compile.
|
||||
- **Caches.** The legs stay restore-only (`setup-go` `cache: false`,
|
||||
`actions/cache/restore`). Blacksmith cannot see GitHub-saved caches, so
|
||||
main.yml's `blacksmith-macos-go-build-cache` job is their seeder: same
|
||||
label, push-to-main-only job guard, module cache plus a non-race GOCACHE
|
||||
keyed by `go.sum` and UTC day, warmed by the shared
|
||||
`scripts/ci/warm-non-race-cache.sh`. Its `github` venue leg seeds the
|
||||
fork path (`macos-latest`) the same way; main.yml's `test` job (the macOS
|
||||
full suite) runs on the same Blacksmith label and restores the Blacksmith
|
||||
leg's caches.
|
||||
- **Pins.** `TestSameRepoPlatformsMatrixMarkerRunsOnExpressionSemantics`,
|
||||
`scripts/ci/warm-non-race-cache.sh`. main.yml's `test` job (the macOS
|
||||
full suite) runs on the same label and restores its caches. main.yml's
|
||||
`test-windows` seeds the Windows legs the same way.
|
||||
- **Pins.** `TestBlacksmithWindowsMacOSRunsOnEveryEvent`,
|
||||
`TestBlacksmithMacOSSaverMatchesPRLegs`,
|
||||
`TestBlacksmithSaverJobsGuardedAgainstPullRequest`,
|
||||
`TestBlacksmithSaverCacheKeysAreNotPerCommit`,
|
||||
|
|
@ -1408,21 +1423,17 @@ check read.
|
|||
Non-Bazel required jobs re-run in full on every merge group (approximate
|
||||
PR timings, 2026-10): `fast-checks` (~40 s), `pr-policy-wrapper`
|
||||
(~2.5 min), `check-doc-flags` (~1.7 min),
|
||||
`check-doc-freshness-platforms` and `pr-preflight-platforms` (Linux,
|
||||
Windows and macOS legs, up to ~5 min on Windows),
|
||||
`windows-make-shell` (~2.7 min),
|
||||
`windows-test-binaries` plus the prebuilt Windows pair (~7 min end to
|
||||
end), the advisory native Windows pair (~5 min; the gate waits for them),
|
||||
`check-doc-freshness-platforms` and `pr-preflight-platforms` (Windows and
|
||||
macOS legs, up to ~5 min on Windows),
|
||||
`windows-make-shell` (~2.7 min), the native Windows pair
|
||||
(`test-windows-liveness`, `worktree-remove-windows`, ~1-5 min),
|
||||
`test-nix` (~3 min) and the package gates (seconds unless their paths
|
||||
changed). None caches results the way Bazel does; most are cheap or
|
||||
already path- or tier-gated. Candidates to skip on `merge_group`, not
|
||||
done here: the advisory native Windows pair (`test-windows-liveness`,
|
||||
`worktree-remove-windows`, advisory while `WINDOWS_PREBUILT_REQUIRED` is
|
||||
`"true"`), and the macOS legs of the preflight/doc-freshness matrices
|
||||
already path- or tier-gated. A candidate to skip on `merge_group`, not
|
||||
done here: the macOS legs of the preflight/doc-freshness matrices
|
||||
(platform behavior the PR run already checked on the same inputs). With
|
||||
result reuse the merge group's critical path is the Windows
|
||||
cross-compile and the Windows matrix legs (~5-7 min), not the Bazel
|
||||
lanes once their tests are cached. An entry's first build after a base
|
||||
result reuse the merge group's critical path is the Windows legs
|
||||
(~5 min), not the Bazel lanes once their tests are cached. An entry's first build after a base
|
||||
change still compiles what changed.
|
||||
|
||||
### Failures and flakes
|
||||
|
|
@ -1516,7 +1527,10 @@ PRs off Blacksmith entirely and back onto `ubuntu-latest`:
|
|||
Blacksmith cache seeds and the `scripts-go-checks`/`pr-lint-wrapper`/
|
||||
preflight/doc-freshness runner moves, including the preflight/
|
||||
doc-freshness macOS legs and `blacksmith-macos-go-build-cache`
|
||||
([Same-Repo Blacksmith macOS Legs](#same-repo-blacksmith-macos-legs)).
|
||||
([Blacksmith Windows and macOS Jobs](#blacksmith-windows-and-macos-jobs)).
|
||||
5. **ga-96smfk.22** — the Windows and macOS jobs' literal Blacksmith labels
|
||||
([Blacksmith Windows and macOS Jobs](#blacksmith-windows-and-macos-jobs)):
|
||||
during an outage point them back at `windows-latest` / `macos-latest`.
|
||||
|
||||
F7c (the advisory workflows) is excluded from this list: it is advisory only,
|
||||
so leaving it on Blacksmith during an outage delays non-required checks but
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ go_test(
|
|||
"required_suite_test.go",
|
||||
"test_script_test.go",
|
||||
"upgrade_smoke_loop_test.go",
|
||||
"windows_test_binaries_manifest_test.go",
|
||||
],
|
||||
data = [
|
||||
"//:repo_files",
|
||||
|
|
|
|||
|
|
@ -1,96 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Cross-compile the Windows test/bd binaries listed in
|
||||
# scripts/ci/windows-test-binaries.txt on a Linux runner, so the native
|
||||
# Windows CI jobs that consume them (today: the "-prebuilt" advisory twins of
|
||||
# test-windows-liveness and worktree-remove-windows) no longer pay for a CGO
|
||||
# compile inside windows-latest itself.
|
||||
#
|
||||
# Usage: build-windows-test-binaries.sh OUT_DIR
|
||||
#
|
||||
# For every non-comment, non-blank line "name cgo tags package" in the
|
||||
# manifest:
|
||||
# - name ending in ".test.exe" -> `go test -c` (a standalone test binary)
|
||||
# - anything else -> `go build` (a regular executable)
|
||||
#
|
||||
# cgo=1 entries cross-compile with the same mingw-w64 toolchain release.yml's
|
||||
# goreleaser job uses for the shipped bd-windows-amd64 binary
|
||||
# (CC=x86_64-w64-mingw32-gcc, CXX=x86_64-w64-mingw32-g++; see .goreleaser.yml).
|
||||
# cgo=0 entries build with CGO_ENABLED=0 and need no C toolchain.
|
||||
#
|
||||
# Writes OUT_DIR/SHA256SUMS so the Windows consumer jobs can verify the
|
||||
# artifact after download (`sha256sum -c`).
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
MANIFEST="$REPO_ROOT/scripts/ci/windows-test-binaries.txt"
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 OUT_DIR" >&2
|
||||
exit 2
|
||||
fi
|
||||
OUT_DIR="$1"
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
if [[ ! -f "$MANIFEST" ]]; then
|
||||
echo "manifest not found: $MANIFEST" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "== host go toolchain ==" >&2
|
||||
go env GOVERSION GOHOSTOS GOHOSTARCH >&2
|
||||
|
||||
if command -v x86_64-w64-mingw32-gcc >/dev/null 2>&1; then
|
||||
echo "== mingw-w64 cross-compiler ==" >&2
|
||||
x86_64-w64-mingw32-gcc --version | head -n1 >&2
|
||||
fi
|
||||
|
||||
built=0
|
||||
while IFS= read -r line; do
|
||||
# Strip comments and blank lines.
|
||||
line="${line%%#*}"
|
||||
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
||||
[[ -z "$line" ]] && continue
|
||||
|
||||
read -r name cgo tags package <<<"$line"
|
||||
if [[ -z "$name" || -z "$cgo" || -z "$tags" || -z "$package" ]]; then
|
||||
echo "malformed manifest line: $line" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
out="$OUT_DIR/$name"
|
||||
echo "== building $name (cgo=$cgo tags=$tags package=$package) ==" >&2
|
||||
|
||||
env_args=(GOOS=windows GOARCH=amd64 CGO_ENABLED="$cgo")
|
||||
if [[ "$cgo" == "1" ]]; then
|
||||
env_args+=(CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++)
|
||||
fi
|
||||
|
||||
# Print the resolved toolchain for this entry so the advisory-phase log
|
||||
# confirms native-vs-cross CGO parity (F4.8 item 3), without failing the
|
||||
# build if `go env` ever rejects one of the override vars up front.
|
||||
env "${env_args[@]}" go env CGO_ENABLED CC >&2 || true
|
||||
|
||||
start=$(date +%s)
|
||||
if [[ "$name" == *.test.exe ]]; then
|
||||
env "${env_args[@]}" go test -c -tags "$tags" -o "$out" "$package"
|
||||
else
|
||||
env "${env_args[@]}" go build -tags "$tags" -o "$out" "$package"
|
||||
fi
|
||||
elapsed=$(( $(date +%s) - start ))
|
||||
size=$(stat -c%s "$out" 2>/dev/null || stat -f%z "$out")
|
||||
echo "== built $name in ${elapsed}s (${size} bytes) ==" >&2
|
||||
|
||||
built=$((built + 1))
|
||||
done <"$MANIFEST"
|
||||
|
||||
if [[ "$built" -eq 0 ]]; then
|
||||
echo "manifest $MANIFEST produced zero binaries" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(
|
||||
cd "$OUT_DIR"
|
||||
sha256sum -- * >SHA256SUMS
|
||||
)
|
||||
echo "wrote $OUT_DIR/SHA256SUMS ($built binaries)" >&2
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Run a standalone `go test -c` binary (typically cross-compiled on a
|
||||
# different host, e.g. scripts/ci/build-windows-test-binaries.sh on Linux)
|
||||
# different host)
|
||||
# so that it behaves like `go test` would have, from the caller's point of
|
||||
# view: same cwd convention, same flag names, same BEADS_TEST_REPO_ROOT
|
||||
# resolution.
|
||||
|
|
@ -51,8 +51,8 @@
|
|||
# short-circuit, beads_test_env_enter's unset has already run by the time
|
||||
# control reaches here, so the line below's `${BEADS_TEST_REPO_ROOT:-...}`
|
||||
# always falls through to GITHUB_WORKSPACE -- exactly the value a CI runner
|
||||
# needs. When this script instead runs standalone (the "-prebuilt" jobs'
|
||||
# direct `run-go-test-binary.sh ...` steps, with no test.sh and no
|
||||
# needs. When this script instead runs standalone (a direct
|
||||
# `run-go-test-binary.sh ...` call, with no test.sh and no
|
||||
# beads_test_env_enter in between), there is nothing to have unset it, and
|
||||
# the same GITHUB_WORKSPACE fallback applies for the same reason.
|
||||
set -euo pipefail
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
# Manifest for the Windows cross-compile job (scripts/ci/build-windows-test-binaries.sh).
|
||||
#
|
||||
# Each non-comment, non-blank line is: name cgo tags package
|
||||
# name - output file name. A name ending in ".test.exe" is built with
|
||||
# `go test -c` (a standalone test binary); anything else is built
|
||||
# with `go build` (a regular executable, e.g. bd.exe).
|
||||
# cgo - 0 or 1. Matches what the native Windows job this binary replaces
|
||||
# used: explicit CGO_ENABLED=0 where the job set it, 1 where it
|
||||
# relied on the windows-latest runner default (which is 1 - gcc is
|
||||
# on PATH there). cgo=1 entries cross-compile with
|
||||
# CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++, the same
|
||||
# mingw toolchain release.yml's goreleaser job uses for the
|
||||
# shipped bd-windows-amd64 binary (see .goreleaser.yml).
|
||||
# tags - Go build tags, comma-separated, no spaces (e.g. gms_pure_go or
|
||||
# integration,gms_pure_go).
|
||||
# package - the Go package import path/pattern to build or test-compile.
|
||||
#
|
||||
# This is the advisory-phase manifest: it covers only the two cmd/bd-backed
|
||||
# Windows jobs that currently have "-prebuilt" twins
|
||||
# (test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt) in
|
||||
# pr.yml. The windows legs of pr-preflight-platforms and
|
||||
# check-doc-freshness-platforms, and the small CGO=0 packages, are unscheduled
|
||||
# follow-up work and are NOT yet listed here or consumed by any job.
|
||||
#
|
||||
# name cgo tags package
|
||||
bd.exe 1 gms_pure_go ./cmd/bd
|
||||
cmd-bd-cgo.test.exe 1 gms_pure_go ./cmd/bd
|
||||
cmd-bd-nocgo.test.exe 0 gms_pure_go ./cmd/bd
|
||||
|
|
@ -35,51 +35,44 @@ const sameRepoBlacksmith2vcpu = "${{ (github.event_name == 'merge_group' || (git
|
|||
|
||||
// F7a: the same same-repo expression at 4 vCPU and 8 vCPU, for jobs sized
|
||||
// larger than the 2 vCPU default (check-doc-flags,
|
||||
// pr-risk.yml's test-nix at 4 vCPU; windows-test-binaries at 8 vCPU). F7c's advisory workflows also use the 4 vCPU size.
|
||||
// pr-risk.yml's test-nix at 4 vCPU). F7c's advisory workflows also use the 4 vCPU size.
|
||||
const sameRepoBlacksmith4vcpu = "${{ (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' }}"
|
||||
const sameRepoBlacksmith8vcpu = "${{ (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' }}"
|
||||
|
||||
// F7b: same-repo Blacksmith Windows (blacksmith-*vcpu-windows-2025, public
|
||||
// beta) and macOS (blacksmith-*vcpu-macos-26) labels, same ternary shape
|
||||
// as the Linux consts above - forks/Dependabot keep the current GitHub-hosted
|
||||
// windows-latest/macos-latest label. windows-2025 is GitHub's windows-2025
|
||||
// image minus the full Visual Studio IDE, EdgeDriver and WinAppDriver; VS
|
||||
// Build Tools 2022 is present (cgo via MSVC/clang-cl or an installed
|
||||
// mingw-w64 toolchain), but there is no Linux Docker. Jobs moved onto these
|
||||
// labels that rely on a specific Windows toolchain detail already document
|
||||
// that dependency at the call site.
|
||||
const sameRepoBlacksmithWindows2vcpu = "${{ (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' }}"
|
||||
const sameRepoBlacksmithWindows4vcpu = "${{ (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' }}"
|
||||
const sameRepoBlacksmithWindows8vcpu = "${{ (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-windows-2025' || 'windows-latest' }}"
|
||||
const sameRepoBlacksmithWindows16vcpu = "${{ (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-16vcpu-windows-2025' || 'windows-latest' }}"
|
||||
// Windows and macOS jobs run on Blacksmith for every event, forks and
|
||||
// Dependabot included (ga-96smfk.22): rbe-west has no Windows or macOS
|
||||
// workers, and Blacksmith serves fork PRs in this org (gascity's fork PRs
|
||||
// run on blacksmith-* labels). So their runs-on is the literal label,
|
||||
// wrapped in a trivial expression like main.yml's push-only Blacksmith jobs
|
||||
// (a bare self-hosted label trips actionlint). windows-2025 is GitHub's
|
||||
// windows-2025 image minus the full Visual Studio IDE, EdgeDriver and
|
||||
// WinAppDriver; VS Build Tools 2022 is present, but there is no Linux
|
||||
// Docker. Fork runs get no secrets and a read-only token, and each job runs
|
||||
// in a fresh VM; the repository's fork-PR approval setting is the boundary
|
||||
// for who may run code there (a fork's own workflow file controls runs-on
|
||||
// anyway). TestBlacksmithJobsReadNoSecrets keeps every such job free of
|
||||
// secret reads.
|
||||
const blacksmithWindows2vcpuRunsOn = "${{ 'blacksmith-2vcpu-windows-2025' }}"
|
||||
const blacksmithWindows4vcpuRunsOn = "${{ 'blacksmith-4vcpu-windows-2025' }}"
|
||||
|
||||
// Same-repo Blacksmith macOS (Apple Silicon M4, ARM64). Pinned to macos-26
|
||||
// rather than blacksmith-*-macos-latest because GitHub's macos-latest (the
|
||||
// fork/Dependabot fallback) resolves to macos-26-arm64 today; pinning keeps
|
||||
// both paths on the same OS/arch and keeps the PR legs and main.yml's
|
||||
// blacksmith-macos-go-build-cache saver on one image regardless of when
|
||||
// Blacksmith moves its own -latest alias. Bump these (and
|
||||
// blacksmithMacOSLabel) when GitHub moves macos-latest.
|
||||
// Blacksmith macOS (Apple Silicon M4, ARM64), pinned to macos-26 (the image
|
||||
// GitHub's macos-latest resolves to) so the PR legs and main.yml's
|
||||
// blacksmith-macos-go-build-cache saver share one image regardless of when
|
||||
// Blacksmith moves its own -latest alias.
|
||||
const blacksmithMacOSLabel = "blacksmith-6vcpu-macos-26"
|
||||
const sameRepoBlacksmithMacOS6vcpu = "${{ (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' }}"
|
||||
const sameRepoBlacksmithMacOS12vcpu = "${{ (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-12vcpu-macos-26' || 'macos-latest' }}"
|
||||
const blacksmithWindowsLabel = "blacksmith-4vcpu-windows-2025"
|
||||
|
||||
// sameRepoPlatformsMatrixMarkerRunsOn is the "matrix marker" form (spec
|
||||
// F7/F7b §2.1) used by mixed-OS matrix jobs (pr-preflight-platforms,
|
||||
// check-doc-freshness-platforms): Actions does not expand `${{ }}` inside a
|
||||
// matrix array/include value, so each OS leg's `include` entry instead sets a
|
||||
// plain string marker field (`runner: same-repo-linux` etc.), and a single
|
||||
// chained ternary in the job's `runs-on` tests which marker (if any) the
|
||||
// current leg carries, falling back to `matrix.os` for legs with no marker or
|
||||
// when the marker's own same-repo condition is false.
|
||||
//
|
||||
// The macOS branch resolves like the other two: blacksmith-6vcpu-macos-26
|
||||
// (sameRepoBlacksmithMacOS6vcpu's label) for a trusted same-repo PR or
|
||||
// merge_group, GitHub-hosted macos-latest otherwise. F7b review fix S3 kept
|
||||
// it a plain 'macos-latest' (cost, and no push-to-main Blacksmith-macOS
|
||||
// saver); the cost is now accepted and main.yml's
|
||||
// blacksmith-macos-go-build-cache is that saver.
|
||||
const sameRepoPlatformsMatrixMarkerRunsOn = "${{ 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 }}"
|
||||
// platformsMatrixRunsOn: the mixed-OS matrix jobs (pr-preflight-platforms,
|
||||
// check-doc-freshness-platforms) name each leg's Blacksmith label in its
|
||||
// `include` entry's `runner` field.
|
||||
const platformsMatrixRunsOn = "${{ matrix.runner }}"
|
||||
|
||||
// platformsMatrixRunners: each mixed-OS matrix leg's `os` (which keeps the
|
||||
// check names stable) -> its Blacksmith label.
|
||||
var platformsMatrixRunners = map[string]string{
|
||||
"macos-latest": blacksmithMacOSLabel,
|
||||
"windows-latest": blacksmithWindowsLabel,
|
||||
}
|
||||
|
||||
// --- a minimal GitHub Actions expression evaluator -------------------------
|
||||
//
|
||||
|
|
@ -465,12 +458,6 @@ func TestSameRepoBlacksmithExpressionSemantics(t *testing.T) {
|
|||
{"blacksmith-2vcpu-ubuntu-2404", "ubuntu-latest", sameRepoBlacksmith2vcpu},
|
||||
{"blacksmith-4vcpu-ubuntu-2404", "ubuntu-latest", sameRepoBlacksmith4vcpu},
|
||||
{"blacksmith-8vcpu-ubuntu-2404", "ubuntu-latest", sameRepoBlacksmith8vcpu},
|
||||
{"blacksmith-2vcpu-windows-2025", "windows-latest", sameRepoBlacksmithWindows2vcpu},
|
||||
{"blacksmith-4vcpu-windows-2025", "windows-latest", sameRepoBlacksmithWindows4vcpu},
|
||||
{"blacksmith-8vcpu-windows-2025", "windows-latest", sameRepoBlacksmithWindows8vcpu},
|
||||
{"blacksmith-16vcpu-windows-2025", "windows-latest", sameRepoBlacksmithWindows16vcpu},
|
||||
{"blacksmith-6vcpu-macos-26", "macos-latest", sameRepoBlacksmithMacOS6vcpu},
|
||||
{"blacksmith-12vcpu-macos-26", "macos-latest", sameRepoBlacksmithMacOS12vcpu},
|
||||
}
|
||||
for _, c := range cases {
|
||||
ctx := map[string]string{
|
||||
|
|
@ -494,71 +481,11 @@ func TestSameRepoBlacksmithExpressionSemantics(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestSameRepoPlatformsMatrixMarkerRunsOnExpressionSemantics runs the real,
|
||||
// pinned sameRepoPlatformsMatrixMarkerRunsOn chained-ternary expression
|
||||
// (pr-preflight-platforms' and check-doc-freshness-platforms' runs-on, F7b
|
||||
// §2.1) through evalGHExpr for every (marker, event) combination the policy
|
||||
// cares about: the linux/windows `runner` markers resolve to that OS's
|
||||
// Blacksmith label only on a trusted same-repo PR/merge_group, falling back
|
||||
// to that OS's GitHub-hosted label otherwise (the macos marker included:
|
||||
// blacksmith-6vcpu-macos-26 vs. macos-latest); and a leg with no marker at
|
||||
// all (there is none today, but the fallback must still be safe) falls back
|
||||
// to matrix.os. Every marker is additionally checked against its flat
|
||||
// same-repo const for every event shape, so the chained ternary's per-OS
|
||||
// arms cannot drift from the single-OS expressions.
|
||||
func TestSameRepoPlatformsMatrixMarkerRunsOnExpressionSemantics(t *testing.T) {
|
||||
// TestBlacksmithWindowsMacOSRunsOnEveryEvent: the Windows and macOS labels
|
||||
// resolve to Blacksmith on every event shape, forks and Dependabot included;
|
||||
// there is no GitHub-hosted fallback left to drift to.
|
||||
func TestBlacksmithWindowsMacOSRunsOnEveryEvent(t *testing.T) {
|
||||
const ownRepo = "steveyegge/beads"
|
||||
trustedCtx := map[string]string{
|
||||
"github.event_name": "pull_request",
|
||||
"github.event.pull_request.head.repo.full_name": ownRepo,
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": "alice",
|
||||
}
|
||||
forkCtx := map[string]string{
|
||||
"github.event_name": "pull_request",
|
||||
"github.event.pull_request.head.repo.full_name": "someone-else/beads",
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": "alice",
|
||||
}
|
||||
cases := []struct {
|
||||
name string
|
||||
marker string // matrix.runner
|
||||
os string // matrix.os
|
||||
ctx map[string]string
|
||||
wantRunsOn string
|
||||
}{
|
||||
{"linux marker, trusted", "same-repo-linux", "ubuntu-latest", trustedCtx, "blacksmith-4vcpu-ubuntu-2404"},
|
||||
{"linux marker, fork", "same-repo-linux", "ubuntu-latest", forkCtx, "ubuntu-latest"},
|
||||
{"windows marker, trusted", "same-repo-windows", "windows-latest", trustedCtx, "blacksmith-4vcpu-windows-2025"},
|
||||
{"windows marker, fork", "same-repo-windows", "windows-latest", forkCtx, "windows-latest"},
|
||||
{"macos marker, trusted", "same-repo-macos", "macos-latest", trustedCtx, blacksmithMacOSLabel},
|
||||
{"macos marker, fork", "same-repo-macos", "macos-latest", forkCtx, "macos-latest"},
|
||||
{"no marker falls back to matrix.os", "", "some-other-os", trustedCtx, "some-other-os"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
ctx := map[string]string{}
|
||||
for k, v := range c.ctx {
|
||||
ctx[k] = v
|
||||
}
|
||||
ctx["matrix.runner"] = c.marker
|
||||
ctx["matrix.os"] = c.os
|
||||
got := mustEvalGHRunsOn(t, sameRepoPlatformsMatrixMarkerRunsOn, ctx)
|
||||
if got != c.wantRunsOn {
|
||||
t.Errorf("%s: runs-on = %q, want %q", c.name, got, c.wantRunsOn)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Each marker arm must resolve exactly like its flat single-OS const for
|
||||
// every event shape: same-repo PR and merge_group get Blacksmith; fork,
|
||||
// deleted fork head, Dependabot, push and every other event keep the
|
||||
// GitHub-hosted label.
|
||||
markerConsts := []struct{ marker, os, flat string }{
|
||||
{"same-repo-linux", "ubuntu-latest", sameRepoBlacksmith4vcpu},
|
||||
{"same-repo-windows", "windows-latest", sameRepoBlacksmithWindows4vcpu},
|
||||
{"same-repo-macos", "macos-latest", sameRepoBlacksmithMacOS6vcpu},
|
||||
}
|
||||
events := []struct{ name, event, headRepo, actor string }{
|
||||
{"same-repo PR", "pull_request", ownRepo, "alice"},
|
||||
{"merge_group", "merge_group", "", ""},
|
||||
|
|
@ -568,23 +495,26 @@ func TestSameRepoPlatformsMatrixMarkerRunsOnExpressionSemantics(t *testing.T) {
|
|||
{"push", "push", "", "alice"},
|
||||
{"schedule", "schedule", "", ""},
|
||||
}
|
||||
for _, m := range markerConsts {
|
||||
for _, c := range []struct{ expr, want string }{
|
||||
{blacksmithWindows2vcpuRunsOn, "blacksmith-2vcpu-windows-2025"},
|
||||
{blacksmithWindows4vcpuRunsOn, blacksmithWindowsLabel},
|
||||
{"${{ '" + blacksmithMacOSLabel + "' }}", blacksmithMacOSLabel},
|
||||
} {
|
||||
for _, e := range events {
|
||||
t.Run(m.marker+"/"+e.name, func(t *testing.T) {
|
||||
ctx := map[string]string{
|
||||
"github.event_name": e.event,
|
||||
"github.event.pull_request.head.repo.full_name": e.headRepo,
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": e.actor,
|
||||
"matrix.runner": m.marker,
|
||||
"matrix.os": m.os,
|
||||
}
|
||||
got := mustEvalGHRunsOn(t, sameRepoPlatformsMatrixMarkerRunsOn, ctx)
|
||||
want := mustEvalGHRunsOn(t, m.flat, ctx)
|
||||
if got != want {
|
||||
t.Errorf("marker %s under %s: runs-on = %q, flat const resolves to %q", m.marker, e.name, got, want)
|
||||
}
|
||||
})
|
||||
ctx := map[string]string{
|
||||
"github.event_name": e.event,
|
||||
"github.event.pull_request.head.repo.full_name": e.headRepo,
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": e.actor,
|
||||
}
|
||||
if got := mustEvalGHRunsOn(t, c.expr, ctx); got != c.want {
|
||||
t.Errorf("%s under %s = %q, want %q", c.expr, e.name, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, leg := range []string{blacksmithMacOSLabel, blacksmithWindowsLabel} {
|
||||
if got := mustEvalGHRunsOn(t, platformsMatrixRunsOn, map[string]string{"matrix.runner": leg}); got != leg {
|
||||
t.Errorf("%s with matrix.runner %q = %q", platformsMatrixRunsOn, leg, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,19 +194,15 @@ func TestBlacksmithSaverCacheKeysAreNotPerCommit(t *testing.T) {
|
|||
}
|
||||
|
||||
// TestBlacksmithSaverVenueAndFlavorMatricesAreComplete re-pins mutations the
|
||||
// reviewer's mutate.py found surviving against pre-fix code (M8, M9): main.yml's
|
||||
// "venue matrix" savers (test-windows and the macOS Go build cache saver)
|
||||
// must each keep BOTH the `blacksmith` leg (the actual same-repo-PR seed) and
|
||||
// the `github` leg (that job's pre-existing fork-PR/GitHub-hosted coverage)
|
||||
// -- dropping either silently loses a cache seed with no test noticing
|
||||
// (TestSameRepoBlacksmithRunners only pins the runs-on ternary string, which
|
||||
// does not change shape if a matrix axis's value list shrinks).
|
||||
// reviewer's mutate.py found surviving against pre-fix code (M8, M9). The
|
||||
// Windows and macOS savers (test-windows, blacksmith-macos-go-build-cache)
|
||||
// run one Blacksmith leg only: no GitHub-hosted Windows or macOS PR leg is
|
||||
// left to seed (ga-96smfk.22).
|
||||
func TestBlacksmithSaverVenueAndFlavorMatricesAreComplete(t *testing.T) {
|
||||
workflow := readCIWorkflow(t, "main.yml")
|
||||
for _, jobName := range []string{"test-windows", "blacksmith-macos-go-build-cache"} {
|
||||
job := workflow.job(t, jobName)
|
||||
if got := job.Strategy.Matrix.Venue; !equalStrings(got, []string{"blacksmith", "github"}) {
|
||||
t.Errorf("main.yml's %s matrix.venue = %v, want [blacksmith github]", jobName, got)
|
||||
if m := workflow.job(t, jobName).Strategy.Matrix; len(m.Venue) != 0 || len(m.Include) != 0 {
|
||||
t.Errorf("main.yml's %s has a matrix %+v; it seeds the one Blacksmith label its PR legs run on", jobName, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -252,55 +248,38 @@ var blacksmithMacOSPRLegJobs = []string{"pr-preflight-platforms", "check-doc-fre
|
|||
// TestBlacksmithMacOSSaverMatchesPRLegs pins the contract between pr.yml's
|
||||
// macOS PR legs and their only seeder, main.yml's
|
||||
// blacksmith-macos-go-build-cache: Blacksmith cannot see GitHub-saved caches
|
||||
// (and vice versa), so the saver must run on exactly the labels a same-repo
|
||||
// and a fork PR's macOS leg resolve to, write the cache path/key family those legs
|
||||
// restore, and compile what they compile (the shared warm-up). The PR legs
|
||||
// stay restore-only and are inside the default-caching-action sweep.
|
||||
// (and vice versa), so the saver must run on exactly the label every PR's
|
||||
// macOS leg runs on (forks included), write the cache path/key family those
|
||||
// legs restore, and compile what they compile (the shared warm-up). The PR
|
||||
// legs stay restore-only and are inside the default-caching-action sweep.
|
||||
func TestBlacksmithMacOSSaverMatchesPRLegs(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
mainWF := readCIWorkflow(t, "main.yml")
|
||||
saver := mainWF.job(t, "blacksmith-macos-go-build-cache")
|
||||
|
||||
const ownRepo = "gastownhall/beads"
|
||||
sameRepoMacOS := map[string]string{
|
||||
"github.event_name": "pull_request",
|
||||
"github.event.pull_request.head.repo.full_name": ownRepo,
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": "alice",
|
||||
"matrix.runner": "same-repo-macos",
|
||||
"matrix.os": "macos-latest",
|
||||
}
|
||||
forkMacOS := map[string]string{
|
||||
"github.event_name": "pull_request",
|
||||
"github.event.pull_request.head.repo.full_name": "someone/beads",
|
||||
"github.repository": ownRepo,
|
||||
"github.actor": "someone",
|
||||
"matrix.runner": "same-repo-macos",
|
||||
"matrix.os": macOSRunner,
|
||||
}
|
||||
// One leg per venue: the Blacksmith leg seeds same-repo PRs, the github
|
||||
// leg the fork/Dependabot macos-latest path.
|
||||
if want := "${{ matrix.venue == 'blacksmith' && '" + blacksmithMacOSLabel + "' || '" + macOSRunner + "' }}"; saver.RunsOn != want {
|
||||
if want := "${{ '" + blacksmithMacOSLabel + "' }}"; saver.RunsOn != want {
|
||||
t.Errorf("blacksmith-macos-go-build-cache runs-on = %q, want %q", saver.RunsOn, want)
|
||||
}
|
||||
if saver.TimeoutMinutes == 0 || len(saver.Strategy.Matrix.Include) != 0 || !equalStrings(saver.Strategy.Matrix.Venue, []string{"blacksmith", "github"}) {
|
||||
t.Errorf("blacksmith-macos-go-build-cache timeout=%d include=%v venue=%v, want a timeout and one leg per venue [blacksmith github]",
|
||||
saver.TimeoutMinutes, saver.Strategy.Matrix.Include, saver.Strategy.Matrix.Venue)
|
||||
if saver.TimeoutMinutes == 0 {
|
||||
t.Error("blacksmith-macos-go-build-cache has no timeout-minutes")
|
||||
}
|
||||
|
||||
saverSave := saver.step(t, "Save non-race Go build cache")
|
||||
for _, jobName := range blacksmithMacOSPRLegJobs {
|
||||
job := pr.job(t, jobName)
|
||||
// The default-caching sweep (TestBlacksmithReachablePRJobsDisableDefaultCachingActions)
|
||||
// and the no-secrets sweep select jobs by a blacksmith- runs-on.
|
||||
if !strings.Contains(job.RunsOn, "'"+blacksmithMacOSLabel+"'") || !strings.Contains(job.RunsOn, "blacksmith-") {
|
||||
t.Errorf("pr.yml %s runs-on %q does not name %s", jobName, job.RunsOn, blacksmithMacOSLabel)
|
||||
// Every PR's macOS leg, forks included, runs on the saver's label.
|
||||
macOSLegs := 0
|
||||
for _, leg := range job.Strategy.Matrix.Include {
|
||||
if leg.OS != macOSRunner {
|
||||
continue
|
||||
}
|
||||
macOSLegs++
|
||||
if got := mustEvalGHRunsOn(t, job.RunsOn, map[string]string{"matrix.runner": leg.Runner, "matrix.os": leg.OS}); got != blacksmithMacOSLabel {
|
||||
t.Errorf("pr.yml %s macOS leg resolves to %q, want the saver's %q", jobName, got, blacksmithMacOSLabel)
|
||||
}
|
||||
}
|
||||
if got := mustEvalGHRunsOn(t, job.RunsOn, sameRepoMacOS); got != blacksmithMacOSLabel {
|
||||
t.Errorf("pr.yml %s same-repo macOS leg resolves to %q, want the saver's %q", jobName, got, blacksmithMacOSLabel)
|
||||
}
|
||||
if got := mustEvalGHRunsOn(t, job.RunsOn, forkMacOS); got != macOSRunner {
|
||||
t.Errorf("pr.yml %s fork macOS leg resolves to %q, want the saver's github leg %q", jobName, got, macOSRunner)
|
||||
if macOSLegs != 1 {
|
||||
t.Errorf("pr.yml %s has %d macOS legs, want 1", jobName, macOSLegs)
|
||||
}
|
||||
if setup := job.step(t, "Set up Go"); setup.With["cache"] != "false" {
|
||||
t.Errorf("pr.yml %s Set up Go cache = %q, want \"false\"", jobName, setup.With["cache"])
|
||||
|
|
|
|||
|
|
@ -59,28 +59,6 @@ func aptStepBudgets() []aptStepBudget {
|
|||
installPkgs: "gcc-mingw-w64-x86-64 gcc-aarch64-linux-gnu osslsigncode",
|
||||
capMinutes: 13,
|
||||
},
|
||||
{
|
||||
workflow: "pr.yml",
|
||||
job: "windows-test-binaries",
|
||||
step: "Install mingw cross-compiler",
|
||||
updateAttempts: 3,
|
||||
updateTimeout: 120,
|
||||
backoff: 10,
|
||||
installTimeout: 300,
|
||||
installPkgs: "gcc-mingw-w64-x86-64",
|
||||
capMinutes: 12,
|
||||
},
|
||||
{
|
||||
workflow: "main.yml",
|
||||
job: "windows-test-binaries-cache",
|
||||
step: "Install mingw cross-compiler",
|
||||
updateAttempts: 3,
|
||||
updateTimeout: 120,
|
||||
backoff: 10,
|
||||
installTimeout: 300,
|
||||
installPkgs: "gcc-mingw-w64-x86-64",
|
||||
capMinutes: 12,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ func TestPRWorkflowExercisesNativeUserConfigDiagnostics(t *testing.T) {
|
|||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, "pr-preflight-platforms")
|
||||
// The benchmark-environment test owns the shared job and matrix shape.
|
||||
wantHosts := map[string]string{"ubuntu-latest": "linux", "macos-latest": "darwin", "windows-latest": "windows"}
|
||||
wantHosts := map[string]string{"macos-latest": "darwin", "windows-latest": "windows"}
|
||||
gotHosts := make(map[string][]string)
|
||||
for _, tuple := range job.Strategy.Matrix.Include {
|
||||
gotHosts[tuple.OS] = append(gotHosts[tuple.OS], tuple.ExpectedGOOS)
|
||||
|
|
@ -356,8 +356,8 @@ func TestPRWorkflowRequiresNativeInitGatewayCredential(t *testing.T) {
|
|||
|
||||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, jobName)
|
||||
if job.RunsOn != sameRepoPlatformsMatrixMarkerRunsOn || !equalStrings(matrixIncludeHosts(job.Strategy.Matrix.Include), []string{"macos-latest", "ubuntu-latest", "windows-latest"}) {
|
||||
t.Errorf("credential shell boundary requires the native three-host matrix: runner=%q include=%v", job.RunsOn, job.Strategy.Matrix.Include)
|
||||
if job.RunsOn != platformsMatrixRunsOn || !equalStrings(matrixIncludeHosts(job.Strategy.Matrix.Include), []string{"macos-latest", "windows-latest"}) {
|
||||
t.Errorf("credential shell boundary requires the native macOS/Windows matrix: runner=%q include=%v", job.RunsOn, job.Strategy.Matrix.Include)
|
||||
}
|
||||
if job.If != "" || job.ContinueOnError {
|
||||
t.Errorf("credential process job is bypassable: if=%q continue-on-error=%v", job.If, job.ContinueOnError)
|
||||
|
|
@ -458,11 +458,16 @@ func TestPRWorkflowExercisesWindowsBenchmarkEnvScrubbing(t *testing.T) {
|
|||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, "pr-preflight-platforms")
|
||||
|
||||
if job.RunsOn != sameRepoPlatformsMatrixMarkerRunsOn {
|
||||
t.Errorf("pr-preflight-platforms runs-on = %q, want the matrix-marker chained ternary", job.RunsOn)
|
||||
if job.RunsOn != platformsMatrixRunsOn {
|
||||
t.Errorf("pr-preflight-platforms runs-on = %q, want the per-leg Blacksmith label", job.RunsOn)
|
||||
}
|
||||
if got := matrixIncludeHosts(job.Strategy.Matrix.Include); !equalStrings(got, []string{"macos-latest", "ubuntu-latest", "windows-latest"}) {
|
||||
t.Errorf("pr-preflight-platforms matrix os = %v, want required three-host matrix", got)
|
||||
if got := matrixIncludeHosts(job.Strategy.Matrix.Include); !equalStrings(got, []string{"macos-latest", "windows-latest"}) {
|
||||
t.Errorf("pr-preflight-platforms matrix os = %v, want the macOS and Windows hosts (Linux runs under Bazel)", got)
|
||||
}
|
||||
for _, tuple := range job.Strategy.Matrix.Include {
|
||||
if tuple.Runner != platformsMatrixRunners[tuple.OS] {
|
||||
t.Errorf("pr-preflight-platforms %s leg runner = %q, want %q", tuple.OS, tuple.Runner, platformsMatrixRunners[tuple.OS])
|
||||
}
|
||||
}
|
||||
if job.If != "" {
|
||||
t.Errorf("pr-preflight-platforms job is conditional: %q", job.If)
|
||||
|
|
@ -589,20 +594,22 @@ func TestPRCIGateRequiresWindowsGlobalPrimeOverride(t *testing.T) {
|
|||
gate := workflow.job(t, "ci-gate")
|
||||
evaluate := gate.step(t, "Evaluate CI gate")
|
||||
env := evaluate.Env
|
||||
// F4 side-by-side rollout (SF-5): TEST_WINDOWS_LIVENESS is no longer in
|
||||
// the static CI_GATE_REQUIRED list -- the WINDOWS_PREBUILT_REQUIRED flag
|
||||
// mechanism (TestWindowsPrebuiltRequiredFlagMechanism,
|
||||
// scripts/windows_test_binaries_manifest_test.go) adds it dynamically in
|
||||
// the run script. Since the rollout finished the flag is "true": the
|
||||
// prebuilt pair is required and the native pair stays wired (advisory)
|
||||
// for a one-line rollback. Check that wiring here instead of the old
|
||||
// static list membership.
|
||||
if !contains(gate.Needs, "test-windows-liveness") ||
|
||||
env["TEST_WINDOWS_LIVENESS"] != "${{ needs.test-windows-liveness.result }}" ||
|
||||
workflow.Env["WINDOWS_PREBUILT_REQUIRED"] != "true" ||
|
||||
!strings.Contains(evaluate.Run, `CI_GATE_REQUIRED="$CI_GATE_REQUIRED TEST_WINDOWS_LIVENESS WORKTREE_REMOVE_WINDOWS"`) ||
|
||||
!strings.Contains(evaluate.Run, `CI_GATE_REQUIRED="$CI_GATE_REQUIRED TEST_WINDOWS_LIVENESS_PREBUILT WORKTREE_REMOVE_WINDOWS_PREBUILT"`) {
|
||||
t.Fatal("CI gate must keep both Windows pairs wired and require the prebuilt pair (WINDOWS_PREBUILT_REQUIRED=\"true\"); the native pair stays wired for rollback")
|
||||
// The native pair is the required run of these tests (ga-96smfk.22
|
||||
// retired the Linux-cross-compiled "-prebuilt" twins and the
|
||||
// WINDOWS_PREBUILT_REQUIRED flag): statically in CI_GATE_REQUIRED.
|
||||
required := strings.Fields(env["CI_GATE_REQUIRED"])
|
||||
for job, id := range map[string]string{"test-windows-liveness": "TEST_WINDOWS_LIVENESS", "worktree-remove-windows": "WORKTREE_REMOVE_WINDOWS"} {
|
||||
if !contains(gate.Needs, job) || env[id] != "${{ needs."+job+".result }}" || !contains(required, id) {
|
||||
t.Errorf("CI gate must require %s (%s)", job, id)
|
||||
}
|
||||
}
|
||||
for _, retired := range []string{"windows-test-binaries", "test-windows-liveness-prebuilt", "worktree-remove-windows-prebuilt"} {
|
||||
if _, ok := workflow.Jobs[retired]; ok || contains(gate.Needs, retired) {
|
||||
t.Errorf("pr.yml has retired job %s", retired)
|
||||
}
|
||||
}
|
||||
if _, ok := workflow.Env["WINDOWS_PREBUILT_REQUIRED"]; ok || strings.Contains(evaluate.Run, "PREBUILT") {
|
||||
t.Error("pr.yml still carries the retired WINDOWS_PREBUILT_REQUIRED switch")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -616,8 +623,8 @@ func TestPRCIGateRequiresGeneratedHookTimeoutProcessBoundary(t *testing.T) {
|
|||
|
||||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, jobName)
|
||||
if job.RunsOn != sameRepoPlatformsMatrixMarkerRunsOn || !equalStrings(matrixIncludeHosts(job.Strategy.Matrix.Include), []string{"macos-latest", "ubuntu-latest", "windows-latest"}) {
|
||||
t.Errorf("generated-hook process job is not the required three-host matrix: runs-on=%q include=%v", job.RunsOn, job.Strategy.Matrix.Include)
|
||||
if job.RunsOn != platformsMatrixRunsOn || !equalStrings(matrixIncludeHosts(job.Strategy.Matrix.Include), []string{"macos-latest", "windows-latest"}) {
|
||||
t.Errorf("generated-hook process job is not the required macOS/Windows matrix: runs-on=%q include=%v", job.RunsOn, job.Strategy.Matrix.Include)
|
||||
}
|
||||
if job.TimeoutMinutes != 20 {
|
||||
t.Errorf("generated-hook process job timeout = %d minutes, want 20", job.TimeoutMinutes)
|
||||
|
|
@ -749,15 +756,15 @@ func TestNightlyRunsNoGoTestOnARunner(t *testing.T) {
|
|||
func TestPRPreflightPlatformsRunsTestScriptPrebuiltBinaryContract(t *testing.T) {
|
||||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, "pr-preflight-platforms")
|
||||
if job.RunsOn != sameRepoPlatformsMatrixMarkerRunsOn {
|
||||
t.Errorf("pr-preflight-platforms runs-on = %q, want the matrix-marker chained ternary", job.RunsOn)
|
||||
if job.RunsOn != platformsMatrixRunsOn {
|
||||
t.Errorf("pr-preflight-platforms runs-on = %q, want the per-leg Blacksmith label", job.RunsOn)
|
||||
}
|
||||
if job.If != "" || job.TimeoutMinutes != 20 {
|
||||
t.Errorf("pr-preflight-platforms condition/timeout = %q/%d, want unconditional/20",
|
||||
job.If, job.TimeoutMinutes)
|
||||
}
|
||||
if got := matrixIncludeHosts(job.Strategy.Matrix.Include); !equalStrings(got, []string{"macos-latest", "ubuntu-latest", "windows-latest"}) {
|
||||
t.Errorf("pr-preflight-platforms matrix os = %v, want all three hosted platforms", got)
|
||||
if got := matrixIncludeHosts(job.Strategy.Matrix.Include); !equalStrings(got, []string{"macos-latest", "windows-latest"}) {
|
||||
t.Errorf("pr-preflight-platforms matrix os = %v, want the macOS and Windows hosts", got)
|
||||
}
|
||||
|
||||
const stepName = "Exercise test.sh prebuilt binary path"
|
||||
|
|
@ -789,7 +796,7 @@ func TestRepositoryTextEOLPolicyWorkflow(t *testing.T) {
|
|||
workflow := readCIWorkflow(t, "pr.yml")
|
||||
job := workflow.job(t, "check-doc-freshness-platforms")
|
||||
|
||||
if want := sameRepoPlatformsMatrixMarkerRunsOn; job.RunsOn != want {
|
||||
if want := platformsMatrixRunsOn; job.RunsOn != want {
|
||||
t.Errorf("check-doc-freshness-platforms runs-on = %q, want %q", job.RunsOn, want)
|
||||
}
|
||||
// The Linux leg runs in Bazel (TestDocFreshnessLinuxLegRunsInBazel);
|
||||
|
|
@ -798,14 +805,9 @@ func TestRepositoryTextEOLPolicyWorkflow(t *testing.T) {
|
|||
"macos-latest": "darwin",
|
||||
"windows-latest": "windows",
|
||||
}
|
||||
// F7b: each host's include tuple also carries a "runner" marker
|
||||
// (same-repo-macos/-windows) that sameRepoPlatformsMatrixMarkerRunsOn
|
||||
// resolves against; check it matches the host instead of treating it as an
|
||||
// unexpected field.
|
||||
wantRunnerMarker := map[string]string{
|
||||
"macos-latest": "same-repo-macos",
|
||||
"windows-latest": "same-repo-windows",
|
||||
}
|
||||
// Each host's include tuple names its Blacksmith label in "runner"
|
||||
// (platformsMatrixRunsOn), for every PR, forks included.
|
||||
wantRunnerMarker := platformsMatrixRunners
|
||||
if len(job.Strategy.Matrix.OS) != 0 {
|
||||
t.Errorf("check-doc-freshness-platforms retains an unbound os-list matrix: %v", job.Strategy.Matrix.OS)
|
||||
}
|
||||
|
|
@ -827,7 +829,7 @@ func TestRepositoryTextEOLPolicyWorkflow(t *testing.T) {
|
|||
t.Errorf("runner %q expected_goos = %q, want %q", tuple.OS, tuple.ExpectedGOOS, wantGOOS)
|
||||
}
|
||||
if tuple.Runner != wantRunnerMarker[tuple.OS] {
|
||||
t.Errorf("runner %q matrix runner marker = %q, want %q", tuple.OS, tuple.Runner, wantRunnerMarker[tuple.OS])
|
||||
t.Errorf("runner %q matrix runner label = %q, want %q", tuple.OS, tuple.Runner, wantRunnerMarker[tuple.OS])
|
||||
}
|
||||
if tuple.Coverage || tuple.TestFlags != "" {
|
||||
t.Errorf(
|
||||
|
|
@ -906,11 +908,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "test-windows"), []goCacheStep{
|
||||
mainRestoreModuleCache(), mainRestoreBuildCacheDayBucketedIf("non-race", ""), saveModuleCache(), saveBuildCacheDayBucketed("non-race"),
|
||||
})
|
||||
// F4.7: seeds the module and xcompile caches pr.yml's windows-test-binaries
|
||||
// job only restores (PR workflows never save).
|
||||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "windows-test-binaries-cache"), []goCacheStep{
|
||||
mainRestoreModuleCache(), mainRestoreXCompileCache(), saveModuleCacheAfterFailure(), saveXCompileCache(),
|
||||
})
|
||||
// macOS saver for pr-preflight-platforms'/check-doc-freshness-platforms'
|
||||
// macOS legs: its blacksmith venue leg seeds the same-repo path (and the
|
||||
// `test` job), its github leg the fork path.
|
||||
|
|
@ -924,15 +921,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertGoCacheInventory(t, workflows["pr.yml"].job(t, "worktree-remove-windows"), []goCacheStep{
|
||||
restoreModuleCache(), restoreBuildCache("non-race"),
|
||||
})
|
||||
// F4.4 advisory phase: windows-test-binaries cross-compiles on Linux and
|
||||
// only restores (never saves; main.yml's windows-test-binaries-cache job
|
||||
// is the saver). Its "-prebuilt" twins (test-windows-liveness-prebuilt,
|
||||
// worktree-remove-windows-prebuilt) download the resulting artifact and
|
||||
// run the binaries directly, so they use no Go cache action at all and
|
||||
// need no entry here or in the managed map below.
|
||||
assertGoCacheInventory(t, workflows["pr.yml"].job(t, "windows-test-binaries"), []goCacheStep{
|
||||
restoreModuleCache(), restoreXCompileCache(),
|
||||
})
|
||||
// F7b review (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, targeting this job's own cold cmd/bd test
|
||||
|
|
@ -960,13 +948,11 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertNoUnmanagedGoCacheSteps(t, workflows, map[string]map[string]bool{
|
||||
"main.yml": {
|
||||
"test": true, "test-windows": true,
|
||||
"windows-test-binaries-cache": true,
|
||||
"blacksmith-macos-go-build-cache": true,
|
||||
},
|
||||
"pr.yml": {
|
||||
"worktree-remove-windows": true,
|
||||
"check-doc-freshness-platforms": true, "pr-preflight-platforms": true, "advisory-reports": true,
|
||||
"windows-test-binaries": true,
|
||||
"test-windows-liveness": true,
|
||||
},
|
||||
"pr-risk.yml": {},
|
||||
|
|
@ -982,16 +968,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertStepsBefore(t, mainWindows, []string{"Restore Go module cache", "Restore non-race Go build cache"}, []string{"Build (pure Go regex)"})
|
||||
assertStepsBefore(t, mainWindows, []string{"Build (pure Go regex)", "Smoke test - version", "Smoke test - help"}, []string{"Save Go module cache", "Save non-race Go build cache"})
|
||||
|
||||
prXCompile := workflows["pr.yml"].job(t, "windows-test-binaries")
|
||||
assertStepsBefore(t, prXCompile, []string{"Restore Go module cache"}, []string{"Verify Go module checksums", "Build Windows test binaries"})
|
||||
assertStepsBefore(t, prXCompile, []string{"Install mingw cross-compiler", "Restore Go build cache (Windows cross-compile)"}, []string{"Build Windows test binaries"})
|
||||
assertStepsBefore(t, prXCompile, []string{"Build Windows test binaries"}, []string{"Upload Windows test binaries"})
|
||||
|
||||
mainXCompileCache := workflows["main.yml"].job(t, "windows-test-binaries-cache")
|
||||
assertStepsBefore(t, mainXCompileCache, []string{"Restore Go module cache"}, []string{"Install mingw cross-compiler", "Build Windows test binaries"})
|
||||
assertStepsBefore(t, mainXCompileCache, []string{"Install mingw cross-compiler", "Restore Go build cache (Windows cross-compile)"}, []string{"Build Windows test binaries"})
|
||||
assertStepsBefore(t, mainXCompileCache, []string{"Build Windows test binaries"}, []string{"Save Go module cache", "Save Go build cache (Windows cross-compile)"})
|
||||
|
||||
assertStepsBefore(t, workflows["pr.yml"].job(t, "worktree-remove-windows"),
|
||||
[]string{"Restore Go module cache", "Restore non-race Go build cache"}, []string{"Run native Windows worktree removal boundary tests"})
|
||||
assertStepsBefore(t, workflows["pr.yml"].job(t, "check-doc-freshness-platforms"),
|
||||
|
|
@ -1004,8 +980,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertGoCacheEnv(t, workflows["main.yml"].job(t, "test"), "Build", "non-race")
|
||||
assertGoCacheEnv(t, workflows["main.yml"].job(t, "test"), "Test", "race")
|
||||
assertGoCacheEnv(t, workflows["main.yml"].job(t, "test-windows"), "Build (pure Go regex)", "non-race")
|
||||
assertGoCacheEnv(t, workflows["main.yml"].job(t, "windows-test-binaries-cache"), "Build Windows test binaries", xcompileCacheProfile())
|
||||
assertGoCacheEnv(t, workflows["pr.yml"].job(t, "windows-test-binaries"), "Build Windows test binaries", xcompileCacheProfile())
|
||||
assertGoCacheEnv(t, workflows["pr.yml"].job(t, "worktree-remove-windows"), "Run native Windows worktree removal boundary tests", "non-race")
|
||||
for _, workflowName := range []string{"pr.yml", "pr-risk.yml"} {
|
||||
for jobName, job := range workflows[workflowName].Jobs {
|
||||
|
|
@ -1019,18 +993,14 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
}
|
||||
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "test", mainBlacksmithMacOSTestRunsOn, "Save race Go build cache", failureSurvivingCacheSaveCondition(cacheMissCondition(goBuildCacheRestoreID("race"))))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "test-windows", mainVenueBlacksmithWindows4vcpuRunsOn, "Save Go module cache", cacheMissCondition(goModuleCacheRestoreID))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "test-windows", mainVenueBlacksmithWindows4vcpuRunsOn, "Save non-race Go build cache", cacheMissCondition(goBuildCacheRestoreID("non-race")))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "test-windows", mainBlacksmithWindows4vcpuRunsOn, "Save Go module cache", cacheMissCondition(goModuleCacheRestoreID))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "test-windows", mainBlacksmithWindows4vcpuRunsOn, "Save non-race Go build cache", cacheMissCondition(goBuildCacheRestoreID("non-race")))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "blacksmith-macos-go-build-cache", mainBlacksmithMacOSGoBuildCacheRunsOn, "Save Go module cache", saveModuleCacheAfterFailure().ifCondition)
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "blacksmith-macos-go-build-cache", mainBlacksmithMacOSGoBuildCacheRunsOn, "Save non-race Go build cache", saveBuildCacheAfterFailureIf("non-race", "").ifCondition)
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "windows-test-binaries-cache", mainWindowsTestBinariesCacheRunsOn, "Save Go module cache", saveModuleCacheAfterFailure().ifCondition)
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "windows-test-binaries-cache", mainWindowsTestBinariesCacheRunsOn, "Save Go build cache (Windows cross-compile)", saveXCompileCache().ifCondition)
|
||||
for _, target := range []struct{ workflow, job string }{
|
||||
{"main.yml", "test"},
|
||||
{"main.yml", "test-windows"},
|
||||
{"main.yml", "windows-test-binaries-cache"},
|
||||
{"main.yml", "blacksmith-macos-go-build-cache"},
|
||||
{"pr.yml", "windows-test-binaries"},
|
||||
{"pr.yml", "worktree-remove-windows"},
|
||||
{"pr.yml", "check-doc-freshness-platforms"},
|
||||
{"pr.yml", "pr-preflight-platforms"},
|
||||
|
|
@ -1042,34 +1012,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestMainWindowsTestBinariesCacheSeedsBothRunnerSelections is the regression
|
||||
// test for F4 review SF-1: main.yml's windows-test-binaries-cache job must
|
||||
// seed its cache keys from both runner selections pr.yml's windows-test-
|
||||
// binaries job can land on (Blacksmith for same-repo PRs/merge_group,
|
||||
// ubuntu-latest for forks/Dependabot), because Blacksmith and GitHub-hosted
|
||||
// runners cannot see each other's actions/cache entries even for an
|
||||
// identical key. A single-leg seeder would silently leave one of the two
|
||||
// consumer paths permanently cold.
|
||||
func TestMainWindowsTestBinariesCacheSeedsBothRunnerSelections(t *testing.T) {
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "windows-test-binaries-cache")
|
||||
|
||||
if job.RunsOn != mainWindowsTestBinariesCacheRunsOn {
|
||||
t.Errorf("windows-test-binaries-cache runs-on = %q, want %q", job.RunsOn, mainWindowsTestBinariesCacheRunsOn)
|
||||
}
|
||||
wantRunners := []string{"blacksmith", "github"}
|
||||
if !equalStrings(job.Strategy.Matrix.Runner, wantRunners) {
|
||||
t.Errorf("windows-test-binaries-cache strategy.matrix.runner = %v, want %v", job.Strategy.Matrix.Runner, wantRunners)
|
||||
}
|
||||
if job.Strategy.FailFast {
|
||||
t.Error("windows-test-binaries-cache strategy.fail-fast must be false: one runner selection being unavailable must not cancel the other's seed")
|
||||
}
|
||||
// Mirrors pr.yml's windows-test-binaries job (pr.yml:522's timeout is 30
|
||||
// too): this job runs the same mingw install + cross-compile.
|
||||
if job.TimeoutMinutes != 30 {
|
||||
t.Errorf("windows-test-binaries-cache timeout-minutes = %d, want 30", job.TimeoutMinutes)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServerStorageShardScriptRunsPrebuiltBinaryFromPackageDir(t *testing.T) {
|
||||
// pr4107_corruption_test.go and journal_scope_completeness_test.go use
|
||||
// paths relative to internal/storage/dolt (e.g. ../schema/migrations,
|
||||
|
|
@ -1303,9 +1245,8 @@ func saveModuleCacheIf(condition string) goCacheStep {
|
|||
}
|
||||
|
||||
// saveModuleCacheAfterFailure is saveModuleCache with a failure-surviving
|
||||
// condition, for single-runner saver jobs (windows-test-binaries-
|
||||
// cache) where a flaky mid-build step (e.g. the mingw apt-get install)
|
||||
// should not prevent the module cache fetched before it from being saved.
|
||||
// condition, for saver jobs where a flaky mid-build step should not
|
||||
// prevent the module cache fetched before it from being saved.
|
||||
func saveModuleCacheAfterFailure() goCacheStep {
|
||||
step := saveModuleCache()
|
||||
step.ifCondition = failureSurvivingCacheSaveCondition(cacheMissCondition(goModuleCacheRestoreID))
|
||||
|
|
@ -1346,40 +1287,6 @@ func saveBuildCacheAfterFailureIf(profile, condition string) goCacheStep {
|
|||
return step
|
||||
}
|
||||
|
||||
// The Windows cross-compile GOCACHE (F4.4) is a separate cache dimension from
|
||||
// goBuildCache*'s base/race/non-race profiles: it is never shared with a
|
||||
// native build on the runner's own OS, so it gets its own key shape (no
|
||||
// "-base-<tag>-" segment) and its own fixed restore/save id, rather than
|
||||
// reusing goBuildCacheRestoreID's "restore-<profile>-go-build-cache" pattern.
|
||||
func xcompileCacheProfile() string { return "xcompile-windows-amd64" }
|
||||
|
||||
func xcompileCachePrefix() string {
|
||||
return "beads-go-build-" + goCacheSchema + "-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-" + xcompileCacheProfile() + "-"
|
||||
}
|
||||
|
||||
func xcompileCacheKey() string { return xcompileCachePrefix() + "${{ github.sha }}" }
|
||||
|
||||
func xcompileCachePath() string { return goBuildCachePath(xcompileCacheProfile()) }
|
||||
|
||||
func xcompileCacheRestoreID() string { return "restore-xcompile-go-build-cache" }
|
||||
|
||||
// restoreXCompileCache is the PR-side (restore-only, no id needed since
|
||||
// pr.yml never saves) shape; mainRestoreXCompileCache is main.yml's
|
||||
// saver-side shape, which needs the id for its Save step's cache-miss `if`.
|
||||
func restoreXCompileCache() goCacheStep {
|
||||
return goCacheStep{name: "Restore Go build cache (Windows cross-compile)", family: cacheRestoreActionFamily, key: xcompileCacheKey(), restoreKeys: xcompileCachePrefix(), path: xcompileCachePath()}
|
||||
}
|
||||
|
||||
func mainRestoreXCompileCache() goCacheStep {
|
||||
step := restoreXCompileCache()
|
||||
step.id = xcompileCacheRestoreID()
|
||||
return step
|
||||
}
|
||||
|
||||
func saveXCompileCache() goCacheStep {
|
||||
return goCacheStep{name: "Save Go build cache (Windows cross-compile)", family: cacheSaveActionFamily, key: xcompileCacheKey(), path: xcompileCachePath(), ifCondition: failureSurvivingCacheSaveCondition(cacheMissCondition(xcompileCacheRestoreID()))}
|
||||
}
|
||||
|
||||
func assertGoCacheInventory(t *testing.T, job ciWorkflowJob, want []goCacheStep) {
|
||||
t.Helper()
|
||||
|
||||
|
|
@ -2040,33 +1947,16 @@ const wantRBERunsOn = "${{ (github.event_name == 'push' || github.event_name ==
|
|||
// that checks them now live in ci_blacksmith_runner_test.go (shared with
|
||||
// F7c; see that file's doc comment for the API F7c rebases onto).
|
||||
|
||||
// F4 review SF-1: main.yml's windows-test-binaries-cache job seeds the same
|
||||
// cache keys/paths from both runner selections pr.yml's windows-test-binaries
|
||||
// job can land on (sameRepoBlacksmith8vcpu, defined in
|
||||
// ci_blacksmith_runner_test.go, for same-repo PRs/merge_group; ubuntu-latest
|
||||
// for forks/Dependabot). Blacksmith runners can't
|
||||
// see a GitHub-hosted runner's actions/cache entries (and vice versa) even
|
||||
// though both report the same runner.os/runner.arch, so a single-leg seeder
|
||||
// only ever warms one of the two consumer paths. matrix.runner (not a
|
||||
// literal Blacksmith label substituted directly into runs-on) keeps
|
||||
// actionlint from trying and failing to resolve an undeclared self-hosted
|
||||
// label: it treats this ternary form as a dynamic value and skips it, same
|
||||
// as every other Blacksmith runs-on in this repo.
|
||||
const mainWindowsTestBinariesCacheRunsOn = "${{ matrix.runner == 'blacksmith' && 'blacksmith-8vcpu-ubuntu-2404' || 'ubuntu-latest' }}"
|
||||
|
||||
// F7c: used to define its own sameRepoBlacksmith4vcpu here (same expression
|
||||
// as sameRepoBlacksmith2vcpu with the 4 vCPU label, for advisory jobs that
|
||||
// compile Go). F7a independently defined the same const; both are now served
|
||||
// by the single shared sameRepoBlacksmith4vcpu in ci_blacksmith_runner_test.go.
|
||||
|
||||
// F7b: venue-matrix runs-on for main.yml jobs that seed a Blacksmith GOCACHE
|
||||
// alongside their GitHub-hosted seed ("venue: [blacksmith, github]"):
|
||||
// test-windows and blacksmith-macos-go-build-cache.
|
||||
const mainVenueBlacksmithWindows4vcpuRunsOn = "${{ matrix.venue == 'blacksmith' && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}"
|
||||
|
||||
// main.yml's push-to-main-only macOS saver, on the exact labels pr.yml's
|
||||
// same-repo (blacksmithMacOSLabel) and fork (macOSRunner) macOS legs resolve to.
|
||||
const mainBlacksmithMacOSGoBuildCacheRunsOn = "${{ matrix.venue == 'blacksmith' && '" + blacksmithMacOSLabel + "' || '" + macOSRunner + "' }}"
|
||||
// main.yml's push-to-main-only Windows and macOS savers, on the exact labels
|
||||
// pr.yml's Windows and macOS legs run on (no GitHub-hosted leg is left to
|
||||
// seed, ga-96smfk.22).
|
||||
const mainBlacksmithWindows4vcpuRunsOn = blacksmithWindows4vcpuRunsOn
|
||||
const mainBlacksmithMacOSGoBuildCacheRunsOn = "${{ '" + blacksmithMacOSLabel + "' }}"
|
||||
|
||||
// main.yml's push-to-main-only macOS test job, on Blacksmith macOS.
|
||||
const mainBlacksmithMacOSTestRunsOn = "${{ '" + blacksmithMacOSLabel + "' }}"
|
||||
|
|
@ -2329,40 +2219,26 @@ func TestSameRepoBlacksmithRunners(t *testing.T) {
|
|||
// F7a: cache-free same-repo Linux jobs that restore no GitHub-saved
|
||||
// build cache moved onto same-repo Blacksmith at their measured vCPU
|
||||
// size (module-cache misses on the Blacksmith pool are acceptable
|
||||
// per spec; jobs that need a Blacksmith-side build-cache saver are
|
||||
// F7b's scope, not this one). windows-test-binaries is F4's Linux
|
||||
// mingw cross-compile job, sized at 8vcpu.
|
||||
// per spec).
|
||||
"pr.yml": {
|
||||
"ci-gate": sameRepoBlacksmith2vcpu,
|
||||
"fast-checks": sameRepoBlacksmith2vcpu,
|
||||
"advisory-reports": sameRepoBlacksmith2vcpu,
|
||||
"check-doc-flags": sameRepoBlacksmith4vcpu,
|
||||
"windows-test-binaries": sameRepoBlacksmith8vcpu,
|
||||
// F7b: same-repo Blacksmith Windows (blacksmith-*vcpu-windows-2025,
|
||||
// public beta). test-windows-liveness and worktree-remove-windows are
|
||||
// sized at 4vcpu (a build plus a focused test run each);
|
||||
// test-windows-small and the two "-prebuilt" twins (which only run an
|
||||
// already-cross-compiled binary) are sized at 2vcpu; windows-make-shell
|
||||
// is sized at 4vcpu (installs three separate Make toolchains). See the
|
||||
// report's risk notes for test-windows-liveness (cgo/mingw on
|
||||
// windows-2025, unverified) and windows-make-shell (Chocolatey
|
||||
// preinstalled, unverified).
|
||||
"test-windows-liveness": sameRepoBlacksmithWindows4vcpu,
|
||||
"worktree-remove-windows": sameRepoBlacksmithWindows4vcpu,
|
||||
"test-windows-small": sameRepoBlacksmithWindows2vcpu,
|
||||
"test-windows-liveness-prebuilt": sameRepoBlacksmithWindows2vcpu,
|
||||
"worktree-remove-windows-prebuilt": sameRepoBlacksmithWindows2vcpu,
|
||||
"windows-make-shell": sameRepoBlacksmithWindows4vcpu,
|
||||
// F7b: mixed-OS matrix jobs using the "matrix marker" chained-ternary
|
||||
// form (spec §2.1) instead of a flat same-repo ternary - see
|
||||
// sameRepoPlatformsMatrixMarkerRunsOn's doc comment in
|
||||
// scripts/ci_blacksmith_runner_test.go. (F7b review fix S1: an
|
||||
// earlier revision additionally split pr-preflight-platforms' Windows
|
||||
// leg into two `shard` matrix entries; that split was reverted as not
|
||||
// measurably helpful, so this single map entry now covers exactly
|
||||
// three matrix legs, one per OS.)
|
||||
"check-doc-freshness-platforms": sameRepoPlatformsMatrixMarkerRunsOn,
|
||||
"pr-preflight-platforms": sameRepoPlatformsMatrixMarkerRunsOn,
|
||||
"ci-gate": sameRepoBlacksmith2vcpu,
|
||||
"fast-checks": sameRepoBlacksmith2vcpu,
|
||||
"advisory-reports": sameRepoBlacksmith2vcpu,
|
||||
"check-doc-flags": sameRepoBlacksmith4vcpu,
|
||||
// Windows and macOS: Blacksmith for every PR, forks and Dependabot
|
||||
// included (ga-96smfk.22). test-windows-liveness and
|
||||
// worktree-remove-windows are sized at 4vcpu (a build plus a
|
||||
// focused test run each); test-windows-small at 2vcpu;
|
||||
// windows-make-shell at 4vcpu (installs three separate Make
|
||||
// toolchains).
|
||||
"test-windows-liveness": blacksmithWindows4vcpuRunsOn,
|
||||
"worktree-remove-windows": blacksmithWindows4vcpuRunsOn,
|
||||
"test-windows-small": blacksmithWindows2vcpuRunsOn,
|
||||
"windows-make-shell": blacksmithWindows4vcpuRunsOn,
|
||||
// Mixed-OS matrix jobs: each leg names its Blacksmith label
|
||||
// (platformsMatrixRunners, pinned by their own tests).
|
||||
"check-doc-freshness-platforms": platformsMatrixRunsOn,
|
||||
"pr-preflight-platforms": platformsMatrixRunsOn,
|
||||
},
|
||||
"pr-risk.yml": {
|
||||
"ci-gate": sameRepoBlacksmith2vcpu,
|
||||
|
|
@ -2377,17 +2253,15 @@ func TestSameRepoBlacksmithRunners(t *testing.T) {
|
|||
// main.yml's push-to-main-only jobs. Tracked here so the "no other
|
||||
// Blacksmith label leaks" sweep below also covers main.yml.
|
||||
"main.yml": {
|
||||
"windows-test-binaries-cache": mainWindowsTestBinariesCacheRunsOn,
|
||||
// F7b review (B2): these push-to-main-only jobs seed the
|
||||
// Blacksmith-selection GOCACHEs same-repo PR/merge_group jobs
|
||||
// above restore from (test-windows's "venue" matrix).
|
||||
// Blacksmith-selection GOCACHEs the PR jobs above restore from.
|
||||
// Each is additionally guarded by a job-level
|
||||
// github.event_name == 'push' && github.ref ==
|
||||
// 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
// if: (TestBlacksmithSaverJobsGuardedAgainstPullRequest below),
|
||||
// matching F7c's own saver convention.
|
||||
"test-windows": mainVenueBlacksmithWindows4vcpuRunsOn,
|
||||
// Same guard, seeding pr.yml's same-repo macOS legs.
|
||||
"test-windows": mainBlacksmithWindows4vcpuRunsOn,
|
||||
// Same guard, seeding pr.yml's macOS legs.
|
||||
"blacksmith-macos-go-build-cache": mainBlacksmithMacOSGoBuildCacheRunsOn,
|
||||
// The macOS -race -short suite (Linux runs it under Bazel).
|
||||
"test": mainBlacksmithMacOSTestRunsOn,
|
||||
|
|
@ -2423,7 +2297,7 @@ func TestSameRepoBlacksmithRunners(t *testing.T) {
|
|||
}
|
||||
}
|
||||
// No other job in pr.yml or pr-risk.yml may name a Blacksmith label beyond
|
||||
// the ones enumerated in `want` above (F4 added windows-test-binaries).
|
||||
// the ones enumerated in `want` above.
|
||||
// Same sweep for the F7c advisory workflows: nothing in them may name a
|
||||
// Blacksmith label beyond the jobs listed in `want` above.
|
||||
for _, file := range []string{
|
||||
|
|
|
|||
|
|
@ -205,8 +205,7 @@ elif [[ "${BEADS_TEST_SHARED_SERVER:-}" == "1" ]]; then
|
|||
fi
|
||||
|
||||
# BEADS_TEST_PREBUILT_TEST_BINARY short-circuits straight to a `go test -c`
|
||||
# binary (typically cross-compiled on a different host; see
|
||||
# scripts/ci/build-windows-test-binaries.sh and
|
||||
# binary (for example one cross-compiled on a different host; see
|
||||
# scripts/ci/run-go-test-binary.sh) instead of invoking `go test`. It still
|
||||
# gets test.sh's env isolation (beads_test_env_enter above), the .test-skip
|
||||
# pattern, and the -p/-parallel/-timeout defaults -- only the final
|
||||
|
|
|
|||
|
|
@ -1,516 +0,0 @@
|
|||
package scripts_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// windowsTestBinaryManifestEntry mirrors one non-comment, non-blank line of
|
||||
// scripts/ci/windows-test-binaries.txt: "name cgo tags package".
|
||||
type windowsTestBinaryManifestEntry struct {
|
||||
name string
|
||||
cgo string
|
||||
tags string
|
||||
pkg string
|
||||
}
|
||||
|
||||
func readWindowsTestBinariesManifest(t *testing.T) []windowsTestBinaryManifestEntry {
|
||||
t.Helper()
|
||||
|
||||
path := filepath.Join(sourceRepoRoot(t), "scripts", "ci", "windows-test-binaries.txt")
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var entries []windowsTestBinaryManifestEntry
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
if idx := strings.Index(line, "#"); idx != -1 {
|
||||
line = line[:idx]
|
||||
}
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
fields := strings.Fields(line)
|
||||
if len(fields) != 4 {
|
||||
t.Fatalf("malformed manifest line %q: want 4 whitespace-separated fields (name cgo tags package), got %d", line, len(fields))
|
||||
}
|
||||
entries = append(entries, windowsTestBinaryManifestEntry{name: fields[0], cgo: fields[1], tags: fields[2], pkg: fields[3]})
|
||||
}
|
||||
return entries
|
||||
}
|
||||
|
||||
// TestWindowsTestBinariesManifestPinned pins the advisory-phase manifest to
|
||||
// exactly the three binaries its two "-prebuilt" consumer jobs need (see the
|
||||
// manifest's own header comment for why the rollout is scoped this way).
|
||||
// Growing the manifest without growing its consumers, or vice versa, is
|
||||
// exactly the drift TestWindowsTestBinariesConsumersMatchManifest below
|
||||
// exists to catch; this test instead catches an unreviewed change to the
|
||||
// three pinned entries themselves (toolchain flags, package, or tags
|
||||
// silently drifting out from under the native jobs they mirror).
|
||||
func TestWindowsTestBinariesManifestPinned(t *testing.T) {
|
||||
entries := readWindowsTestBinariesManifest(t)
|
||||
want := []windowsTestBinaryManifestEntry{
|
||||
{name: "bd.exe", cgo: "1", tags: "gms_pure_go", pkg: "./cmd/bd"},
|
||||
{name: "cmd-bd-cgo.test.exe", cgo: "1", tags: "gms_pure_go", pkg: "./cmd/bd"},
|
||||
{name: "cmd-bd-nocgo.test.exe", cgo: "0", tags: "gms_pure_go", pkg: "./cmd/bd"},
|
||||
}
|
||||
if len(entries) != len(want) {
|
||||
t.Fatalf("manifest has %d entries, want %d: got %+v", len(entries), len(want), entries)
|
||||
}
|
||||
for i, got := range entries {
|
||||
if got != want[i] {
|
||||
t.Errorf("entry %d = %+v, want %+v", i, got, want[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestWindowsCrossCompileToolchainPinned pins build-windows-test-binaries.sh
|
||||
// to the same mingw-w64 cross-compiler release.yml's goreleaser job uses for
|
||||
// the shipped bd-windows-amd64 binary (.goreleaser.yml), so the two toolchains
|
||||
// cannot silently diverge.
|
||||
func TestWindowsCrossCompileToolchainPinned(t *testing.T) {
|
||||
path := filepath.Join(sourceRepoRoot(t), "scripts", "ci", "build-windows-test-binaries.sh")
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
script := string(data)
|
||||
for _, want := range []string{
|
||||
`env_args=(GOOS=windows GOARCH=amd64 CGO_ENABLED="$cgo")`,
|
||||
`env_args+=(CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++)`,
|
||||
// F4 review nit: the resolved mingw-w64 version is logged (once, up
|
||||
// front) so an advisory-phase run's log can confirm which compiler
|
||||
// release actually built the binaries, the same way "== host go
|
||||
// toolchain ==" confirms the Go side.
|
||||
`x86_64-w64-mingw32-gcc --version`,
|
||||
} {
|
||||
if !strings.Contains(script, want) {
|
||||
t.Errorf("build-windows-test-binaries.sh does not contain %q", want)
|
||||
}
|
||||
}
|
||||
|
||||
goreleaser := readGoreleaserBuilds(t)
|
||||
var windowsBuild *goreleaserBuild
|
||||
for i := range goreleaser {
|
||||
if goreleaser[i].ID == "bd-windows-amd64" {
|
||||
windowsBuild = &goreleaser[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
if windowsBuild == nil {
|
||||
t.Fatal(".goreleaser.yml has no bd-windows-amd64 build to compare against")
|
||||
}
|
||||
wantEnv := []string{"CGO_ENABLED=1", "CC=x86_64-w64-mingw32-gcc", "CXX=x86_64-w64-mingw32-g++"}
|
||||
if !equalStrings(windowsBuild.Env, wantEnv) {
|
||||
t.Errorf(".goreleaser.yml bd-windows-amd64 build env = %v, want %v (build-windows-test-binaries.sh's cgo=1 entries are pinned to match this exact toolchain)", windowsBuild.Env, wantEnv)
|
||||
}
|
||||
}
|
||||
|
||||
// winBinRefPattern matches `.../win-bin/<name>` references in step `run`
|
||||
// bodies, capturing the file name so it can be checked against the manifest.
|
||||
var winBinRefPattern = regexp.MustCompile(`win-bin/([A-Za-z0-9_.-]+)`)
|
||||
|
||||
// TestWindowsTestBinariesConsumersMatchManifest confirms every binary name
|
||||
// the "-prebuilt" jobs reference actually exists in the manifest that builds
|
||||
// it - a renamed manifest entry (or a typo'd reference) fails a Windows job
|
||||
// at runtime with a missing-file error; this catches it at review time
|
||||
// instead.
|
||||
func TestWindowsTestBinariesConsumersMatchManifest(t *testing.T) {
|
||||
entries := readWindowsTestBinariesManifest(t)
|
||||
names := make(map[string]bool, len(entries))
|
||||
for _, e := range entries {
|
||||
names[e.name] = true
|
||||
}
|
||||
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
referenced := make(map[string]bool)
|
||||
for _, jobName := range []string{"test-windows-liveness-prebuilt", "worktree-remove-windows-prebuilt"} {
|
||||
job := pr.job(t, jobName)
|
||||
for _, step := range job.Steps {
|
||||
for _, env := range step.Env {
|
||||
for _, m := range winBinRefPattern.FindAllStringSubmatch(env, -1) {
|
||||
referenced[m[1]] = true
|
||||
if !names[m[1]] {
|
||||
t.Errorf("%s step %q env references win-bin/%s, not in manifest %+v", jobName, step.Name, m[1], entries)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, m := range winBinRefPattern.FindAllStringSubmatch(step.Run, -1) {
|
||||
referenced[m[1]] = true
|
||||
if !names[m[1]] {
|
||||
t.Errorf("%s step %q run references win-bin/%s, not in manifest %+v", jobName, step.Name, m[1], entries)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Every manifest entry this advisory phase builds should be consumed by
|
||||
// at least one of the two twins - an unused entry is dead weight in the
|
||||
// cross-compile job for no benefit.
|
||||
for name := range names {
|
||||
if !referenced[name] {
|
||||
t.Errorf("manifest entry %q is never referenced by test-windows-liveness-prebuilt or worktree-remove-windows-prebuilt", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestWindowsTestBinariesArtifactNameConsistent pins the upload/download
|
||||
// artifact name shared by windows-test-binaries and its two consumers, and
|
||||
// that both consumers declare the producer as a `needs` dependency (without
|
||||
// it, the download step would race the upload and fail intermittently
|
||||
// instead of deterministically).
|
||||
func TestWindowsTestBinariesArtifactNameConsistent(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
producer := pr.job(t, "windows-test-binaries")
|
||||
upload := producer.step(t, "Upload Windows test binaries")
|
||||
uploadName := upload.With["name"]
|
||||
if uploadName != "windows-test-binaries" {
|
||||
t.Fatalf("producer upload name = %q, want %q", uploadName, "windows-test-binaries")
|
||||
}
|
||||
|
||||
for _, jobName := range []string{"test-windows-liveness-prebuilt", "worktree-remove-windows-prebuilt"} {
|
||||
job := pr.job(t, jobName)
|
||||
download := job.step(t, "Download Windows test binaries")
|
||||
if got := download.With["name"]; got != uploadName {
|
||||
t.Errorf("%s download name = %q, want %q (matching the producer's upload name)", jobName, got, uploadName)
|
||||
}
|
||||
if len(job.Needs) != 1 || job.Needs[0] != "windows-test-binaries" {
|
||||
t.Errorf("%s needs = %v, want exactly [windows-test-binaries]", jobName, job.Needs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// runFlagLiteral extracts the `-run '...'` argument from a step's run body.
|
||||
func runFlagLiteral(t *testing.T, step ciWorkflowStep) string {
|
||||
t.Helper()
|
||||
m := regexp.MustCompile(`-run '([^']+)'`).FindStringSubmatch(step.Run)
|
||||
if m == nil {
|
||||
t.Fatalf("step %q run body has no -run '...' literal:\n%s", step.Name, step.Run)
|
||||
}
|
||||
return m[1]
|
||||
}
|
||||
|
||||
// TestWindowsTestBinariesSelectSameTestsAsNativeJobs is the F4.4 side-by-side
|
||||
// policy test: the cross-built "-prebuilt" jobs must select exactly the same
|
||||
// tests, with the same CGO_ENABLED selection, as the native windows-latest
|
||||
// jobs they are advisory twins of. A -run literal or CGO_ENABLED value that
|
||||
// drifts between the two paths would mean the cross-build is silently
|
||||
// validating a different test subset than the required native lane -
|
||||
// defeating the entire point of running them side by side before any flip.
|
||||
func TestWindowsTestBinariesSelectSameTestsAsNativeJobs(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
|
||||
native := pr.job(t, "test-windows-liveness")
|
||||
prebuilt := pr.job(t, "test-windows-liveness-prebuilt")
|
||||
|
||||
nativeGlobalPrime := native.step(t, "Run native Windows global Prime override")
|
||||
prebuiltGlobalPrime := prebuilt.step(t, "Run native Windows global Prime override (prebuilt)")
|
||||
if n, p := runFlagLiteral(t, nativeGlobalPrime), runFlagLiteral(t, prebuiltGlobalPrime); n != p {
|
||||
t.Errorf("global-prime -run literal mismatch: native %q prebuilt %q", n, p)
|
||||
}
|
||||
if got := nativeGlobalPrime.Env["CGO_ENABLED"]; got != "1" {
|
||||
t.Fatalf("test-windows-liveness CGO_ENABLED = %q, want \"1\" (manifest entries bd.exe/cmd-bd-cgo.test.exe assume this)", got)
|
||||
}
|
||||
|
||||
nativeLiveness := native.step(t, "Run Windows liveness regression test")
|
||||
prebuiltLiveness := prebuilt.step(t, "Run Windows liveness regression test (prebuilt)")
|
||||
if n, p := runFlagLiteral(t, nativeLiveness), runFlagLiteral(t, prebuiltLiveness); n != p {
|
||||
t.Errorf("liveness regression -run literal mismatch: native %q prebuilt %q", n, p)
|
||||
}
|
||||
|
||||
nativeWorktree := pr.job(t, "worktree-remove-windows").step(t, "Run native Windows worktree removal boundary tests")
|
||||
prebuiltWorktree := pr.job(t, "worktree-remove-windows-prebuilt").step(t, "Run native Windows worktree removal boundary tests (prebuilt)")
|
||||
if n, p := runFlagLiteral(t, nativeWorktree), runFlagLiteral(t, prebuiltWorktree); n != p {
|
||||
t.Errorf("worktree-remove -run literal mismatch: native %q prebuilt %q", n, p)
|
||||
}
|
||||
if got := nativeWorktree.Env["CGO_ENABLED"]; got != "0" {
|
||||
t.Fatalf("worktree-remove-windows CGO_ENABLED = %q, want \"0\" (manifest entry cmd-bd-nocgo.test.exe assumes this)", got)
|
||||
}
|
||||
}
|
||||
|
||||
// runGoTestBinaryInvocationPattern matches a scripts/ci/run-go-test-binary.sh
|
||||
// invocation's binary path argument and the flags that follow it, so tests
|
||||
// can pin the exact PKGDIR and flag set passed to a prebuilt binary without
|
||||
// having to byte-match the entire run body.
|
||||
var runGoTestBinaryInvocationPattern = regexp.MustCompile(`run-go-test-binary\.sh "[^"]*/win-bin/([A-Za-z0-9_.-]+)" (\S+) (.*)`)
|
||||
|
||||
// jobWinBinNames returns the distinct win-bin/<name> binaries a job's steps
|
||||
// reference, across both `run` bodies and step `env` values.
|
||||
func jobWinBinNames(job ciWorkflowJob) map[string]bool {
|
||||
names := make(map[string]bool)
|
||||
for _, step := range job.Steps {
|
||||
for _, m := range winBinRefPattern.FindAllStringSubmatch(step.Run, -1) {
|
||||
names[m[1]] = true
|
||||
}
|
||||
for _, env := range step.Env {
|
||||
for _, m := range winBinRefPattern.FindAllStringSubmatch(env, -1) {
|
||||
names[m[1]] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// TestWindowsPrebuiltJobsPinnedToExactBinaryAndArgs closes the gap left by
|
||||
// TestWindowsTestBinariesConsumersMatchManifest (which only checks referenced
|
||||
// binaries exist in the manifest, not which job references which one) and by
|
||||
// TestWindowsTestBinariesSelectSameTestsAsNativeJobs (which checks -run
|
||||
// literals and the *native* job's CGO_ENABLED, not the prebuilt binary name
|
||||
// or its invocation flags). Without this, swapping which "-prebuilt" job
|
||||
// downloads/runs cmd-bd-cgo.test.exe vs. cmd-bd-nocgo.test.exe, dropping
|
||||
// -count=1 from a run-go-test-binary.sh invocation, or changing the PKGDIR
|
||||
// argument passed to it, would all pass every other test in this file.
|
||||
func TestWindowsPrebuiltJobsPinnedToExactBinaryAndArgs(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
|
||||
cases := []struct {
|
||||
jobName string
|
||||
wantBinary string
|
||||
}{
|
||||
{"test-windows-liveness-prebuilt", "cmd-bd-cgo.test.exe"},
|
||||
{"worktree-remove-windows-prebuilt", "cmd-bd-nocgo.test.exe"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
job := pr.job(t, c.jobName)
|
||||
|
||||
// Exactly one *.test.exe referenced, and it is the expected one
|
||||
// (catches a cgo/nocgo swap between the two twins). bd.exe (the
|
||||
// plain executable, not a go-test-c binary) is referenced too by
|
||||
// test-windows-liveness-prebuilt and is out of scope here.
|
||||
testBinaries := make(map[string]bool)
|
||||
for name := range jobWinBinNames(job) {
|
||||
if strings.HasSuffix(name, ".test.exe") {
|
||||
testBinaries[name] = true
|
||||
}
|
||||
}
|
||||
if len(testBinaries) != 1 || !testBinaries[c.wantBinary] {
|
||||
t.Errorf("%s references *.test.exe binaries %v, want exactly {%q}", c.jobName, testBinaries, c.wantBinary)
|
||||
}
|
||||
|
||||
// Every step that actually exercises the test binary (whether via a
|
||||
// direct run-go-test-binary.sh invocation or, for
|
||||
// test-windows-liveness-prebuilt's first step, through
|
||||
// scripts/test.sh's BEADS_TEST_PREBUILT_TEST_BINARY short-circuit)
|
||||
// passes -count=1 (catches a dropped -count=1 on either path).
|
||||
for _, step := range job.Steps {
|
||||
if strings.Contains(step.Run, ".test.exe") && !strings.Contains(step.Run, "-count=1") {
|
||||
t.Errorf("%s step %q exercises the prebuilt test binary without -count=1", c.jobName, step.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Every direct run-go-test-binary.sh invocation in the job also
|
||||
// passes the expected binary and PKGDIR (catches a cgo/nocgo swap or
|
||||
// a PKGDIR change on this path specifically).
|
||||
sawInvocation := false
|
||||
for _, step := range job.Steps {
|
||||
for _, m := range runGoTestBinaryInvocationPattern.FindAllStringSubmatch(step.Run, -1) {
|
||||
sawInvocation = true
|
||||
binary, pkgdir, rest := m[1], m[2], m[3]
|
||||
if binary != c.wantBinary {
|
||||
t.Errorf("%s step %q invokes run-go-test-binary.sh with binary %q, want %q", c.jobName, step.Name, binary, c.wantBinary)
|
||||
}
|
||||
if pkgdir != "./cmd/bd" {
|
||||
t.Errorf("%s step %q invokes run-go-test-binary.sh with PKGDIR %q, want \"./cmd/bd\"", c.jobName, step.Name, pkgdir)
|
||||
}
|
||||
if !regexp.MustCompile(`(^|\s)-count=1(\s|$)`).MatchString(rest) {
|
||||
t.Errorf("%s step %q run-go-test-binary.sh invocation is missing -count=1: %q", c.jobName, step.Name, rest)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !sawInvocation {
|
||||
t.Errorf("%s has no direct run-go-test-binary.sh invocation; this test's PKGDIR/-count=1 checks did not run", c.jobName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fakeGoTestBinaryForTimeoutProbe is a stand-in `go test -c` binary used only
|
||||
// to observe the exact -test.* argv scripts/ci/run-go-test-binary.sh builds,
|
||||
// without a real go toolchain. It is deliberately simpler than
|
||||
// fakePrebuiltTestBinary in test_script_test.go (which also records cwd and
|
||||
// BEADS_TEST_REPO_ROOT): this probe only needs argv.
|
||||
const fakeGoTestBinaryForTimeoutProbe = `#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
for a in "$@"; do
|
||||
printf 'arg=%s\n' "$a"
|
||||
done >"$FAKE_GO_TEST_BINARY_LOG"
|
||||
`
|
||||
|
||||
// TestRunGoTestBinaryDefaultsTimeoutWhenOmitted is the regression test for
|
||||
// F4 review SF-3: scripts/ci/run-go-test-binary.sh must inject the same
|
||||
// -test.timeout=10m default `go test` itself injects when a caller omits
|
||||
// -timeout, and the unconditional -test.paniconexit0 flag Go 1.14+ always
|
||||
// adds. pr.yml's two direct invocations of this script
|
||||
// (test-windows-liveness-prebuilt, worktree-remove-windows-prebuilt; see
|
||||
// TestWindowsPrebuiltJobsPinnedToExactBinaryAndArgs above) both omit
|
||||
// -timeout, relying on exactly this default -- unlike every path that goes
|
||||
// through scripts/test.sh, which always supplies its own -timeout default
|
||||
// (25m, or $TEST_TIMEOUT) before run-go-test-binary.sh ever sees the args,
|
||||
// so that path can never exercise the omitted-timeout branch. This test
|
||||
// calls the real script directly, bypassing test.sh entirely, to pin the one
|
||||
// branch no other test reaches.
|
||||
func TestRunGoTestBinaryDefaultsTimeoutWhenOmitted(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("run-go-test-binary.sh is a bash script; exercised by the Windows CI job itself, not this test")
|
||||
}
|
||||
|
||||
repoRoot := sourceRepoRoot(t)
|
||||
root := t.TempDir()
|
||||
fakeBin := filepath.Join(root, "fake-go-test-binary")
|
||||
if err := os.WriteFile(fakeBin, []byte(fakeGoTestBinaryForTimeoutProbe), 0o755); err != nil {
|
||||
t.Fatalf("write fake go test binary: %v", err)
|
||||
}
|
||||
logPath := filepath.Join(root, "fake-go-test-binary.log")
|
||||
if err := os.WriteFile(logPath, nil, 0o600); err != nil {
|
||||
t.Fatalf("initialize fake go test binary log: %v", err)
|
||||
}
|
||||
|
||||
bash, lookErr := exec.LookPath("bash")
|
||||
if lookErr != nil {
|
||||
t.Fatalf("bash is required to exercise run-go-test-binary.sh: %v", lookErr)
|
||||
}
|
||||
|
||||
script := filepath.Join(repoRoot, "scripts", "ci", "run-go-test-binary.sh")
|
||||
// Deliberately no -timeout: this is the exact invocation shape pr.yml
|
||||
// uses (binary, PKGDIR, -run, -count=1, no -timeout).
|
||||
cmd := exec.Command(bash, script, fakeBin, repoRoot, "-run", "TestNothing", "-count=1")
|
||||
cmd.Env = append(os.Environ(), "FAKE_GO_TEST_BINARY_LOG="+logPath, "GITHUB_WORKSPACE="+repoRoot)
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
t.Fatalf("run-go-test-binary.sh failed: %v\n%s", err, output)
|
||||
}
|
||||
|
||||
logBytes, err := os.ReadFile(logPath)
|
||||
if err != nil {
|
||||
t.Fatalf("read fake go test binary log: %v", err)
|
||||
}
|
||||
var args []string
|
||||
for _, line := range strings.Split(strings.TrimRight(string(logBytes), "\n"), "\n") {
|
||||
if arg, ok := strings.CutPrefix(line, "arg="); ok {
|
||||
args = append(args, arg)
|
||||
}
|
||||
}
|
||||
|
||||
wantArgs := []string{"-test.run", "TestNothing", "-test.count", "1", "-test.timeout", "10m", "-test.paniconexit0"}
|
||||
if strings.Join(args, " ") != strings.Join(wantArgs, " ") {
|
||||
t.Fatalf("run-go-test-binary.sh with no -timeout launched with args %v, want %v (default -test.timeout=10m plus unconditional -test.paniconexit0, matching native `go test`'s own injected flags)", args, wantArgs)
|
||||
}
|
||||
}
|
||||
|
||||
// TestWindowsPrebuiltRequiredFlagMechanism pins the F4 review SF-5
|
||||
// single-flag flip mechanism: WINDOWS_PREBUILT_REQUIRED (pr.yml's top-level
|
||||
// env) is "false" by default, both Windows pairs are unconditionally in
|
||||
// ci-gate's needs and env map (so the gate always evaluates both), and
|
||||
// which pair is actually enforced is decided dynamically in the "Evaluate CI
|
||||
// gate" step's run script rather than by two more names sitting in the
|
||||
// static CI_GATE_REQUIRED list. Without this test, someone could add
|
||||
// test-windows-liveness-prebuilt/worktree-remove-windows-prebuilt back into
|
||||
// CI_GATE_REQUIRED directly (making both pairs required at once, defeating
|
||||
// the flip) or add a new Windows job to ci-gate.needs without routing it
|
||||
// through this mechanism (M3 from the F4 review).
|
||||
func TestWindowsPrebuiltRequiredFlagMechanism(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
|
||||
if got := pr.Env["WINDOWS_PREBUILT_REQUIRED"]; got != "true" {
|
||||
t.Errorf("pr.yml top-level env WINDOWS_PREBUILT_REQUIRED = %q, want \"true\" (the prebuilt pair is required since the side-by-side rollout finished)", got)
|
||||
}
|
||||
|
||||
gate := pr.job(t, "ci-gate")
|
||||
for _, jobName := range []string{
|
||||
"test-windows-liveness", "worktree-remove-windows",
|
||||
"test-windows-liveness-prebuilt", "worktree-remove-windows-prebuilt",
|
||||
} {
|
||||
if !contains(gate.Needs, jobName) {
|
||||
t.Errorf("ci-gate.needs = %v, missing %q", gate.Needs, jobName)
|
||||
}
|
||||
}
|
||||
|
||||
evaluate := gate.step(t, "Evaluate CI gate")
|
||||
wantEnv := map[string]string{
|
||||
"TEST_WINDOWS_LIVENESS": "${{ needs.test-windows-liveness.result }}",
|
||||
"WORKTREE_REMOVE_WINDOWS": "${{ needs.worktree-remove-windows.result }}",
|
||||
"TEST_WINDOWS_LIVENESS_PREBUILT": "${{ needs.test-windows-liveness-prebuilt.result }}",
|
||||
"WORKTREE_REMOVE_WINDOWS_PREBUILT": "${{ needs.worktree-remove-windows-prebuilt.result }}",
|
||||
}
|
||||
for k, want := range wantEnv {
|
||||
if got := evaluate.Env[k]; got != want {
|
||||
t.Errorf("Evaluate CI gate step env %s = %q, want %q", k, got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// The static CI_GATE_REQUIRED declaration must not itself name either
|
||||
// Windows pair -- both are added dynamically below, exactly once, based
|
||||
// on the flag. A static entry here would make that pair unconditionally
|
||||
// required regardless of the flag.
|
||||
staticRequired := evaluate.Env["CI_GATE_REQUIRED"]
|
||||
for _, name := range []string{
|
||||
"TEST_WINDOWS_LIVENESS", "WORKTREE_REMOVE_WINDOWS",
|
||||
"TEST_WINDOWS_LIVENESS_PREBUILT", "WORKTREE_REMOVE_WINDOWS_PREBUILT",
|
||||
} {
|
||||
if regexp.MustCompile(`(^|\s)` + name + `(\s|$)`).MatchString(staticRequired) {
|
||||
t.Errorf("CI_GATE_REQUIRED statically lists %s; it must only be added dynamically by the WINDOWS_PREBUILT_REQUIRED conditional in the run script", name)
|
||||
}
|
||||
}
|
||||
|
||||
run := evaluate.Run
|
||||
for _, want := range []string{
|
||||
`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"`,
|
||||
`CI_GATE_REQUIRED="$CI_GATE_REQUIRED TEST_WINDOWS_LIVENESS WORKTREE_REMOVE_WINDOWS"`,
|
||||
`skipped_ok="$skipped_ok TEST_WINDOWS_LIVENESS_PREBUILT WORKTREE_REMOVE_WINDOWS_PREBUILT"`,
|
||||
`export CI_GATE_REQUIRED`,
|
||||
} {
|
||||
if !strings.Contains(run, want) {
|
||||
t.Errorf("Evaluate CI gate run body missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestWindowsCrossCompileJobsNeverUseSecrets guards the fork-safety
|
||||
// constraint this whole slice was built under: windows-test-binaries and its
|
||||
// two "-prebuilt" consumers run on every PR, including from forks and
|
||||
// Dependabot, and must never need a secret to do so (they only compile code
|
||||
// already in the checkout and move an artifact between jobs). The same
|
||||
// applies to main.yml's cache-seeding twin, which never runs on a fork PR at
|
||||
// all but should still carry no incentive to grow one.
|
||||
func TestWindowsCrossCompileJobsNeverUseSecrets(t *testing.T) {
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
main := readCIWorkflow(t, "main.yml")
|
||||
|
||||
type namedJob struct {
|
||||
workflow string
|
||||
name string
|
||||
job ciWorkflowJob
|
||||
}
|
||||
jobs := []namedJob{
|
||||
{"pr.yml", "windows-test-binaries", pr.job(t, "windows-test-binaries")},
|
||||
{"pr.yml", "test-windows-liveness-prebuilt", pr.job(t, "test-windows-liveness-prebuilt")},
|
||||
{"pr.yml", "worktree-remove-windows-prebuilt", pr.job(t, "worktree-remove-windows-prebuilt")},
|
||||
{"main.yml", "windows-test-binaries-cache", main.job(t, "windows-test-binaries-cache")},
|
||||
}
|
||||
for _, nj := range jobs {
|
||||
if nj.job.Secrets != nil {
|
||||
t.Errorf("%s job %s has non-nil secrets: %v", nj.workflow, nj.name, nj.job.Secrets)
|
||||
}
|
||||
for _, step := range nj.job.Steps {
|
||||
if strings.Contains(step.Run, "secrets.") {
|
||||
t.Errorf("%s job %s step %q run references secrets.*", nj.workflow, nj.name, step.Name)
|
||||
}
|
||||
for k, v := range step.Env {
|
||||
if strings.Contains(v, "secrets.") {
|
||||
t.Errorf("%s job %s step %q env %s references secrets.*", nj.workflow, nj.name, step.Name, k)
|
||||
}
|
||||
}
|
||||
for k, v := range step.With {
|
||||
if strings.Contains(v, "secrets.") {
|
||||
t.Errorf("%s job %s step %q with %s references secrets.*", nj.workflow, nj.name, step.Name, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue