ci(bazel): retire main.yml's Linux jobs, nightly's go test jobs and ci-measurements (#7354)
Push to main and the nightly schedule no longer run go test or repo checks on GitHub runners (ga-96smfk.22, ga-96smfk.58): - main.yml keeps only the macOS -race -short suite, the Windows smoke build and the push-to-main savers of the GOCACHEs pr.yml's Windows/macOS jobs restore. Its Linux jobs (migration hygiene, build artifacts, build tags, versions, duplicate migrations, doc flags, package gates, PR policy wrapper, gofmt, the Linux and setup-go cache seeders, the Nix flake check) are gated on the merge queue's pr.yml/pr-risk.yml run of the same commit and re-run as Bazel targets by bazel.yml's push run. - nightly.yml is the fresh bazel.yml call plus the worker-env check; its Full Test Suite, PR Core go-test-json side and measure dispatch are gone, as are ci-measurements.yml and bazel.yml's go-test-json-artifact input. - The non-race embedded batch-apply step becomes //internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test (go_test_race_off, BEADS_TEST_EMBEDDED_DOLT=1) in the embedded tier. - make ci-pr-policy and scripts/ci/pr-policy.sh go: every check it ran is a Bazel test (TestPRPolicyChecksRunAsBazelTargets). Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b4831e7250
commit
9d13485b71
29 changed files with 271 additions and 2231 deletions
7
.bazelrc
7
.bazelrc
|
|
@ -199,8 +199,7 @@ test:doltserver-integration --experimental_remote_cache_eviction_retries=0
|
|||
# cmd/bd Dolt-server tier: //cmd/bd:bd_dolt_server_test (dolt-server-cmd
|
||||
# tag), the whole integration-tagged cmd/bd suite against a hermetic dolt
|
||||
# sql-server, i.e. the Dolt-gated cmd/bd tests every other lane skips
|
||||
# (BEADS_TEST_SKIP=dolt in --config=prcore/ci and --config=integration, and
|
||||
# in nightly.yml's go test job), and //tests/regression:regression_test
|
||||
# (BEADS_TEST_SKIP=dolt in --config=prcore/ci and --config=integration), and //tests/regression:regression_test
|
||||
# (the differential regression suite, formerly regression.yml, against the
|
||||
# catalog-pinned baseline in @bd_releases). The build flags are exactly
|
||||
# --config=integration's, so it compiles nothing bazel-integration does not
|
||||
|
|
@ -227,8 +226,8 @@ test:doltserver-cmd --local_test_jobs=4
|
|||
test:doltserver-cmd --remote_download_regex=.*/test\.(log|xml)$
|
||||
|
||||
# Integration lane: the `go test` main.yml's former "Main Linux integration"
|
||||
# jobs ran on push (this lane replaced them; nightly.yml's Full Test Suite
|
||||
# still runs the same `go test` over ./... in one job): every package
|
||||
# jobs ran on push (this lane replaced them, and nightly.yml's retired Full
|
||||
# Test Suite, which ran the same `go test` over ./... in one job): every package
|
||||
# built with -tags=integration,gms_pure_go, race, no -short, no -skip,
|
||||
# BEADS_TEST_SKIP=dolt. The tag is set for the whole build, as `go test -tags`
|
||||
# does, not per target: gazelle generates srcs/deps with integration files
|
||||
|
|
|
|||
26
.github/workflows/bazel.yml
vendored
26
.github/workflows/bazel.yml
vendored
|
|
@ -209,14 +209,6 @@ on:
|
|||
type: boolean
|
||||
required: false
|
||||
default: true
|
||||
go-test-json-artifact:
|
||||
description: >
|
||||
Artifact (from the calling run) holding go-test.json, PR Core's
|
||||
`go-test -json` on this commit; enables the equivalence skip-parity
|
||||
check. nightly.yml sets it.
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
# A string, not a boolean: on push and dispatch inputs.integration is
|
||||
# null, and null == false in GitHub's loose comparison, so a boolean
|
||||
# test would silently stop the lane on main.
|
||||
|
|
@ -815,18 +807,8 @@ jobs:
|
|||
python3 tools/bazel/critpath.py "$RUNNER_TEMP/bazel-profile.json" \
|
||||
--tier "$TIER" --log "$RUNNER_TEMP/bazel-test.log" "${budget[@]}"
|
||||
|
||||
# nightly.yml's PR Core `go test -json` on the same commit.
|
||||
- name: Download go-test results
|
||||
if: ${{ always() && inputs.go-test-json-artifact != '' && steps.test.outcome != 'skipped' }}
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ${{ inputs.go-test-json-artifact }}
|
||||
path: ${{ runner.temp }}/go-test-json
|
||||
|
||||
# Fails on any Go test that `go test` runs and Bazel did not (tag filter,
|
||||
# manual, missing target, empty shard) unless it is allowlisted. With
|
||||
# go test results (nightly) it also fails on tests that passed under go
|
||||
# test and were skipped under Bazel; a PR run cannot see those.
|
||||
# manual, missing target, empty shard) unless it is allowlisted.
|
||||
# It reads test.xml from bazel-testlogs, which --config=integration
|
||||
# shares with --config=ci (same output directory): if a job ever runs
|
||||
# both lanes, run each lane's equivalence right after its own
|
||||
|
|
@ -836,11 +818,9 @@ jobs:
|
|||
timeout-minutes: 15
|
||||
env:
|
||||
DETAILS: ${{ inputs.details && '--details' || '' }}
|
||||
GO_TEST_JSON: ${{ inputs.go-test-json-artifact != '' && format('{0}/go-test-json/go-test.json', runner.temp) || '' }}
|
||||
run: |
|
||||
args=()
|
||||
if [ -n "$DETAILS" ]; then args+=("$DETAILS"); fi
|
||||
if [ -n "$GO_TEST_JSON" ]; then args+=(--go-test-json "$GO_TEST_JSON"); fi
|
||||
python3 tools/bazel/equivalence.py --bep "$RUNNER_TEMP/bazel-bep.json" "${args[@]}"
|
||||
|
||||
# Runs last: it rewrites BUILD files in the checkout. main moves BUILD
|
||||
|
|
@ -1370,8 +1350,8 @@ jobs:
|
|||
run: echo "result=$JOB_STATUS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# main.yml's "Main Linux integration packages (N/6)" and "Main Linux
|
||||
# integration cmd/bd (N/8)" jobs (nightly.yml's Full Test Suite runs the
|
||||
# same go test in one job) as --config=integration: every package with
|
||||
# integration cmd/bd (N/8)" jobs (and nightly.yml's retired Full Test
|
||||
# Suite, the same go test in one job) as --config=integration: every package with
|
||||
# -tags=integration,gms_pure_go, race, no -short, BEADS_TEST_SKIP=dolt (see
|
||||
# .bazelrc). A job of its own: ci and integration share bazel-testlogs, so
|
||||
# bazel-test's equivalence step would read this lane's test.xml if both ran
|
||||
|
|
|
|||
763
.github/workflows/ci-measurements.yml
vendored
763
.github/workflows/ci-measurements.yml
vendored
|
|
@ -1,763 +0,0 @@
|
|||
name: CI Measurements
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
suite:
|
||||
description: "Suite to measure"
|
||||
required: true
|
||||
type: string
|
||||
smoke_version:
|
||||
description: "Optional previous release for cross-version-smoke"
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
suite:
|
||||
description: "Suite to measure"
|
||||
required: true
|
||||
type: choice
|
||||
default: pr-linux
|
||||
options:
|
||||
- pr-linux
|
||||
- macos-short
|
||||
- macos-candidates
|
||||
- linux-integration
|
||||
- linux-integration-sharded
|
||||
- linux-integration-hybrid-sharded
|
||||
- linux-integration-hybrid-16-sharded
|
||||
- linux-integration-hybrid-prebuilt-sharded
|
||||
- linux-integration-coverage
|
||||
- cross-version-smoke
|
||||
- nix
|
||||
- mcp-package
|
||||
- npm-package
|
||||
smoke_version:
|
||||
description: "Optional previous release for cross-version-smoke"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.suite }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
pr-linux:
|
||||
name: Measure PR Linux commands
|
||||
if: ${{ inputs.suite == 'pr-linux' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
source ./.buildflags
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
status=0
|
||||
ci_time "pr-policy wrapper" -- make ci-pr-policy || status=$?
|
||||
# -timeout=30m keeps this in step with the lane it measures
|
||||
# (scripts/ci/pr-core.sh). Without it ./cmd/bd can die on `go test`'s
|
||||
# 10m default and the measurement reports a panic instead of a duration.
|
||||
ci_time "pr-core gotestsum" -- gotestsum --junitfile artifacts/pr-core-junit.xml --format testdox -- -race -short -timeout=30m -skip '^TestEmbedded' ./... || status=$?
|
||||
exit "$status"
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-pr-linux
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
macos-short:
|
||||
name: Measure macOS short Go tests
|
||||
if: ${{ inputs.suite == 'macos-short' }}
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
source ./.buildflags
|
||||
|
||||
# -timeout=30m matches the macOS lanes this measures (pr.yml, main.yml).
|
||||
# This is the job that produced the ./cmd/bd duration distribution, and
|
||||
# at 10m it clips its own longest samples into timeout panics.
|
||||
ci_time "macos short go test" -- go test -tags=gms_pure_go -v -race -short -timeout=30m -skip '^TestEmbedded' ./...
|
||||
|
||||
macos-candidates:
|
||||
name: Measure macOS no-short candidates
|
||||
if: ${{ inputs.suite == 'macos-candidates' }}
|
||||
runs-on: macos-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
status=0
|
||||
ci_time "macos no-short go test" -- go test -tags=gms_pure_go -v -race -timeout=30m -skip '^TestEmbedded' ./... || status=$?
|
||||
ci_time "macos integration go test" -- go test -tags=integration,gms_pure_go -v -race -timeout=30m -skip '^TestEmbedded' ./... || status=$?
|
||||
exit "$status"
|
||||
|
||||
linux-integration:
|
||||
name: Measure Linux integration tests
|
||||
if: ${{ inputs.suite == 'linux-integration' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
ci_time "linux integration go test" -- env BEADS_TEST_SKIP=dolt gotestsum --junitfile artifacts/linux-integration-junit.xml --format testdox -- -v -race -tags=integration,gms_pure_go -timeout=30m ./...
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-sharded:
|
||||
name: Measure Linux integration shard ${{ matrix.shard }}/6
|
||||
if: ${{ inputs.suite == 'linux-integration-sharded' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure shard
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
TOTAL_SHARDS: 6
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
|
||||
mapfile -t packages < <(
|
||||
GO_TEST_SHARD_TAGS=integration,gms_pure_go \
|
||||
scripts/ci/go-test-shard-packages.sh "$SHARD" "$TOTAL_SHARDS"
|
||||
)
|
||||
package_manifest="artifacts/linux-integration-packages-${SHARD}-of-${TOTAL_SHARDS}.txt"
|
||||
printf '%s\n' "${packages[@]}" | tee "$package_manifest"
|
||||
|
||||
if [[ "${#packages[@]}" -eq 0 ]]; then
|
||||
echo "No packages assigned to shard ${SHARD}/${TOTAL_SHARDS}; skipping go test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ci_time "linux integration shard ${SHARD}/${TOTAL_SHARDS} go test" -- \
|
||||
env BEADS_TEST_SKIP=dolt gotestsum \
|
||||
--junitfile "artifacts/linux-integration-shard-${SHARD}-of-${TOTAL_SHARDS}.xml" \
|
||||
--format testdox \
|
||||
-- -v -race -tags=integration,gms_pure_go -timeout=30m "${packages[@]}"
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-shard-${{ matrix.shard }}-of-6
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-hybrid-packages:
|
||||
name: Measure Linux integration package shard ${{ matrix.shard }}/6 (no cmd/bd)
|
||||
if: ${{ inputs.suite == 'linux-integration-hybrid-sharded' || inputs.suite == 'linux-integration-hybrid-16-sharded' || inputs.suite == 'linux-integration-hybrid-prebuilt-sharded' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure shard
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
TOTAL_SHARDS: 6
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
|
||||
package_manifest="artifacts/linux-integration-hybrid-packages-${SHARD}-of-${TOTAL_SHARDS}.txt"
|
||||
write_package_manifest() {
|
||||
GO_TEST_SHARD_TAGS=integration,gms_pure_go \
|
||||
GO_TEST_SHARD_EXCLUDE_REGEX="^github.com/steveyegge/beads/cmd/bd$" \
|
||||
scripts/ci/go-test-shard-packages.sh "$SHARD" "$TOTAL_SHARDS" > "$package_manifest"
|
||||
}
|
||||
ci_time "list integration package shard ${SHARD}/${TOTAL_SHARDS}" -- write_package_manifest
|
||||
cat "$package_manifest"
|
||||
mapfile -t packages < "$package_manifest"
|
||||
|
||||
if [[ "${#packages[@]}" -eq 0 ]]; then
|
||||
echo "No packages assigned to shard ${SHARD}/${TOTAL_SHARDS}; skipping go test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ci_time "linux integration package shard ${SHARD}/${TOTAL_SHARDS} go test" -- \
|
||||
env BEADS_TEST_SKIP=dolt gotestsum \
|
||||
--junitfile "artifacts/linux-integration-hybrid-packages-${SHARD}-of-${TOTAL_SHARDS}.xml" \
|
||||
--format testdox \
|
||||
-- -v -race -tags=integration,gms_pure_go -timeout=30m "${packages[@]}"
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-hybrid-packages-${{ matrix.shard }}-of-6
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-hybrid-cmd-bd:
|
||||
name: Measure Linux integration cmd/bd shard ${{ matrix.shard }}/8
|
||||
if: ${{ inputs.suite == 'linux-integration-hybrid-sharded' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure shard
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
TOTAL_SHARDS: 8
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
|
||||
test_manifest="artifacts/linux-integration-cmd-bd-tests-${SHARD}-of-${TOTAL_SHARDS}.txt"
|
||||
write_test_manifest() {
|
||||
GO_TEST_SHARD_TAGS=integration,gms_pure_go \
|
||||
scripts/ci/go-test-shard-names.sh "$SHARD" "$TOTAL_SHARDS" ./cmd/bd > "$test_manifest"
|
||||
}
|
||||
ci_time "list cmd/bd test shard ${SHARD}/${TOTAL_SHARDS}" -- write_test_manifest
|
||||
cat "$test_manifest"
|
||||
mapfile -t tests < "$test_manifest"
|
||||
|
||||
if [[ "${#tests[@]}" -eq 0 ]]; then
|
||||
echo "No tests assigned to shard ${SHARD}/${TOTAL_SHARDS}; skipping go test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_regex="^($(IFS='|'; echo "${tests[*]}"))$"
|
||||
ci_time "linux integration cmd/bd shard ${SHARD}/${TOTAL_SHARDS} go test" -- \
|
||||
env BEADS_TEST_SKIP=dolt gotestsum \
|
||||
--junitfile "artifacts/linux-integration-cmd-bd-${SHARD}-of-${TOTAL_SHARDS}.xml" \
|
||||
--format testdox \
|
||||
-- -v -race -tags=integration,gms_pure_go -timeout=30m -run "$run_regex" ./cmd/bd
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-cmd-bd-${{ matrix.shard }}-of-8
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-hybrid-16-cmd-bd:
|
||||
name: Measure Linux integration cmd/bd shard ${{ matrix.shard }}/16
|
||||
if: ${{ inputs.suite == 'linux-integration-hybrid-16-sharded' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure shard
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
TOTAL_SHARDS: 16
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
|
||||
test_manifest="artifacts/linux-integration-cmd-bd-tests-${SHARD}-of-${TOTAL_SHARDS}.txt"
|
||||
write_test_manifest() {
|
||||
GO_TEST_SHARD_TAGS=integration,gms_pure_go \
|
||||
scripts/ci/go-test-shard-names.sh "$SHARD" "$TOTAL_SHARDS" ./cmd/bd > "$test_manifest"
|
||||
}
|
||||
ci_time "list cmd/bd test shard ${SHARD}/${TOTAL_SHARDS}" -- write_test_manifest
|
||||
cat "$test_manifest"
|
||||
mapfile -t tests < "$test_manifest"
|
||||
|
||||
if [[ "${#tests[@]}" -eq 0 ]]; then
|
||||
echo "No tests assigned to shard ${SHARD}/${TOTAL_SHARDS}; skipping go test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_regex="^($(IFS='|'; echo "${tests[*]}"))$"
|
||||
ci_time "linux integration cmd/bd shard ${SHARD}/${TOTAL_SHARDS} go test" -- \
|
||||
env BEADS_TEST_SKIP=dolt gotestsum \
|
||||
--junitfile "artifacts/linux-integration-cmd-bd-${SHARD}-of-${TOTAL_SHARDS}.xml" \
|
||||
--format testdox \
|
||||
-- -v -race -tags=integration,gms_pure_go -timeout=30m -run "$run_regex" ./cmd/bd
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-cmd-bd-${{ matrix.shard }}-of-16
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-hybrid-prebuilt-bd:
|
||||
name: Measure Linux integration prebuild cmd/bd binary
|
||||
if: ${{ inputs.suite == 'linux-integration-hybrid-prebuilt-sharded' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Measure build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
source ./.buildflags
|
||||
|
||||
ci_time "build cmd/bd subprocess binary" -- go build -tags gms_pure_go -o artifacts/bd ./cmd/bd
|
||||
|
||||
- name: Upload prebuilt bd
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-prebuilt-bd
|
||||
path: artifacts/bd
|
||||
retention-days: 7
|
||||
if-no-files-found: error
|
||||
|
||||
linux-integration-hybrid-prebuilt-cmd-bd:
|
||||
name: Measure Linux integration prebuilt cmd/bd shard ${{ matrix.shard }}/8
|
||||
if: ${{ inputs.suite == 'linux-integration-hybrid-prebuilt-sharded' }}
|
||||
needs: linux-integration-hybrid-prebuilt-bd
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Download prebuilt bd
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ci-measure-linux-integration-prebuilt-bd
|
||||
path: prebuilt-bd
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure shard
|
||||
env:
|
||||
SHARD: ${{ matrix.shard }}
|
||||
TOTAL_SHARDS: 8
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/prebuilt-bd/bd
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
chmod +x "$BEADS_TEST_BD_BINARY"
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
|
||||
test_manifest="artifacts/linux-integration-cmd-bd-tests-${SHARD}-of-${TOTAL_SHARDS}.txt"
|
||||
write_test_manifest() {
|
||||
GO_TEST_SHARD_TAGS=integration,gms_pure_go \
|
||||
scripts/ci/go-test-shard-names.sh "$SHARD" "$TOTAL_SHARDS" ./cmd/bd > "$test_manifest"
|
||||
}
|
||||
ci_time "list cmd/bd test shard ${SHARD}/${TOTAL_SHARDS}" -- write_test_manifest
|
||||
cat "$test_manifest"
|
||||
mapfile -t tests < "$test_manifest"
|
||||
|
||||
if [[ "${#tests[@]}" -eq 0 ]]; then
|
||||
echo "No tests assigned to shard ${SHARD}/${TOTAL_SHARDS}; skipping go test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_regex="^($(IFS='|'; echo "${tests[*]}"))$"
|
||||
ci_time "linux integration prebuilt cmd/bd shard ${SHARD}/${TOTAL_SHARDS} go test" -- \
|
||||
env BEADS_TEST_SKIP=dolt gotestsum \
|
||||
--junitfile "artifacts/linux-integration-prebuilt-cmd-bd-${SHARD}-of-${TOTAL_SHARDS}.xml" \
|
||||
--format testdox \
|
||||
-- -v -race -tags=integration,gms_pure_go -timeout=30m -run "$run_regex" ./cmd/bd
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-prebuilt-cmd-bd-${{ matrix.shard }}-of-8
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
linux-integration-coverage:
|
||||
name: Measure Linux integration coverage
|
||||
if: ${{ inputs.suite == 'linux-integration-coverage' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install gotestsum" -- go install gotest.tools/gotestsum@v1.13.0
|
||||
status=0
|
||||
ci_time "linux integration coverage go test" -- env BEADS_TEST_SKIP=dolt gotestsum --junitfile artifacts/linux-integration-coverage-junit.xml --format testdox -- -v -race -tags=integration,gms_pure_go -coverprofile=artifacts/coverage.out -timeout=30m ./... || status=$?
|
||||
if [[ -f artifacts/coverage.out ]]; then
|
||||
ci_time "coverage summary" -- go tool cover -func=artifacts/coverage.out || status=$?
|
||||
else
|
||||
echo "coverage.out was not generated; skipping coverage summary"
|
||||
fi
|
||||
exit "$status"
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-linux-integration-coverage
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
cross-version-smoke:
|
||||
name: Measure cross-version smoke
|
||||
if: ${{ inputs.suite == 'cross-version-smoke' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
|
||||
- name: Cache previous release binaries
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
|
||||
with:
|
||||
path: ~/.cache/beads-regression
|
||||
key: smoke-binaries-measure-${{ runner.os }}
|
||||
|
||||
- name: Measure commands
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
SMOKE_VERSION: ${{ inputs.smoke_version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
source ./.buildflags
|
||||
|
||||
ci_time "build candidate binary" -- go build -tags gms_pure_go -o /tmp/bd-candidate ./cmd/bd
|
||||
export CANDIDATE_BIN=/tmp/bd-candidate
|
||||
if [[ -z "$SMOKE_VERSION" ]]; then
|
||||
SMOKE_VERSION="$(gh release list --repo "$GITHUB_REPOSITORY" --limit 1 --json tagName --jq '.[0].tagName')"
|
||||
fi
|
||||
if [[ -z "$SMOKE_VERSION" ]]; then
|
||||
echo "Could not resolve a previous release tag for cross-version smoke"
|
||||
exit 1
|
||||
fi
|
||||
ci_time "upgrade smoke ${SMOKE_VERSION}" -- ./scripts/upgrade-smoke-test.sh "$SMOKE_VERSION"
|
||||
|
||||
nix:
|
||||
name: Measure nix build
|
||||
if: ${{ inputs.suite == 'nix' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Install Nix
|
||||
uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "nix build .#default" -- nix build .#default --print-build-logs
|
||||
|
||||
mcp-package:
|
||||
name: Measure MCP package checks
|
||||
if: ${{ inputs.suite == 'mcp-package' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
|
||||
ci_time "install uv" -- pip install uv==0.11.16
|
||||
ci_time "mcp package gate" -- make ci-package-mcp
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-mcp-package
|
||||
path: integrations/beads-mcp/dist/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
|
||||
npm-package:
|
||||
name: Measure npm package checks
|
||||
if: ${{ inputs.suite == 'npm-package' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Measure commands
|
||||
run: |
|
||||
set -euo pipefail
|
||||
source scripts/ci/lib/timing.sh
|
||||
ci_time "npm package gate" -- make ci-package-npm
|
||||
|
||||
- name: Upload measurement artifacts
|
||||
if: always()
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-measure-npm-package
|
||||
path: artifacts/
|
||||
retention-days: 7
|
||||
if-no-files-found: ignore
|
||||
631
.github/workflows/main.yml
vendored
631
.github/workflows/main.yml
vendored
|
|
@ -13,117 +13,6 @@ env:
|
|||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
# Same guard as pr.yml's check-migration-hygiene: direct pushes to main
|
||||
# (and PR merges whose base moved) must not bypass the migration lints.
|
||||
# BASE_SHA is the pre-push tip; on force pushes or history rewrites the
|
||||
# script warns and skips the frozen-migrations diff but still runs the
|
||||
# duplicate-version and nondeterministic-SQL checks.
|
||||
check-migration-hygiene:
|
||||
name: Check migration hygiene
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run migration hygiene checks
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.before }}
|
||||
run: ./scripts/check-migration-hygiene.sh
|
||||
|
||||
build-artifacts:
|
||||
name: Build Artifacts
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Restore Go module cache
|
||||
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 }}-
|
||||
|
||||
# Per `go help cache`, Go's content-addressed build cache includes
|
||||
# compiler options, so this base-tag directory can serve builds with
|
||||
# additional tags. Race builds stay separate; Windows native/cgo
|
||||
# non-race builds share theirs.
|
||||
- name: Restore non-race Go build cache
|
||||
id: restore-non-race-go-build-cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
|
||||
restore-keys: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-
|
||||
|
||||
- name: Build reusable Linux artifacts
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
source ./.buildflags
|
||||
go_version="$(go version)"
|
||||
commit="$(git rev-parse HEAD)"
|
||||
go build -tags gms_pure_go -o artifacts/bd-linux-gms-pure ./cmd/bd
|
||||
chmod +x artifacts/bd-linux-gms-pure
|
||||
go test -tags gms_pure_go -c -o artifacts/bd-cmd-test ./cmd/bd
|
||||
chmod +x artifacts/bd-cmd-test
|
||||
(
|
||||
cd artifacts
|
||||
sha256sum bd-linux-gms-pure > SHA256SUMS
|
||||
)
|
||||
{
|
||||
echo "commit=${commit}"
|
||||
echo "go_version=${go_version}"
|
||||
echo "build_tags=${BEADS_BUILD_TAGS}"
|
||||
echo "artifact=bd-linux-gms-pure"
|
||||
} > artifacts/build-manifest.txt
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: ci-build-artifacts
|
||||
path: artifacts/
|
||||
retention-days: 1
|
||||
if-no-files-found: error
|
||||
|
||||
# F4.3/F7b: pr.yml's check-doc-freshness-platforms and
|
||||
# pr-preflight-platforms ubuntu legs compile several ./scripts and
|
||||
# ./cmd/bd test binaries but, before this, used no GOCACHE at all (every
|
||||
# run cold-compiled them). This warms the non-race GOCACHE this job
|
||||
# already saves (below) with exactly those packages. Shared with
|
||||
# blacksmith-go-build-cache's non-race leg (the same-repo-PR path's
|
||||
# seed) so the two paths can never drift apart (F7b spec 4.2).
|
||||
- name: Warm non-race GOCACHE for preflight/doc-freshness
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: bash scripts/ci/warm-non-race-cache.sh
|
||||
|
||||
- name: Save Go module cache
|
||||
if: 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 non-race Go build cache
|
||||
if: steps.restore-non-race-go-build-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ github.sha }}
|
||||
|
||||
# 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
|
||||
|
|
@ -216,244 +105,6 @@ jobs:
|
|||
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 }}
|
||||
|
||||
# Fast shell/Make guard for direct source-time build-tag declarations.
|
||||
# Workflow `run` steps are checked structurally in the required policy wrapper.
|
||||
check-build-tags:
|
||||
name: Check build-tag policy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
- run: ./scripts/check-build-tags.sh
|
||||
- run: ./scripts/check-go-install-guidance.sh
|
||||
- run: ./scripts/check-winget-portable-alias.sh
|
||||
|
||||
# Fast check to ensure all version files are in sync
|
||||
check-version-consistency:
|
||||
name: Check version consistency
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Check all versions match
|
||||
run: ./scripts/check-versions.sh
|
||||
|
||||
# Catch duplicate migration version numbers before any Go build.
|
||||
# Two long-lived branches both claiming 'the next number' produce a silent
|
||||
# under-apply when merged; this job fails at PR time with the conflicting
|
||||
# filenames so it is caught before any test even compiles.
|
||||
check-no-duplicate-migrations:
|
||||
name: Check no duplicate migration versions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Check for duplicate migration version numbers
|
||||
run: |
|
||||
dup=$(
|
||||
find internal/storage/schema/migrations -maxdepth 1 -name '*.up.sql' -printf '%f\n' \
|
||||
| sed 's/^\([0-9]*\)_.*/\1/' \
|
||||
| sort | uniq -d
|
||||
)
|
||||
if [ -n "$dup" ]; then
|
||||
echo "Duplicate migration version(s) detected: $dup"
|
||||
echo "Conflicting files:"
|
||||
while IFS= read -r v; do
|
||||
find internal/storage/schema/migrations -name "${v}_*.up.sql" -print
|
||||
done <<< "$dup"
|
||||
echo "Renumber one of the colliding files before merging."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check documentation references match actual CLI flags
|
||||
check-doc-flags:
|
||||
name: Check doc flags freshness
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Build bd
|
||||
run: CGO_ENABLED=0 go build -tags gms_pure_go -o bd ./cmd/bd/
|
||||
|
||||
- name: Validate docs against CLI
|
||||
run: |
|
||||
./scripts/check-doc-flags.sh ./bd
|
||||
./scripts/check-doc-freshness.sh
|
||||
|
||||
detect-package-gates:
|
||||
name: Detect package gates
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
mcp_package: ${{ steps.detect.outputs.mcp_package }}
|
||||
npm_package: ${{ steps.detect.outputs.npm_package }}
|
||||
reason: ${{ steps.detect.outputs.reason }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Decide package gates
|
||||
id: detect
|
||||
env:
|
||||
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
PUSH_AFTER_SHA: ${{ github.sha }}
|
||||
run: ./scripts/ci/detect-package-gates.sh
|
||||
|
||||
package-mcp:
|
||||
name: Package Gate (MCP)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [detect-package-gates, build-artifacts]
|
||||
steps:
|
||||
- name: Check applicability
|
||||
id: applicability
|
||||
run: |
|
||||
echo "run=${{ needs.detect-package-gates.outputs.mcp_package }}" >> "$GITHUB_OUTPUT"
|
||||
if [[ "${{ needs.detect-package-gates.outputs.mcp_package }}" != "true" ]]; then
|
||||
echo "MCP package gate is not applicable: ${{ needs.detect-package-gates.outputs.reason }}"
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
|
||||
- name: Set up Python
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: '3.14'
|
||||
|
||||
- name: Install uv
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: python -m pip install uv==0.11.16
|
||||
|
||||
- name: Download build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ci-build-artifacts
|
||||
path: ci-build-artifacts
|
||||
|
||||
- name: Verify build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ci-build-artifacts
|
||||
sha256sum -c SHA256SUMS
|
||||
chmod +x bd-linux-gms-pure
|
||||
|
||||
- name: Run MCP package gate
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
env:
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
|
||||
run: make ci-package-mcp
|
||||
|
||||
package-npm:
|
||||
name: Package Gate (npm)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [detect-package-gates, build-artifacts]
|
||||
steps:
|
||||
- name: Check applicability
|
||||
id: applicability
|
||||
run: |
|
||||
echo "run=${{ needs.detect-package-gates.outputs.npm_package }}" >> "$GITHUB_OUTPUT"
|
||||
if [[ "${{ needs.detect-package-gates.outputs.npm_package }}" != "true" ]]; then
|
||||
echo "npm package gate is not applicable: ${{ needs.detect-package-gates.outputs.reason }}"
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
|
||||
- name: Set up Node.js
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Download build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: ci-build-artifacts
|
||||
path: ci-build-artifacts
|
||||
|
||||
- name: Verify build artifacts
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd ci-build-artifacts
|
||||
sha256sum -c SHA256SUMS
|
||||
chmod +x bd-linux-gms-pure
|
||||
|
||||
- name: Run npm package gate
|
||||
if: steps.applicability.outputs.run == 'true'
|
||||
env:
|
||||
BEADS_TEST_BD_BINARY: ${{ github.workspace }}/ci-build-artifacts/bd-linux-gms-pure
|
||||
run: make ci-package-npm
|
||||
|
||||
|
||||
pr-policy-wrapper:
|
||||
name: PR Policy (wrapper timing)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
# Same cold-fetch exposure as pr.yml's pr-policy-wrapper: setup-go above
|
||||
# runs with cache: false, so every run pulls the whole module graph from
|
||||
# the proxy. Retrying it here means a proxy blip costs seconds instead of
|
||||
# failing a required check.
|
||||
#
|
||||
# Deliberately NOT wrapped around the build: `make ci-pr-policy` runs a
|
||||
# `go build ./cmd/bd` (scripts/ci/pr-policy.sh, build_docs_binary), and a
|
||||
# compile error is not transient. See pr.yml's copy for the full rationale.
|
||||
#
|
||||
# 3 attempts x 120s + 2 backoffs x 10s = 380s worst case. 8m leaves ~100s
|
||||
# of headroom, matching the bounded apt-get step in release.yml.
|
||||
- name: Download modules
|
||||
timeout-minutes: 8
|
||||
run: |
|
||||
downloaded=""
|
||||
for attempt in 1 2 3; do
|
||||
if timeout 120 go mod download; then
|
||||
downloaded=yes
|
||||
break
|
||||
fi
|
||||
echo "::warning::go mod download attempt $attempt failed or timed out"
|
||||
# No backoff after the final attempt - there is nothing left to wait for.
|
||||
if [ "$attempt" -lt 3 ]; then
|
||||
sleep 10
|
||||
fi
|
||||
done
|
||||
# Unlike the best-effort apt-get retries elsewhere in this repo, this
|
||||
# one is load-bearing: nothing downstream can build without the
|
||||
# modules. Fail here, naming the fetch, so a module outage is not
|
||||
# reported as a build failure.
|
||||
if [ -z "$downloaded" ]; then
|
||||
echo "::error::go mod download failed after 3 attempts - module fetch failure, not a build failure"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Run PR policy wrapper
|
||||
run: make ci-pr-policy
|
||||
|
||||
# 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),
|
||||
|
|
@ -561,11 +212,8 @@ jobs:
|
|||
# windows-test-binaries-cache's `runner` matrix.
|
||||
test-windows:
|
||||
name: Test (Windows - smoke, ${{ matrix.venue }})
|
||||
# F7b review fix (B2): added the repository check to match
|
||||
# blacksmith-go-build-cache's convention
|
||||
# above (this job's push-to-main guard predates F7b and already had the
|
||||
# event/ref check; the repository check closes the same fork gap F7c's
|
||||
# own blacksmith-setup-go-cache guard closes). Pinned by
|
||||
# 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' }}
|
||||
|
|
@ -588,8 +236,9 @@ jobs:
|
|||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
# F7b review fix (S7/Speed): see blacksmith-go-build-cache's identical
|
||||
# step above for the full rationale.
|
||||
# F7b review fix (S7/Speed): cache keys are bucketed by go.sum and UTC
|
||||
# day, not per commit, so ordinary push traffic writes at most one
|
||||
# entry per day (TestBlacksmithSaverCacheKeysAreNotPerCommit).
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
shell: bash
|
||||
|
|
@ -666,142 +315,6 @@ jobs:
|
|||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
fmt-check:
|
||||
name: Check formatting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
- name: Check gofmt
|
||||
run: make fmt-check
|
||||
|
||||
# F7b: the saver for the race and non-race GOCACHEs that same-repo-PR
|
||||
# (Blacksmith, blacksmith-4vcpu-ubuntu-2404) jobs restore: the non-race one
|
||||
# for pr-preflight-platforms' and check-doc-freshness-platforms' ubuntu
|
||||
# legs; the race one compiles ./scripts/... with -race (once the compile
|
||||
# set of scripts-go-checks' retired scripts-test leg). Blacksmith runners
|
||||
# cannot see caches `actions/cache` saved from a GitHub-hosted runner (and
|
||||
# vice versa) even for an identical key, so without this those legs would
|
||||
# stay cold forever.
|
||||
#
|
||||
# The `venue` matrix also seeds the ubuntu-latest (fork/Dependabot) path's
|
||||
# race cache, which the legacy embedded build used to save before Bazel
|
||||
# took over that tier on push; build-artifacts still seeds that path's
|
||||
# non-race cache, so the github x non-race leg is excluded as redundant.
|
||||
# The ternary `runs-on` form (rather than a literal Blacksmith label) is
|
||||
# required for actionlint, same as every other Blacksmith `runs-on` here.
|
||||
# main.yml only triggers on push to main (already trusted).
|
||||
#
|
||||
# F7b review fix (B2): pin push-to-main-only at the job level too, not just
|
||||
# via this workflow's current `on: push` trigger (same defense-in-depth
|
||||
# rationale as F7c review fix S2's blacksmith-setup-go-cache guard above --
|
||||
# if main.yml ever gained a pull_request/merge_group trigger, a bare
|
||||
# `on: push` assumption would silently let this job, and the unguarded
|
||||
# saver below it, run on a same-repo PR, making every same-repo PR a writer
|
||||
# of this Blacksmith cache namespace). Pinned by
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest.
|
||||
blacksmith-go-build-cache:
|
||||
name: Warm Go build cache (${{ matrix.flavor }}, ${{ matrix.venue }})
|
||||
runs-on: ${{ matrix.venue == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
flavor: [race, non-race]
|
||||
venue: [blacksmith, github]
|
||||
# build-artifacts seeds the GitHub-hosted non-race cache.
|
||||
exclude:
|
||||
- flavor: non-race
|
||||
venue: github
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
id: setup-go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: false
|
||||
|
||||
# F7b review fix (S7/Speed): bounds this saver's writes to at most once
|
||||
# per UTC calendar day per go.sum, not once per push to main. The old
|
||||
# ${{ github.sha }} suffix wrote a brand-new multi-GB race+non-race
|
||||
# build-cache entry on every single push regardless of whether go.sum
|
||||
# changed; on Blacksmith's 25 GB/week/repo quota (LRU eviction, no
|
||||
# per-repo exemption the way GitHub-hosted actions/cache effectively
|
||||
# has) that churn (measured ~1.74GB/push for this job's two flavors
|
||||
# alone) could exhaust the week's budget in a single day of ordinary
|
||||
# push traffic and evict every other Blacksmith-reachable job's cache.
|
||||
# Same convention as F7c review fix S5's blacksmith-setup-go-cache
|
||||
# (main.yml, above). Pinned by TestBlacksmithSaverCacheKeysAreNotPerCommit.
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- 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: Restore race Go build cache
|
||||
id: restore-race-go-build-cache
|
||||
if: matrix.flavor == 'race'
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ 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-race-
|
||||
|
||||
- name: Restore non-race Go build cache
|
||||
id: restore-non-race-go-build-cache
|
||||
if: matrix.flavor == 'non-race'
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ 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-
|
||||
|
||||
# -run '^$' selects no tests (only compiles), so this needs no
|
||||
# Dolt/test-env setup.
|
||||
- name: Warm race GOCACHE
|
||||
if: matrix.flavor == 'race'
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/race
|
||||
run: go test -race -run '^$' -tags gms_pure_go ./scripts/...
|
||||
|
||||
# pr-preflight-platforms'/check-doc-freshness-platforms' ubuntu legs via
|
||||
# warm-non-race-cache.sh, shared with build-artifacts' identical step so
|
||||
# the two paths can never drift apart (F7b spec 4.2).
|
||||
- name: Warm non-race GOCACHE (preflight/doc-freshness)
|
||||
if: matrix.flavor == 'non-race'
|
||||
env:
|
||||
GOCACHE: ${{ runner.temp }}/go-cache/non-race
|
||||
run: bash scripts/ci/warm-non-race-cache.sh
|
||||
|
||||
- name: Save race Go build cache
|
||||
if: ${{ !cancelled() && matrix.flavor == 'race' && steps.restore-race-go-build-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
- name: Save non-race Go build cache
|
||||
if: ${{ !cancelled() && matrix.flavor == 'non-race' && steps.restore-non-race-go-build-cache.outputs.cache-hit != 'true' }}
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
# 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,
|
||||
|
|
@ -810,10 +323,10 @@ jobs:
|
|||
# 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
|
||||
# (warm-non-race-cache.sh, the same script the Linux/Windows seeders use)
|
||||
# (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 blacksmith-go-build-cache, so a PR can never
|
||||
# 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
|
||||
# TestBlacksmithSaverJobsGuardedAgainstPullRequest,
|
||||
|
|
@ -889,132 +402,4 @@ jobs:
|
|||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ runner.temp }}/go-cache/non-race
|
||||
key: beads-go-build-v2-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-base-gms_pure_go-non-race-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
|
||||
test-nix:
|
||||
name: Test Nix Flake
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
- uses: DeterminateSystems/determinate-nix-action@527f17dd63d2d60d3e5552934bc84b9a33a14d11 # v3
|
||||
- name: Run bd help via Nix
|
||||
id: nix_help
|
||||
run: |
|
||||
nix run .#default -- --help > help.txt
|
||||
# Every flake check for the runner's own system (today: hook-timeout-
|
||||
# backends, checks.nix). `nix flake check` rather than a spelled-out
|
||||
# `.#checks.x86_64-linux.<name>`: no hardcoded system, and a check added
|
||||
# to checks.nix is run without a workflow edit.
|
||||
- name: Run the flake checks
|
||||
run: |
|
||||
nix flake check -L
|
||||
- name: Verify help text
|
||||
if: steps.nix_help.outcome == 'success'
|
||||
run: |
|
||||
FIRST_LINE=$(head -n 1 help.txt)
|
||||
EXPECTED="Issues chained together like beads. A lightweight issue tracker with first-class dependency support."
|
||||
if [ "$FIRST_LINE" != "$EXPECTED" ]; then
|
||||
echo "First line of help.txt doesn't match expected output"
|
||||
echo "Expected: $EXPECTED"
|
||||
echo "Got: $FIRST_LINE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Help text first line is correct"
|
||||
|
||||
# F7c: Blacksmith cannot see GitHub-hosted cache entries, so the advisory
|
||||
# workflows that moved onto a same-repo-PR Blacksmith runner (Regression's
|
||||
# PR run, Cross-Version Smoke, Proxied Local) need a
|
||||
# Blacksmith-side writer for their Go build
|
||||
# cache. This job is push-to-main only (always trusted), so it is the ONLY
|
||||
# writer: it always restores whatever is available, unconditionally re-runs
|
||||
# every warm-up command (not gated on a cache hit), and then always saves
|
||||
# under a key suffixed with this push's commit SHA. Every PR-side consumer
|
||||
# uses `actions/cache/restore` only (never saves) with the same key
|
||||
# prefix/restore-keys below, so a same-repo PR can read this cache but can
|
||||
# never write an entry another PR or main would later read back unverified
|
||||
# (B2, F7c implementation report). This also means the key format is one we
|
||||
# define ourselves (`blacksmith-sg-v1-...`), not setup-go's own implicit
|
||||
# key, so there is no dependency on Blacksmith's `$ImageOS` resolving the
|
||||
# same way setup-go's own cache-action would have assumed.
|
||||
#
|
||||
# Precondition (spec-f7.md §3): an org admin must confirm Blacksmith's
|
||||
# "branch-protected caches" toggle is ON before this seed is trusted to
|
||||
# feed PR-scoped restores; a mismatched or OFF setting only degrades PR
|
||||
# jobs to a cold cache (restore-only, so there is no correctness risk
|
||||
# either way) -- see the F7c implementation report.
|
||||
blacksmith-setup-go-cache:
|
||||
name: Seed setup-go cache (Blacksmith)
|
||||
# A literal (non-expression) Blacksmith label is actionlint's unknown-
|
||||
# runner-label check; every other same-repo Blacksmith job in this repo
|
||||
# routes through a conditional expression instead (actionlint only
|
||||
# validates literal runs-on strings). This job is push-to-main only
|
||||
# (always trusted, so there is nothing to gate on), but it still wraps
|
||||
# the label in a trivial expression to keep actionlint clean and match
|
||||
# repo convention.
|
||||
runs-on: ${{ 'blacksmith-4vcpu-ubuntu-2404' }}
|
||||
# F7c review fix S2: pin push-to-main-only at the job level, not just via
|
||||
# this workflow's current `on: push` trigger. If main.yml ever gained a
|
||||
# pull_request (or merge_group) trigger in the future, a bare
|
||||
# `github.repository == ...` guard would let this job - and the bare,
|
||||
# always-saving cache below it - run on a PR, making every same-repo PR a
|
||||
# writer of the Blacksmith setup-go cache namespace every advisory
|
||||
# consumer trusts. Pinned exactly by
|
||||
# TestBlacksmithSeederGuardedAgainstPullRequest.
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'
|
||||
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
|
||||
|
||||
# F7c review fix S5: the old key suffix was ${{ github.sha }}, so every
|
||||
# single push to main - whether or not go.sum changed - saved a brand
|
||||
# new multi-GB ~/go/pkg/mod + ~/.cache/go-build entry under this
|
||||
# namespace. On a cache store with LRU eviction (Blacksmith), that churn
|
||||
# risked evicting F7a's own beads-go-mod-v2-*/beads-go-build-v2-* cache
|
||||
# entries. Keying per UTC day instead still bounds staleness (a go.sum
|
||||
# change is picked up on save on the very next push, and a same-day
|
||||
# restore-keys fallback to yesterday's entry is only ever a prefix
|
||||
# away), while capping writes to at most once per calendar day instead
|
||||
# of once per push. Pinned by TestBlacksmithSeederCacheKeyIsNotPerCommit.
|
||||
- name: Compute cache date
|
||||
id: cache-date
|
||||
run: echo "today=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore Blacksmith setup-go cache
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: blacksmith-sg-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
restore-keys: |
|
||||
blacksmith-sg-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.sum') }}-
|
||||
blacksmith-sg-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-
|
||||
|
||||
# Unconditional (not gated on a cache hit): this job's entire purpose is
|
||||
# to keep the Blacksmith-side cache warm, so it must always repopulate
|
||||
# GOCACHE/GOMODCACHE even when the restore step above already found a
|
||||
# usable entry (a stale or partial restore should still self-heal here).
|
||||
- name: Build bd
|
||||
run: make build
|
||||
|
||||
# Always save (even if a warm-up step above failed) under a fresh,
|
||||
# commit-specific key: the content is still a valid, newer GOCACHE/
|
||||
# GOMODCACHE snapshot than whatever was restored, and `cache/save` is a
|
||||
# pure write with no read-back of PR-controlled state, so there is no
|
||||
# poisoning concern in saving unconditionally here.
|
||||
- name: Save Blacksmith setup-go cache
|
||||
if: always()
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: blacksmith-sg-v1-${{ runner.os }}-${{ runner.arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('go.sum') }}-${{ steps.cache-date.outputs.today }}
|
||||
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 }}
|
||||
197
.github/workflows/nightly.yml
vendored
197
.github/workflows/nightly.yml
vendored
|
|
@ -1,110 +1,27 @@
|
|||
name: Nightly Full Tests
|
||||
name: Nightly
|
||||
|
||||
# Every nightly test runs under Bazel on rbe-west: the `bazel` call below is
|
||||
# the full suite with no cached test results. Nothing here runs go test on a
|
||||
# runner (ga-96smfk.22).
|
||||
on:
|
||||
schedule:
|
||||
# Run at 2am UTC daily
|
||||
- cron: '0 2 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
suite:
|
||||
description: "Nightly suite or measurement suite"
|
||||
required: true
|
||||
type: choice
|
||||
default: full-test
|
||||
options:
|
||||
- full-test
|
||||
- pr-linux
|
||||
- macos-short
|
||||
- macos-candidates
|
||||
- linux-integration
|
||||
- linux-integration-sharded
|
||||
- linux-integration-hybrid-sharded
|
||||
- linux-integration-hybrid-16-sharded
|
||||
- linux-integration-hybrid-prebuilt-sharded
|
||||
- linux-integration-coverage
|
||||
- cross-version-smoke
|
||||
- nix
|
||||
- mcp-package
|
||||
- npm-package
|
||||
- bazel
|
||||
smoke_version:
|
||||
description: "Optional previous release for cross-version-smoke"
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
env:
|
||||
BD_DISABLE_METRICS: "1"
|
||||
BD_DISABLE_EVENT_FLUSH: "1"
|
||||
|
||||
jobs:
|
||||
measure:
|
||||
name: Measure selected CI suite
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.suite != 'full-test' && inputs.suite != 'bazel' }}
|
||||
uses: ./.github/workflows/ci-measurements.yml
|
||||
with:
|
||||
suite: ${{ inputs.suite }}
|
||||
smoke_version: ${{ inputs.smoke_version }}
|
||||
|
||||
# PR Core's go test (scripts/ci/pr-core.sh) with -json output, so the Bazel
|
||||
# job below can compare per-test status: a test that passes here and skips
|
||||
# under Bazel fails the equivalence check unless allowlisted.
|
||||
bazel-go-test-json:
|
||||
name: Bazel equivalence (go-test side)
|
||||
if: ${{ github.event_name == 'schedule' || inputs.suite == 'bazel' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
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: Install Dolt
|
||||
run: ./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Run PR core go-test (JSON)
|
||||
env:
|
||||
BEADS_PR_CORE_GO_TEST_JSON: ${{ runner.temp }}/go-test.json
|
||||
run: make ci-pr-core
|
||||
|
||||
# Uploaded even when tests fail: the status comparison still applies.
|
||||
- name: Upload go-test results
|
||||
if: ${{ always() }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
||||
with:
|
||||
name: bazel-equivalence-go-test-json
|
||||
path: ${{ runner.temp }}/go-test.json
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
# Bazel lane with the full go test equivalence listing and the skip-parity
|
||||
# check (reported here; PRs gate on it through pr.yml). Remote execution
|
||||
# when the repo secrets are present; bazel.yml gets the four RBE secrets
|
||||
# plus rbe-prewarm's bazel-allocator app private key (same-repo/scheduled
|
||||
# trigger only, so pre-warming is safe here - see bazel.yml's
|
||||
# "rbe-west Pre-warm" header and engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md).
|
||||
# Bazel lane with the full equivalence listing (package and test-name sets;
|
||||
# PRs gate on it through pr.yml). Remote execution when the repo secrets
|
||||
# are present; bazel.yml gets the four RBE secrets plus rbe-prewarm's
|
||||
# bazel-allocator app private key (same-repo/scheduled trigger only, so
|
||||
# pre-warming is safe here - see bazel.yml's "rbe-west Pre-warm" header and
|
||||
# engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md).
|
||||
bazel:
|
||||
name: Bazel equivalence (full detail)
|
||||
needs: bazel-go-test-json
|
||||
if: ${{ !cancelled() && (github.event_name == 'schedule' || inputs.suite == 'bazel') }}
|
||||
name: Bazel (fresh, full detail)
|
||||
uses: ./.github/workflows/bazel.yml
|
||||
secrets:
|
||||
RBE_WEST_EXECUTOR: ${{ secrets.RBE_WEST_EXECUTOR }}
|
||||
|
|
@ -114,7 +31,6 @@ jobs:
|
|||
RBE_POOL_APP_PRIVATE_KEY: ${{ secrets.RBE_POOL_APP_PRIVATE_KEY }}
|
||||
with:
|
||||
details: true
|
||||
go-test-json-artifact: bazel-equivalence-go-test-json
|
||||
# The one run that re-executes every test (no cached test results):
|
||||
# PRs, merge groups and pushes to main reuse unchanged tests' PASSes,
|
||||
# so this keeps sampling flaky and -race failures every night.
|
||||
|
|
@ -126,7 +42,6 @@ jobs:
|
|||
# that falls behind queues every remote action, so say so every night.
|
||||
rbe-worker-env-sync:
|
||||
name: rbe worker-env in step with gascity
|
||||
if: ${{ github.event_name == 'schedule' || inputs.suite == 'bazel' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
|
|
@ -136,93 +51,3 @@ jobs:
|
|||
|
||||
- name: Compare the worker-env manifest and pin with gascity's main
|
||||
run: tools/rbe/worker-env-sync main
|
||||
|
||||
full-test:
|
||||
name: Full Test Suite
|
||||
if: ${{ github.event_name == 'schedule' || inputs.suite == 'full-test' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Install Dolt
|
||||
run: |
|
||||
./scripts/ci/install-dolt.sh
|
||||
|
||||
- name: Configure Git and Dolt identity
|
||||
run: |
|
||||
git config --global user.name "CI Bot"
|
||||
git config --global user.email "ci@beads.test"
|
||||
dolt config --global --add user.name "CI Bot"
|
||||
dolt config --global --add user.email "ci@beads.test"
|
||||
|
||||
- name: Build
|
||||
run: go build -v -tags gms_pure_go ./cmd/bd
|
||||
|
||||
- name: Full Test Suite (including integration tests)
|
||||
env:
|
||||
# Skip Docker-based Dolt testcontainer tests — they hang in
|
||||
# GitHub Actions (known issue, see scripts/repro-dolt-hang/).
|
||||
# Non-Docker integration tests still run via the installed dolt binary.
|
||||
BEADS_TEST_SKIP: dolt
|
||||
run: go test -v -race -tags=integration,gms_pure_go -coverprofile=coverage.out -timeout=30m ./...
|
||||
|
||||
# The suite above never sets BEADS_TEST_EMBEDDED_DOLT, so every
|
||||
# skipUnlessEmbeddedDolt-gated test in internal/storage/embeddeddolt
|
||||
# (including TestBatchApplyContract, the 1000-item case of
|
||||
# TestLargeBatchApplyWallClock_Embedded, and — F1 — the 712-item case of
|
||||
# TestLargeBatchApplyStatementCounts712_Embedded) is skipped there, on
|
||||
# every lane, not just this one. This step is their only non-race
|
||||
# coverage of a real 1000-item apply through the embedded backend, and
|
||||
# (F1) the only coverage at all of the 712-item shape's pinned
|
||||
# statement-count regression baseline on a per-PR race lane: the race
|
||||
# lanes (main.yml, pr-risk.yml) shrink/skip those cases under
|
||||
# raceEnabled — see
|
||||
# internal/storage/embeddeddolt/large_batch_apply_measure_test.go — and
|
||||
# the PR-conditional server-Dolt full suite (full_embedded in
|
||||
# .github/scripts/ci-embedded-tier.sh) covers the SAME write body
|
||||
# (internal/storage/issueops.ApplyBatchInTx) through a different
|
||||
# backend, not this one. Non-race here because the embedded engine's
|
||||
# own goroutine/lock machinery runs inside this test binary and the
|
||||
# race detector dramatically inflates its wall-clock (see
|
||||
# race_detector_on_test.go), which is exactly what
|
||||
# TestLargeBatchApplyWallClock_Embedded is measuring and exactly why
|
||||
# TestLargeBatchApplyStatementCounts712_Embedded's 712-item case takes
|
||||
# ~260-300s under -race (genuine engine-internal race overhead, not
|
||||
# test logic — see that test's doc comment). The same holds for the
|
||||
# 458-issue batch-create equivalence scenarios
|
||||
# (TestCreateBatchFastPathsMatchPerRowLarge_Embedded).
|
||||
- name: Embedded Dolt batch-apply suite (non-race)
|
||||
if: ${{ !cancelled() }}
|
||||
env:
|
||||
BEADS_TEST_EMBEDDED_DOLT: "1"
|
||||
run: go test -tags gms_pure_go -timeout 20m -run '^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded|TestLargeBatchApplyStatementCounts712_Embedded|TestCreateBatchFastPathsMatchPerRowLarge_Embedded)$' ./internal/storage/embeddeddolt
|
||||
|
||||
- name: Check coverage threshold
|
||||
run: |
|
||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||
echo "Coverage: $COVERAGE%"
|
||||
# Threshold is lower (30%) because Docker-based Dolt integration
|
||||
# tests are skipped in CI (BEADS_TEST_SKIP=dolt). With Docker
|
||||
# tests included, coverage would be ~50%+.
|
||||
if (( $(echo "$COVERAGE < 30" | bc -l) )); then
|
||||
echo "❌ Coverage is below 30% threshold"
|
||||
exit 1
|
||||
elif (( $(echo "$COVERAGE < 40" | bc -l) )); then
|
||||
echo "⚠️ Coverage is below 40% (warning threshold)"
|
||||
else
|
||||
echo "✅ Coverage meets threshold"
|
||||
fi
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6
|
||||
if: success()
|
||||
continue-on-error: true
|
||||
with:
|
||||
file: ./coverage.out
|
||||
fail_ci_if_error: false
|
||||
|
|
|
|||
11
Makefile
11
Makefile
|
|
@ -46,7 +46,7 @@ endif
|
|||
.PHONY: all build doctor-build test test-icu-path test-full-cgo test-regression test-upgrade test-cross-version test-migration corpus-regen githooks-regen bench bench-quick clean clean-test-tmp install install-force help check-up-to-date fmt fmt-check check-testing-short
|
||||
.PHONY: lint lint-changed vet
|
||||
.PHONY: check check-go test-go check-docs-go
|
||||
.PHONY: ci-pr-core ci-pr-policy ci-pr-lint ci-complexity ci-complexity-diff ci-complexity-check ci-package-mcp ci-package-npm
|
||||
.PHONY: ci-pr-core ci-pr-lint ci-complexity ci-complexity-diff ci-complexity-check ci-package-mcp ci-package-npm
|
||||
.PHONY: api-gen api-check
|
||||
.PHONY: bazel-sync bazel-sync-check
|
||||
|
||||
|
|
@ -229,9 +229,6 @@ test-full-cgo:
|
|||
ci-pr-core:
|
||||
@./scripts/ci/pr-core.sh
|
||||
|
||||
ci-pr-policy:
|
||||
@./scripts/ci/pr-policy.sh
|
||||
|
||||
# Lint and vet are nogo (//tools/nogo): go test's vet checks plus the
|
||||
# golangci-lint linters .golangci.yml enables, validated beside every Go
|
||||
# compile, so any `bazel build`/`bazel test` (local or on rbe-west) fails on a
|
||||
|
|
@ -295,9 +292,8 @@ api-gen:
|
|||
go generate -tags "$(BUILD_TAGS)" ./internal/httpapi/apigen
|
||||
|
||||
# Two-part spec drift gate: regenerate and fail if regeneration CHANGED
|
||||
# anything, then run the spec tests. Runs in the PR workflow's policy job
|
||||
# (scripts/ci/pr-policy.sh), on every pull request, never only on
|
||||
# push-to-main.
|
||||
# anything, then run the spec tests. CI runs the drift half as
|
||||
# //scripts/repochecks:types_gen_drift_test.
|
||||
#
|
||||
# The drift question is "do the checked-out types already match the checked-out
|
||||
# spec", so the comparison is before-vs-after regeneration rather than
|
||||
|
|
@ -544,7 +540,6 @@ help:
|
|||
@echo " make test-icu-path - Run opt-in ICU regex path tests (maintainer-only)"
|
||||
@echo " make test-full-cgo - Deprecated alias for make test-icu-path"
|
||||
@echo " make ci-pr-core - Run required PR core Go test wrapper"
|
||||
@echo " make ci-pr-policy - Run required PR policy wrapper"
|
||||
@echo " make ci-pr-lint - Run the required lint gate: nogo (vet + golangci-lint's linters) under Bazel, native + windows/darwin"
|
||||
@echo " make lint - Same as ci-pr-lint (make vet too)"
|
||||
@echo " make lint-changed - nogo over the Bazel packages of changed Go files (LINT_CHANGED_SCOPE=staged|worktree)"
|
||||
|
|
|
|||
18
RELEASING.md
18
RELEASING.md
|
|
@ -94,15 +94,19 @@ release-critical gates do not all run on every PR, so "tag the tip of main"
|
|||
means tagging a SHA nobody has fully tested. A burned tag is never reused
|
||||
(the v1.1.1 and v1.2.0 precedents), so that gamble is expensive.
|
||||
|
||||
**Cut the branch from a SHA that is green on both `Main` and
|
||||
`Nightly Full Tests`.** The `Main` workflow runs on push to `main` and the
|
||||
`Nightly Full Tests` workflow runs on a 2am UTC schedule, so the newest SHA
|
||||
with both is usually a few hours behind the tip:
|
||||
**Cut the branch from a SHA that is green on `Bazel`, `Main` and
|
||||
`Nightly`.** The `Bazel` workflow (every Linux test lane, on rbe-west) and
|
||||
the `Main` workflow (the macOS and Windows jobs) run on push to `main`, and
|
||||
the `Nightly` workflow (the full Bazel suite with no cached test results)
|
||||
runs on a 2am UTC schedule, so the newest SHA with all three is usually a
|
||||
few hours behind the tip:
|
||||
|
||||
```bash
|
||||
gh run list --workflow Bazel --branch main --event push --status success --limit 5 \
|
||||
--json headSha,conclusion,createdAt
|
||||
gh run list --workflow Main --branch main --status success --limit 5 \
|
||||
--json headSha,conclusion,createdAt
|
||||
gh run list --workflow "Nightly Full Tests" --status success --limit 3 \
|
||||
gh run list --workflow Nightly --status success --limit 3 \
|
||||
--json headSha,conclusion,createdAt
|
||||
|
||||
git fetch origin
|
||||
|
|
@ -136,8 +140,8 @@ git log --oneline main..release/1.3.0
|
|||
|
||||
Before starting a release:
|
||||
|
||||
- [ ] `release/x.y.z` branch cut from a SHA green on `Main` **and**
|
||||
`Nightly Full Tests` (see [Release Branches](#release-branches))
|
||||
- [ ] `release/x.y.z` branch cut from a SHA green on `Bazel`, `Main` **and**
|
||||
`Nightly` (see [Release Branches](#release-branches))
|
||||
- [ ] All tests passing (`make test`, the Bazel test lane)
|
||||
- [ ] npm package tests passing (`cd npm-package && npm run test:all`)
|
||||
- [ ] **Upgrade smoke tests pass** (`make test-upgrade`) — see [Release Stability Gate](engdocs/RELEASE-STABILITY-GATE.md)
|
||||
|
|
|
|||
|
|
@ -1554,8 +1554,7 @@ sh_test(
|
|||
# instead of skipping every Dolt-gated test into a cached pass. These are
|
||||
# the cmd/bd tests no other lane runs: every other configuration of bd_test
|
||||
# passes BEADS_TEST_SKIP=dolt (prcore/ci, integration) or runs only its
|
||||
# manifest (bd_embedded_test, bd_proxied_test), and so does nightly.yml's
|
||||
# go test job. No -test.run/-test.skip: the Go binary shards
|
||||
# manifest (bd_embedded_test, bd_proxied_test). No -test.run/-test.skip: the Go binary shards
|
||||
# itself over every top-level test (rules_go's TEST_SHARD_INDEX), so each
|
||||
# runs in exactly one shard, and check_testcases.py fails a shard that ran
|
||||
# none. It repeats bd_test's `env` (the wrapper cannot inherit it).
|
||||
|
|
|
|||
|
|
@ -140,9 +140,22 @@ Current PR-related workflow names:
|
|||
detection and the `bazel-coverage` decision were retired (ga-96smfk.22):
|
||||
`pr.yml`'s Bazel lanes run those tests.
|
||||
- `.github/workflows/main.yml`: `Main`
|
||||
Runs on pushes to `main`. Contains the main branch health checks, package
|
||||
gates, platform smoke/short coverage, embedded Dolt coverage, and promoted
|
||||
Linux no-short integration shards.
|
||||
Runs on pushes to `main`. Contains only what rbe-west cannot run: the macOS
|
||||
`go test -race -short` suite and the Windows smoke build on Blacksmith, and
|
||||
the push-to-main savers of the GOCACHEs pr.yml's Windows and macOS jobs
|
||||
restore. Every Linux check it used to repeat (migration hygiene, build
|
||||
tags, versions, doc flags, gofmt, the PR policy wrapper, the package gates,
|
||||
the Nix flake check and the Linux cache seeders) is gated before the merge
|
||||
by the merge queue's `pr.yml`/`pr-risk.yml` run of the same commit, and
|
||||
`bazel.yml`'s push run re-runs the Bazel targets (ga-96smfk.22).
|
||||
- `.github/workflows/nightly.yml`: `Nightly`
|
||||
Runs at 02:00 UTC. Calls `bazel.yml` with `fresh-test-results: true` (every
|
||||
test re-executed, no cached results) and checks the rbe-west worker-env
|
||||
pin against gascity. It runs no `go test` on a runner: its former Full Test
|
||||
Suite, PR Core `go test -json` equivalence side and `ci-measurements.yml`
|
||||
dispatch suites are retired; the non-race embedded batch-apply step is
|
||||
`//internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test` in
|
||||
the embedded tier.
|
||||
- The differential regression suite (`tests/regression`, formerly
|
||||
`regression.yml`) is `//tests/regression:regression_test`, tagged
|
||||
`dolt-server-cmd`, so `bazel.yml`'s `bazel-cmd-dolt` lane runs it on every
|
||||
|
|
@ -926,9 +939,10 @@ Required` requires them to have run remotely and passed.
|
|||
- PR Core's other work: `scripts/ci/pr-core.sh` is the one `go test` (plus
|
||||
a timing summary); its `BEADS_TEST_REQUIRE_EXCLUDE_PERMISSION=1` is
|
||||
`test:prcore`'s too. `bazel-test`'s equivalence step compares Bazel's
|
||||
tests with `go list`, not with PR Core's run, so it is unaffected;
|
||||
`nightly.yml` still runs PR Core's `go test -json` for the skip-parity
|
||||
check.
|
||||
tests with `go list`, not with PR Core's run, so it is unaffected. The
|
||||
skip-parity check (`equivalence.py --go-test-json`) has no CI caller
|
||||
since nightly's go-test side was retired (ga-96smfk.22); run it by hand
|
||||
with `BEADS_PR_CORE_GO_TEST_JSON` when auditing a skip.
|
||||
- `--config=sole-run` (`--experimental_remote_cache_eviction_retries=0`,
|
||||
the step 1 and 2 hardening) is added to every `bazel test` of the three
|
||||
lanes wherever they execute remotely (`BAZEL_SOLE_RUN`: modes `remote`,
|
||||
|
|
@ -1186,8 +1200,7 @@ pr.yml's two mixed-OS matrix jobs, `pr-preflight-platforms` 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
|
||||
macOS jobs; `release.yml`, `nightly.yml` and `ci-measurements.yml` stay on
|
||||
`macos-latest`.
|
||||
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
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ a unit test: use the real boundary when the defect could live there.
|
|||
| Affected-package confidence | `bazel test //path/to/package/... --config=ci` | After the focused test passes; include directly affected neighbors when their contract changed. |
|
||||
| Final gate | `make test` | Once after focused work on Go code is green: the whole test lane, mostly cache hits. |
|
||||
| Another lane's risk | that lane's command from the table above | When the change touches what that lane covers (integration-tagged files, the Dolt server path, embedded Dolt, pure-Go builds). |
|
||||
| Named CI wrapper | `make ci-pr-core`, `make ci-pr-policy`, or `make ci-pr-lint` | Run the wrapper whose risk or surface is affected, or use it to reproduce that CI check. Do not run all three routinely for every edit. |
|
||||
| Named CI wrapper | `make ci-pr-core` or `make ci-pr-lint` | Run the wrapper whose risk or surface is affected, or use it to reproduce that CI check. Do not run all three routinely for every edit. |
|
||||
| Hook shims against real timeout implementations | `nix flake check -L` (or `nix build .#checks.<system>.hook-timeout-backends -L`) | After changing the hook generator in `cmd/bd/hooks.go` (then `make githooks-regen`) or anything under `.githooks/`. Runs the tracked managed sections against GNU coreutils, uutils, busybox and toybox `timeout` — the multicalls also installed as `gtimeout` alone — with and without Perl, under dash, bash and busybox ash. About one deadline of wall time; needs no Go build. |
|
||||
|
||||
Do not replace the focused loop with repeated full-suite runs. Run the final
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ go_library(
|
|||
# this package with a real `go test -c` (integration.SubprocessRunner), which
|
||||
# needs the module's source tree and a module cache no action has. They run
|
||||
# only against a server: skipped under --config=integration
|
||||
# (BEADS_TEST_SKIP=dolt, like nightly.yml's full test), and run by
|
||||
# (BEADS_TEST_SKIP=dolt), and run by
|
||||
# dolt_server_full_test, which hands SubprocessRunner its own test binary
|
||||
# (BEADS_TEST_SUBPROCESS_BINARY) instead.
|
||||
go_test(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
load("@rules_go//go:def.bzl", "go_library", "go_test")
|
||||
load("@rules_shell//shell:sh_test.bzl", "sh_test")
|
||||
load("//tools/bazel:race.bzl", "go_test_race_off")
|
||||
|
||||
go_library(
|
||||
name = "embeddeddolt",
|
||||
|
|
@ -361,6 +362,49 @@ sh_test(
|
|||
tags = ["embedded"],
|
||||
)
|
||||
|
||||
# embeddeddolt_test without the race detector: the input of
|
||||
# embeddeddolt_batch_apply_nonrace_test below.
|
||||
#
|
||||
# Tags:
|
||||
# manual: only that variant's input, never a build target of its own.
|
||||
go_test_race_off(
|
||||
name = "embeddeddolt_race_off",
|
||||
tags = ["manual"],
|
||||
test = ":embeddeddolt_test",
|
||||
)
|
||||
|
||||
# The large embedded batch applies at full size, which every race lane
|
||||
# shrinks or skips (raceEnabled; see large_batch_apply_measure_test.go): the
|
||||
# 1000-item TestBatchApplyContract/BoundsTheItemCount and wall-clock shapes,
|
||||
# the pinned 712-item statement counts, and the 458-issue batch-create
|
||||
# equivalence scenarios. Non-race, BEADS_TEST_EMBEDDED_DOLT=1, the selection
|
||||
# nightly.yml's retired "Embedded Dolt batch-apply suite (non-race)" step ran
|
||||
# with `go test` on a runner. The wall-clock test only logs its timings, so
|
||||
# a shared executor cannot fail it.
|
||||
#
|
||||
# Tags:
|
||||
# embedded: the embedded-Dolt tier; excluded from --config=prcore/ci,
|
||||
# selected by --config=embedded.
|
||||
sh_test(
|
||||
name = "embeddeddolt_batch_apply_nonrace_test",
|
||||
size = "large",
|
||||
# The step's -timeout 20m, with the same -test.timeout=19m deviation as
|
||||
# the conformance variants above, so Go's timeout fires (with a goroutine
|
||||
# dump) before Bazel's 1200s action limit.
|
||||
timeout = "eternal",
|
||||
srcs = ["//tools/bazel:go_test_variant.sh"],
|
||||
args = [
|
||||
"$(rootpath :embeddeddolt_race_off)",
|
||||
"-test.v",
|
||||
"-test.count=1",
|
||||
"-test.timeout=19m",
|
||||
"-test.run=^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded|TestLargeBatchApplyStatementCounts712_Embedded|TestCreateBatchFastPathsMatchPerRowLarge_Embedded)$$",
|
||||
],
|
||||
data = [":embeddeddolt_race_off"],
|
||||
env = {"BEADS_TEST_EMBEDDED_DOLT": "1"},
|
||||
tags = ["embedded"],
|
||||
)
|
||||
|
||||
# --- begin go_srcs (managed by tools/bazel/go_srcs.py; run `make bazel-sync`) ---
|
||||
|
||||
filegroup(
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ func TestCreateBatchFastPathsMatchPerRow_Embedded(t *testing.T) {
|
|||
// TestCreateBatchFastPathsMatchPerRowLarge_Embedded runs the 458-issue
|
||||
// equivalence scenarios. It is skipped under -race, where the in-process
|
||||
// engine's own instrumentation makes each scenario take many minutes;
|
||||
// nightly.yml's "Embedded Dolt batch-apply suite (non-race)" step runs it,
|
||||
// //internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test (non-race) runs it,
|
||||
// and the server backend's full suite (non-race) runs the same scenarios on
|
||||
// every PR that takes that tier.
|
||||
func TestCreateBatchFastPathsMatchPerRowLarge_Embedded(t *testing.T) {
|
||||
skipUnlessEmbeddedDolt(t)
|
||||
if raceEnabled {
|
||||
t.Skip("458-issue equivalence scenarios skipped under -race; nightly.yml's non-race embedded step runs them")
|
||||
t.Skip("458-issue equivalence scenarios skipped under -race; embeddeddolt_batch_apply_nonrace_test runs them")
|
||||
}
|
||||
createbatchequiv.RunLarge(t, openEquivalenceDB)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,12 +222,10 @@ const large712ShapeName = "712 (mol 2x)"
|
|||
// engine's own internal goroutine/lock machinery, not on anything this
|
||||
// test's own logic does, and unlike the wall-clock test this one DOES have a
|
||||
// real pass/fail assertion (the pinned Total() above), so skipping it under
|
||||
// race is a deliberate reduction from per-PR to nightly-only coverage for
|
||||
// this specific regression check — not a weakening of the assertion itself.
|
||||
// nightly.yml's "Embedded Dolt batch-apply suite (non-race)" step (the
|
||||
// nightly embedded non-race lane from #7128) has its -run regex extended
|
||||
// alongside this change to include this test, so the full 12790-statement
|
||||
// pinned baseline still runs, non-race, every night.
|
||||
// race moves this regression check to the non-race embedded variant — not a
|
||||
// weakening of the assertion itself. //internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test
|
||||
// (the Bazel embedded tier) selects this test, so the full 12790-statement
|
||||
// pinned baseline still runs, non-race.
|
||||
func runLargeBatchApplyStatementCountsShape(t *testing.T, shapeName string) {
|
||||
skipUnlessEmbeddedDolt(t)
|
||||
ctx := t.Context()
|
||||
|
|
@ -240,7 +238,7 @@ func runLargeBatchApplyStatementCountsShape(t *testing.T, shapeName string) {
|
|||
matched = true
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if tc.name == large712ShapeName && raceEnabled {
|
||||
t.Skip("712-item shape's statement-count assertion skipped under -race (race-instrumentation overhead on the Dolt engine itself, not test logic); nightly.yml's Embedded Dolt batch-apply suite (non-race) step runs the full pinned assertion nightly instead; see doc comment above")
|
||||
t.Skip("712-item shape's statement-count assertion skipped under -race (race-instrumentation overhead on the Dolt engine itself, not test logic); embeddeddolt_batch_apply_nonrace_test runs the full pinned assertion non-race instead; see doc comment above")
|
||||
}
|
||||
fixture := newPristineEmbeddedDoltFixture(t, tc.db)
|
||||
t.Cleanup(func() { closeEmbeddedDoltStore(t, fixture.store) })
|
||||
|
|
@ -355,8 +353,8 @@ var wallClockShapes = []struct {
|
|||
// own wrapper gets under -race, anywhere in CI, is 150 items; without
|
||||
// -race it still gets the full 1000 in that same subtest. This is a
|
||||
// known, deliberate gap for the race-enabled lane specifically, not an
|
||||
// oversight — closing it needs a dedicated non-race embedded run (see the
|
||||
// nightly workflow step added alongside this comment).
|
||||
// oversight — the dedicated non-race embedded run is
|
||||
// //internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test.
|
||||
func TestLargeBatchApplyWallClock_Embedded(t *testing.T) {
|
||||
skipUnlessEmbeddedDolt(t)
|
||||
ctx := t.Context()
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ the target CI tiers; Make targets are aliases for local discoverability.
|
|||
|
||||
```bash
|
||||
make ci-pr-core
|
||||
make ci-pr-policy
|
||||
make ci-pr-lint
|
||||
make ci-package-mcp
|
||||
make ci-package-npm
|
||||
|
|
@ -38,7 +37,8 @@ The broad Go wrappers also cap package and test parallelism to `4` by default
|
|||
(`GO_TEST_PKG_PARALLEL` and `GO_TEST_PARALLEL`). This avoids turning high-core
|
||||
shared hosts into a different test topology than GitHub Actions.
|
||||
|
||||
`make ci-pr-policy` includes `scripts/check-testing-short.sh`, which enforces
|
||||
`scripts/check-testing-short.sh` (`make check-testing-short`; CI runs it in
|
||||
`//scripts:scripts_test`) enforces
|
||||
that `testing.Short()` is only used for runtime, stress, or large-fixture skips.
|
||||
Use build tags, environment checks, or named wrappers for integration/e2e/API
|
||||
boundaries.
|
||||
|
|
|
|||
|
|
@ -1513,10 +1513,11 @@ func sameTagSet(a, b map[string]bool) bool {
|
|||
}
|
||||
|
||||
// TestBazelIntegrationLaneMatchesMainWorkflow keeps --config=integration in
|
||||
// step with the integration-tagged `go test` it replaced on push to main
|
||||
// (main.yml's former "Main Linux integration" jobs), whose one remaining Go
|
||||
// twin is nightly.yml's Full Test Suite: the same build tags, race,
|
||||
// BEADS_TEST_SKIP=dolt, and none of the variants that run does not use.
|
||||
// step with the integration-tagged `go test` it replaced (main.yml's former
|
||||
// "Main Linux integration" jobs and nightly.yml's retired Full Test Suite,
|
||||
// `go test -race -tags=integration,gms_pure_go ./...` with
|
||||
// BEADS_TEST_SKIP=dolt): the same build tags, race, BEADS_TEST_SKIP=dolt, and
|
||||
// none of the variants that run does not use.
|
||||
// It also requires gazelle to see the same tags (root BUILD.bazel
|
||||
// `gazelle:build_tags`): gazelle drops a file whose build constraint names a
|
||||
// tag it does not know, so without it no BUILD file would list the integration
|
||||
|
|
@ -1525,22 +1526,7 @@ func sameTagSet(a, b map[string]bool) bool {
|
|||
// through `make bazel-sync`, whose staleness bazel.yml already fails on.
|
||||
func TestBazelIntegrationLaneMatchesMainWorkflow(t *testing.T) {
|
||||
root := bazelPolicyRoot(t)
|
||||
nightly := readCIWorkflow(t, "nightly.yml").job(t, "full-test")
|
||||
var want map[string]bool
|
||||
for _, step := range nightly.Steps {
|
||||
if m := regexp.MustCompile(`go test .*-race -tags=(\S+) .*-timeout=30m \./\.\.\.`).FindStringSubmatch(step.Run); m != nil {
|
||||
if want != nil {
|
||||
t.Fatalf("nightly.yml full-test: more than one integration `go test -race -tags=...` step")
|
||||
}
|
||||
want = tagSet(m[1])
|
||||
if step.Env["BEADS_TEST_SKIP"] != "dolt" {
|
||||
t.Fatal("nightly.yml full-test no longer runs with BEADS_TEST_SKIP=dolt; update test:integration")
|
||||
}
|
||||
}
|
||||
}
|
||||
if !want["integration"] {
|
||||
t.Fatalf("nightly.yml full-test: want one `go test -race -tags=...integration... -timeout=30m ./...` step, got tags %v", want)
|
||||
}
|
||||
want := tagSet("integration,gms_pure_go")
|
||||
|
||||
bazelrc := readPolicyFile(t, root, ".bazelrc")
|
||||
lines := map[string]bool{}
|
||||
|
|
@ -1553,7 +1539,7 @@ func TestBazelIntegrationLaneMatchesMainWorkflow(t *testing.T) {
|
|||
}
|
||||
}
|
||||
if !sameTagSet(laneTags, want) {
|
||||
t.Errorf(".bazelrc build:integration tags = %v, want nightly.yml full-test's %v", laneTags, want)
|
||||
t.Errorf(".bazelrc build:integration tags = %v, want %v", laneTags, want)
|
||||
}
|
||||
if err := checkBazelrcIntegrationLane(bazelrc); err != nil {
|
||||
t.Error(err)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
# derived from a client's cwd or environment are meaningless in a long-lived
|
||||
# server and must not leak into the shared contract.
|
||||
#
|
||||
# Runs in scripts/ci/pr-policy.sh and as
|
||||
# //scripts/repochecks:workapi_frontend_boundary_test.
|
||||
# Runs as //scripts/repochecks:workapi_frontend_boundary_test.
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ GO_TEST_PARALLEL="${GO_TEST_PARALLEL:-4}"
|
|||
# just under). No single test is at fault, so the panic names whichever one was
|
||||
# in flight and reads like a hang when it is really the whole package running out
|
||||
# of clock. 30m is what every other -race lane here already gives this same code:
|
||||
# main.yml's macOS test job, ci-measurements.yml, nightly.yml. Splitting or de-slowing cmd/bd is the real fix and belongs on main
|
||||
# main.yml's macOS test job. Splitting or de-slowing cmd/bd is the real fix and belongs on main
|
||||
# — this only stops the clock from being the thing that fails.
|
||||
# BEADS_PR_CORE_GO_TEST_JSON=<file>: same run, `go test -json` output to <file>
|
||||
# (nightly.yml feeds it to tools/bazel/equivalence.py --go-test-json).
|
||||
# (for tools/bazel/equivalence.py --go-test-json, the skip-parity check).
|
||||
go_test() {
|
||||
if [[ -n "${BEADS_PR_CORE_GO_TEST_JSON:-}" ]]; then
|
||||
go test -json "$@" >"$BEADS_PR_CORE_GO_TEST_JSON"
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Required PR repository policy checks.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
# shellcheck source=../.buildflags
|
||||
source "$REPO_ROOT/.buildflags"
|
||||
# shellcheck source=lib/timing.sh
|
||||
source "$REPO_ROOT/scripts/ci/lib/timing.sh"
|
||||
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
tmpdir=""
|
||||
cleanup() {
|
||||
if [[ -n "$tmpdir" ]]; then
|
||||
rm -rf "$tmpdir"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
check_no_beads_jsonl_changes() {
|
||||
local base_ref=""
|
||||
|
||||
if [[ "${CI_SKIP_BEADS_CHANGE_CHECK:-0}" == "1" ]]; then
|
||||
printf 'Skipping .beads/issues.jsonl guard because CI_SKIP_BEADS_CHANGE_CHECK=1\n'
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ -n "${CI_BEADS_DIFF_BASE:-}" ]]; then
|
||||
base_ref="$CI_BEADS_DIFF_BASE"
|
||||
elif [[ -n "${GITHUB_BASE_REF:-}" ]]; then
|
||||
base_ref="origin/${GITHUB_BASE_REF}"
|
||||
elif git rev-parse --verify --quiet origin/main >/dev/null; then
|
||||
base_ref="origin/main"
|
||||
printf 'No PR base ref found; checking .beads/issues.jsonl against origin/main.\n'
|
||||
else
|
||||
printf 'No diff base available; skipping .beads/issues.jsonl guard.\n'
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! git rev-parse --verify --quiet "$base_ref" >/dev/null; then
|
||||
printf 'Diff base %s is unavailable; skipping .beads/issues.jsonl guard.\n' "$base_ref"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if git diff --name-only "$base_ref"...HEAD | grep -q '^\.beads/issues\.jsonl$'; then
|
||||
cat >&2 <<'EOF'
|
||||
This change includes .beads/issues.jsonl.
|
||||
|
||||
That file is the project's issue database and should not be modified in PRs.
|
||||
|
||||
To fix:
|
||||
git checkout origin/main -- .beads/issues.jsonl
|
||||
git commit --amend
|
||||
EOF
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf 'No .beads/issues.jsonl changes detected.\n'
|
||||
}
|
||||
|
||||
build_docs_binary() {
|
||||
tmpdir="$(mktemp -d)"
|
||||
local build
|
||||
build="$(git rev-parse --short HEAD)"
|
||||
|
||||
env CGO_ENABLED=0 go build \
|
||||
-ldflags="-X main.Build=${build}" \
|
||||
-o "$tmpdir/bd" \
|
||||
./cmd/bd
|
||||
}
|
||||
|
||||
ci_time "check build-tag policy" -- ./scripts/check-build-tags.sh
|
||||
ci_time "check workflow build-tag declarations" -- \
|
||||
go run -tags=gms_pure_go ./scripts/checkworkflowtags
|
||||
ci_time "check go install guidance" -- ./scripts/check-go-install-guidance.sh
|
||||
ci_time "check version consistency" -- ./scripts/check-versions.sh
|
||||
ci_time "build bd for docs checks" -- build_docs_binary
|
||||
ci_time "check doc flags" -- ./scripts/check-doc-flags.sh "$tmpdir/bd"
|
||||
ci_time "check doc freshness" -- ./scripts/check-doc-freshness.sh
|
||||
ci_time "check testing.Short boundaries" -- ./scripts/check-testing-short.sh
|
||||
ci_time "check workapi frontend boundary" -- ./scripts/check-workapi-frontend-boundary.sh
|
||||
ci_time "check no .beads/issues.jsonl changes" -- check_no_beads_jsonl_changes
|
||||
# The OpenAPI drift gate belongs to a REQUIRED PR job. The Main workflow is
|
||||
# perpetually concurrency-cancelled, so a gate that only ran there would be
|
||||
# unenforced in practice.
|
||||
ci_time "check openapi spec gate" -- make api-check
|
||||
|
|
@ -6,9 +6,6 @@
|
|||
# Dolt/test-env setup required).
|
||||
#
|
||||
# Shared by every non-race seeder so they can never drift apart (F7b spec 4.2):
|
||||
# - main.yml's build-artifacts (ubuntu-latest / fork-PR path non-race save)
|
||||
# - main.yml's blacksmith-go-build-cache (Blacksmith / same-repo-PR path
|
||||
# non-race save)
|
||||
# - main.yml's test-windows (Windows non-race save)
|
||||
# - main.yml's blacksmith-macos-go-build-cache (macOS non-race save: its
|
||||
# github leg the fork/Dependabot path of pr.yml's macOS legs, its
|
||||
|
|
|
|||
|
|
@ -66,14 +66,11 @@ func TestBlacksmithReachablePRJobsDisableDefaultCachingActions(t *testing.T) {
|
|||
}
|
||||
|
||||
// blacksmithSaverJobs are main.yml's push-to-main-only jobs that seed a
|
||||
// Blacksmith-selection GOCACHE/vet-cache a same-repo PR or merge_group job
|
||||
// above restores from. F7c's blacksmith-setup-go-cache is pinned by its own
|
||||
// TestBlacksmithSeederGuardedAgainstPullRequest in ci_f7c_advisory_test.go;
|
||||
// these are F7b's remaining savers (B2), the macOS saver, and the Blacksmith macOS
|
||||
// Blacksmith-selection GOCACHE a same-repo PR or merge_group job restores
|
||||
// from: F7b's Windows saver (B2), the macOS saver, and the Blacksmith macOS
|
||||
// `test` job (which saves its own race cache).
|
||||
var blacksmithSaverJobs = []string{
|
||||
"blacksmith-go-build-cache", "test-windows",
|
||||
"blacksmith-macos-go-build-cache", "test",
|
||||
"test-windows", "blacksmith-macos-go-build-cache", "test",
|
||||
}
|
||||
|
||||
// TestBlacksmithSaverJobsGuardedAgainstPullRequest is the B2 fix's pin: each
|
||||
|
|
@ -135,7 +132,7 @@ func TestBlacksmithSaverJobsGuardedAgainstPullRequest(t *testing.T) {
|
|||
}
|
||||
|
||||
// TestBlacksmithSaverCacheKeysAreNotPerCommit is the S7 fix's pin: each of
|
||||
// blacksmith-go-build-cache's and test-windows' Go-cache
|
||||
// main.yml's Blacksmith savers' Go-cache
|
||||
// restore/save key pairs is bounded by go.sum content plus a UTC calendar day
|
||||
// (via that job's own "Compute cache date" step, id: cache-date), not by
|
||||
// github.sha, so an ordinary day of push traffic to main cannot mint a new
|
||||
|
|
@ -153,11 +150,6 @@ func TestBlacksmithSaverCacheKeysAreNotPerCommit(t *testing.T) {
|
|||
saveStepNames []string
|
||||
}
|
||||
cases := []saverSteps{
|
||||
{
|
||||
job: "blacksmith-go-build-cache",
|
||||
restoreStepNames: []string{"Restore race Go build cache", "Restore non-race Go build cache"},
|
||||
saveStepNames: []string{"Save race Go build cache", "Save non-race Go build cache"},
|
||||
},
|
||||
{
|
||||
job: "test-windows",
|
||||
restoreStepNames: []string{"Restore non-race Go build cache"},
|
||||
|
|
@ -203,53 +195,20 @@ 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
|
||||
// Linux and macOS Go build cache savers)
|
||||
// "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),
|
||||
// and blacksmith-go-build-cache's `flavor` matrix must keep both `race` and
|
||||
// `non-race` -- dropping either silently loses a cache seed or a whole
|
||||
// coverage flavor 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).
|
||||
// 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).
|
||||
func TestBlacksmithSaverVenueAndFlavorMatricesAreComplete(t *testing.T) {
|
||||
workflow := readCIWorkflow(t, "main.yml")
|
||||
for _, jobName := range []string{"test-windows", "blacksmith-go-build-cache", "blacksmith-macos-go-build-cache"} {
|
||||
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)
|
||||
}
|
||||
}
|
||||
job := workflow.job(t, "blacksmith-go-build-cache")
|
||||
if got := job.Strategy.Matrix.Flavor; !equalStrings(got, []string{"race", "non-race"}) {
|
||||
t.Errorf("main.yml's blacksmith-go-build-cache matrix.flavor = %v, want [race non-race]", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlacksmithGoBuildCacheRaceLegActuallyUsesRace re-pins mutation M6: the
|
||||
// race flavor's GOCACHE-warming step must actually pass `-race` to `go test`,
|
||||
// or the "race" leg's saved cache would silently warm a non-race build
|
||||
// instead and every race-flavor restore downstream would cache-miss (or
|
||||
// worse, hit a non-race-compiled cache under the race key).
|
||||
func TestBlacksmithGoBuildCacheRaceLegActuallyUsesRace(t *testing.T) {
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-go-build-cache")
|
||||
step := job.step(t, "Warm race GOCACHE")
|
||||
if !strings.Contains(step.Run, "-race") {
|
||||
t.Errorf("blacksmith-go-build-cache's race-leg warm step run = %q, want it to pass -race", step.Run)
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlacksmithGoBuildCacheNonRaceLegWarmsPreflightPackages re-pins mutation
|
||||
// M7: the non-race flavor's warm step must run the shared
|
||||
// warm-non-race-cache.sh, so the same-repo-PR seed can never silently stop
|
||||
// covering what pr-preflight-platforms' and check-doc-freshness-platforms'
|
||||
// ubuntu legs compile.
|
||||
func TestBlacksmithGoBuildCacheNonRaceLegWarmsPreflightPackages(t *testing.T) {
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-go-build-cache")
|
||||
step := job.step(t, "Warm non-race GOCACHE (preflight/doc-freshness)")
|
||||
if step.Run != "bash scripts/ci/warm-non-race-cache.sh" {
|
||||
t.Errorf("blacksmith-go-build-cache's non-race-leg warm step run = %q, want bash scripts/ci/warm-non-race-cache.sh", step.Run)
|
||||
}
|
||||
}
|
||||
|
||||
// TestWarmNonRaceCacheScriptCompilesGitattributespolicy re-pins mutation M15:
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package scripts_test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
|
@ -12,8 +14,7 @@ import (
|
|||
// F7c (spec-f7.md §2.4, §4.3): advisory workflows moved onto a same-repo-PR
|
||||
// Blacksmith runner. These tests pin the invariants that make that safe: no
|
||||
// advisory job can read a secret just because it now names a Blacksmith
|
||||
// label, and the Blacksmith-side setup-go seed in main.yml actually exists
|
||||
// for the jobs that depend on it. The path-filtered upgrade suites F7c folded
|
||||
// label, and no Blacksmith-reachable job saves a cache. The path-filtered upgrade suites F7c folded
|
||||
// (Migration Test Harness, Cross-Version Smoke) and their filter and fold
|
||||
// checks are gone: those suites run under Bazel (//tests/migration,
|
||||
// //tests/upgrade_smoke).
|
||||
|
|
@ -110,14 +111,6 @@ func TestNixBuildDropsPullRequestTriggerNotPushOrDispatch(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func mapKeys[K comparable, V any](m map[K]V) []K {
|
||||
keys := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
return keys
|
||||
}
|
||||
|
||||
func sortedCopy(items []string) []string {
|
||||
out := append([]string(nil), items...)
|
||||
sort.Strings(out)
|
||||
|
|
@ -238,165 +231,36 @@ func TestF7cAdvisorySameRepoBlacksmithExpressionSemantics(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// --- Blacksmith cache-visibility precondition (spec-f7.md §2.2 Group B) ---
|
||||
// --- Retired setup-go seeder (ga-96smfk.58) --------------------------------
|
||||
|
||||
// blacksmithSetupGoCacheConsumers is every advisory job that restores the
|
||||
// self-defined `blacksmith-sg-v1-` setup-go cache main.yml's
|
||||
// blacksmith-setup-go-cache job seeds (B2, F7c implementation report).
|
||||
var blacksmithSetupGoCacheConsumers = map[string][]string{}
|
||||
|
||||
// blacksmithSetupGoCacheKeyNamespace is the self-defined cache key prefix
|
||||
// (not setup-go's own implicit key) that the seeder and every consumer share,
|
||||
// so the "no save in a consumer job" checks below can scope to exactly this
|
||||
// cache without also flagging an unrelated, legitimately-caching step in
|
||||
// another namespace.
|
||||
const blacksmithSetupGoCacheKeyNamespace = "blacksmith-sg-v1-"
|
||||
|
||||
// TestBlacksmithSetupGoSeedExistsForAdvisoryConsumers pins that main.yml's
|
||||
// blacksmith-setup-go-cache job exists, restores whatever is already cached,
|
||||
// unconditionally re-runs every warm-up command (not gated on a cache hit,
|
||||
// since a stale or partial restore must still self-heal), and then always
|
||||
// saves - the "always warm, always save" design B2 requires so this job can
|
||||
// safely be the ONLY writer of the Blacksmith-side setup-go cache every
|
||||
// advisory consumer below reads from.
|
||||
func TestBlacksmithSetupGoSeedExistsForAdvisoryConsumers(t *testing.T) {
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-setup-go-cache")
|
||||
|
||||
if !strings.Contains(job.RunsOn, "blacksmith-") {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache runs-on = %q, want a Blacksmith label", job.RunsOn)
|
||||
// TestNoBlacksmithSetupGoCacheNamespace: main.yml's blacksmith-setup-go-cache
|
||||
// seeder warmed the self-keyed blacksmith-sg-v1- cache for the F7c advisory
|
||||
// workflows (regression, migration-test, cross-version-smoke,
|
||||
// proxied-local-smoke). All four are Bazel targets now, so nothing restores
|
||||
// that namespace; a workflow naming it again would be a writer or reader with
|
||||
// no counterpart.
|
||||
func TestNoBlacksmithSetupGoCacheNamespace(t *testing.T) {
|
||||
root := sourceRepoRoot(t)
|
||||
entries, err := os.ReadDir(filepath.Join(root, ".github", "workflows"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if job.TimeoutMinutes == 0 {
|
||||
t.Error("main.yml's blacksmith-setup-go-cache has no timeout-minutes")
|
||||
}
|
||||
|
||||
setupGoIndex := -1
|
||||
for i, step := range job.Steps {
|
||||
if actionFamily(step.Uses) != setupGoActionFamily {
|
||||
for _, entry := range entries {
|
||||
if !strings.HasSuffix(entry.Name(), ".yml") {
|
||||
continue
|
||||
}
|
||||
setupGoIndex = i
|
||||
if step.ID != "setup-go" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache setup-go step has id %q, want \"setup-go\"", step.ID)
|
||||
}
|
||||
// The seeder disables setup-go's OWN implicit cache (which would try
|
||||
// to use a GitHub-hosted cache entry Blacksmith can't see) in favor of
|
||||
// the explicit, self-keyed restore/save steps below.
|
||||
if step.With["cache"] != "false" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache setup-go cache = %q, want \"false\" (this job manages its own cache explicitly)", step.With["cache"])
|
||||
}
|
||||
if step.With["go-version-file"] != "go.mod" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache setup-go go-version-file = %q, want go.mod", step.With["go-version-file"])
|
||||
if strings.Contains(readPolicyFile(t, root, ".github/workflows/"+entry.Name()), "blacksmith-sg-v1-") {
|
||||
t.Errorf("%s names the retired blacksmith-sg-v1- setup-go cache namespace", entry.Name())
|
||||
}
|
||||
}
|
||||
if setupGoIndex < 0 {
|
||||
t.Fatal("main.yml's blacksmith-setup-go-cache has no actions/setup-go step")
|
||||
}
|
||||
|
||||
restore := job.step(t, "Restore Blacksmith setup-go cache")
|
||||
if actionFamily(restore.Uses) != cacheRestoreActionFamily {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Restore step uses %q, want family %q", restore.Uses, cacheRestoreActionFamily)
|
||||
}
|
||||
if restore.If != "" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Restore step has if=%q, want unconditional (push-to-main only job, always trusted)", restore.If)
|
||||
}
|
||||
if !strings.HasPrefix(restore.With["key"], blacksmithSetupGoCacheKeyNamespace) {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Restore key = %q, want it to start with %q", restore.With["key"], blacksmithSetupGoCacheKeyNamespace)
|
||||
}
|
||||
|
||||
wantWarmups := []string{
|
||||
"make build",
|
||||
}
|
||||
for _, want := range wantWarmups {
|
||||
found := false
|
||||
for i, step := range job.Steps[setupGoIndex+1:] {
|
||||
if strings.TrimSpace(step.Run) != want {
|
||||
continue
|
||||
}
|
||||
found = true
|
||||
// Unconditional, not gated on a cache hit (F7c review fix B2):
|
||||
// the whole point of this job is to keep the cache warm, so it
|
||||
// must always repopulate GOCACHE/GOMODCACHE.
|
||||
if step.If != "" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache step %q (index %d) has if=%q, want it unconditional",
|
||||
want, setupGoIndex+1+i, step.If)
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache has no step that runs exactly %q", want)
|
||||
}
|
||||
}
|
||||
|
||||
save := job.step(t, "Save Blacksmith setup-go cache")
|
||||
if actionFamily(save.Uses) != cacheSaveActionFamily {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Save step uses %q, want family %q", save.Uses, cacheSaveActionFamily)
|
||||
}
|
||||
if save.If != "always()" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Save step has if=%q, want \"always()\" (save even if a warm-up step above failed)", save.If)
|
||||
}
|
||||
if !strings.HasPrefix(save.With["key"], blacksmithSetupGoCacheKeyNamespace) {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Save key = %q, want it to start with %q", save.With["key"], blacksmithSetupGoCacheKeyNamespace)
|
||||
}
|
||||
if save.With["key"] != restore.With["key"] {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Save key = %q, Restore key = %q; the seeder must save under the exact key it restores from", save.With["key"], restore.With["key"])
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlacksmithSeederGuardedAgainstPullRequest pins main.yml's
|
||||
// blacksmith-setup-go-cache job `if:` byte-for-byte (F7c review fix S2): this
|
||||
// job is the ONLY writer every advisory consumer's blacksmith-sg-v1- restore
|
||||
// trusts, so it must stay push-to-main-only even in the counterfactual where
|
||||
// main.yml's `on:` trigger set grows a pull_request (or merge_group) entry
|
||||
// someday. A guard that only checks github.repository (the pre-fix state)
|
||||
// would not catch that: every same-repo PR also satisfies
|
||||
// github.repository == 'gastownhall/beads'. The real regression this closes
|
||||
// is evaluated below via evalGHExpr, not just a string match, so the job is
|
||||
// also proven actually unreachable under a same-repo pull_request event.
|
||||
func TestBlacksmithSeederGuardedAgainstPullRequest(t *testing.T) {
|
||||
const wantIf = "github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'gastownhall/beads'"
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-setup-go-cache")
|
||||
if job.If != wantIf {
|
||||
t.Fatalf("main.yml's blacksmith-setup-go-cache if=%q, want exactly %q", job.If, wantIf)
|
||||
}
|
||||
|
||||
const ownRepo = "gastownhall/beads"
|
||||
cases := []struct {
|
||||
name string
|
||||
ctx map[string]string
|
||||
want bool
|
||||
}{
|
||||
{"actual push to main", map[string]string{
|
||||
"github.event_name": "push", "github.ref": "refs/heads/main", "github.repository": ownRepo,
|
||||
}, true},
|
||||
{"same-repo pull_request stays excluded", map[string]string{
|
||||
"github.event_name": "pull_request", "github.ref": "refs/pull/1/merge", "github.repository": ownRepo,
|
||||
"github.event.pull_request.head.repo.full_name": ownRepo,
|
||||
}, false},
|
||||
{"merge_group stays excluded", map[string]string{
|
||||
"github.event_name": "merge_group", "github.ref": "refs/heads/gh-readonly-queue/main/pr-1", "github.repository": ownRepo,
|
||||
}, false},
|
||||
{"push to a non-main branch stays excluded", map[string]string{
|
||||
"github.event_name": "push", "github.ref": "refs/heads/not-main", "github.repository": ownRepo,
|
||||
}, false},
|
||||
{"push from a fork stays excluded", map[string]string{
|
||||
"github.event_name": "push", "github.ref": "refs/heads/main", "github.repository": "someone-else/beads",
|
||||
}, false},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.name, func(t *testing.T) {
|
||||
got, err := evalGHExpr(job.If, c.ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("evalGHExpr(%q): %v", job.If, err)
|
||||
}
|
||||
if ghTruthy(got) != c.want {
|
||||
t.Errorf("evalGHExpr(%q) under %+v = %#v, want truthy=%v", job.If, c.ctx, got, c.want)
|
||||
}
|
||||
})
|
||||
if _, found := readCIWorkflow(t, "main.yml").Jobs["blacksmith-setup-go-cache"]; found {
|
||||
t.Error("main.yml has a blacksmith-setup-go-cache job again; it seeds a cache nothing restores")
|
||||
}
|
||||
}
|
||||
|
||||
// TestMainWorkflowHasNoSameRepoPRReachableTrigger is the direct half of F7c
|
||||
// review fix S2's "pin the seeder's trust boundary" ask: belt-and-suspenders
|
||||
// alongside the job-level guard in TestBlacksmithSeederGuardedAgainstPullRequest.
|
||||
// review fix S2's "pin the savers' trust boundary" ask: belt-and-suspenders
|
||||
// alongside the job-level guard in TestBlacksmithSaverJobsGuardedAgainstPullRequest.
|
||||
// The guard defuses the vulnerability even if one of these triggers is added
|
||||
// to main.yml's `on:` block, but this test catches the trigger addition
|
||||
// itself at the workflow-trust-surface level, so a future edit here gets
|
||||
|
|
@ -414,7 +278,7 @@ func TestMainWorkflowHasNoSameRepoPRReachableTrigger(t *testing.T) {
|
|||
}
|
||||
for _, forbidden := range []string{"pull_request", "pull_request_target", "merge_group", "workflow_run"} {
|
||||
if _, ok := parsed.On[forbidden]; ok {
|
||||
t.Errorf("main.yml's on: has a %q trigger; its blacksmith-setup-go-cache seeder is the ONLY writer every advisory consumer trusts, so this workflow must never become reachable from a same-repo PR/merge-queue event even with the job-level guard as a second layer", forbidden)
|
||||
t.Errorf("main.yml's on: has a %q trigger; its push-to-main cache savers are the only writers PR jobs trust, so this workflow must never become reachable from a same-repo PR/merge-queue event even with the job-level guard as a second layer", forbidden)
|
||||
}
|
||||
}
|
||||
if _, ok := parsed.On["push"]; !ok {
|
||||
|
|
@ -422,135 +286,6 @@ func TestMainWorkflowHasNoSameRepoPRReachableTrigger(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestAdvisoryBlacksmithConsumersAreCacheRestoreOnly replaces the pre-review
|
||||
// TestAdvisoryBlacksmithConsumersKeepImplicitSetupGoCache (F7c review fix
|
||||
// B2): each consumer must disable setup-go's own implicit cache on a
|
||||
// self-hosted (Blacksmith) runner and restore-only from the self-keyed
|
||||
// `blacksmith-sg-v1-` namespace, with NO save step in that namespace - only
|
||||
// main.yml's seeder may ever write it, so a same-repo PR run can read the
|
||||
// cache but never poison what another PR or main's seeder reads back. The
|
||||
// "no save" check is scoped to the blacksmith-sg-v1- key namespace
|
||||
// specifically (not "no actions/cache/save in this job at all"): a cache in
|
||||
// another namespace is the general sweep's concern below
|
||||
// (TestBlacksmithReachableAdvisoryJobsNeverSaveACache), not an exemption
|
||||
// from this one.
|
||||
func TestAdvisoryBlacksmithConsumersAreCacheRestoreOnly(t *testing.T) {
|
||||
for file, jobNames := range blacksmithSetupGoCacheConsumers {
|
||||
workflow := readCIWorkflow(t, file)
|
||||
for _, jobName := range jobNames {
|
||||
t.Run(file+"/"+jobName, func(t *testing.T) {
|
||||
job := workflow.job(t, jobName)
|
||||
|
||||
var sawSetupGo, sawRestore bool
|
||||
for _, step := range job.Steps {
|
||||
switch actionFamily(step.Uses) {
|
||||
case setupGoActionFamily:
|
||||
sawSetupGo = true
|
||||
// F7c review fix N1: fail-closed. Pinned to the
|
||||
// "== 'github-hosted'" form (not "!= 'self-hosted'")
|
||||
// so an empty/unknown runner.environment value keeps
|
||||
// caching OFF instead of turning it on.
|
||||
if step.With["cache"] != "${{ runner.environment == 'github-hosted' }}" {
|
||||
t.Errorf("%s job %s setup-go cache = %q, want it disabled on self-hosted runners (fail-closed)", file, jobName, step.With["cache"])
|
||||
}
|
||||
case cacheRestoreActionFamily:
|
||||
if strings.HasPrefix(step.With["key"], blacksmithSetupGoCacheKeyNamespace) {
|
||||
sawRestore = true
|
||||
if !strings.Contains(step.If, "runner.environment == 'self-hosted'") {
|
||||
t.Errorf("%s job %s setup-go cache Restore step has if=%q, want it gated on runner.environment == 'self-hosted'", file, jobName, step.If)
|
||||
}
|
||||
}
|
||||
case cacheSaveActionFamily, cacheMonolithicActionFamily:
|
||||
if strings.HasPrefix(step.With["key"], blacksmithSetupGoCacheKeyNamespace) {
|
||||
t.Errorf("%s job %s has a %s step keyed in the blacksmith-sg-v1- namespace (%q); only main.yml's seeder may save this cache", file, jobName, actionFamily(step.Uses), step.With["key"])
|
||||
}
|
||||
}
|
||||
}
|
||||
if !sawSetupGo {
|
||||
t.Errorf("%s job %s has no actions/setup-go step", file, jobName)
|
||||
}
|
||||
if !sawRestore {
|
||||
t.Errorf("%s job %s has no blacksmith-sg-v1- cache restore step", file, jobName)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlacksmithSeederCacheKeyIsNotPerCommit pins F7c review fix S5: the
|
||||
// seeder's save/restore key suffix must be a UTC calendar day
|
||||
// (steps.cache-date.outputs.today), not github.sha. Keying per commit meant
|
||||
// every single push to main - whether or not go.sum changed - wrote a new
|
||||
// multi-GB ~/go/pkg/mod + ~/.cache/go-build entry under this namespace; on a
|
||||
// cache store with LRU eviction (Blacksmith) that churn risked evicting
|
||||
// F7a's own beads-go-mod-v2-*/beads-go-build-v2-* entries. Keying per day
|
||||
// instead caps writes to at most once per calendar day while still picking
|
||||
// up a go.sum change on the very next push.
|
||||
func TestBlacksmithSeederCacheKeyIsNotPerCommit(t *testing.T) {
|
||||
job := readCIWorkflow(t, "main.yml").job(t, "blacksmith-setup-go-cache")
|
||||
|
||||
dateStep := job.step(t, "Compute cache date")
|
||||
if dateStep.ID != "cache-date" {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Compute cache date step has id %q, want \"cache-date\"", dateStep.ID)
|
||||
}
|
||||
if !strings.Contains(dateStep.Run, "date -u") {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache Compute cache date step run = %q, want it to compute a UTC date", dateStep.Run)
|
||||
}
|
||||
|
||||
restore := job.step(t, "Restore Blacksmith setup-go cache")
|
||||
save := job.step(t, "Save Blacksmith setup-go cache")
|
||||
for name, step := range map[string]ciWorkflowStep{"Restore": restore, "Save": save} {
|
||||
key := step.With["key"]
|
||||
if strings.Contains(key, "github.sha") {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache %s step key = %q, must not key per-commit (github.sha) - see F7c review fix S5", name, key)
|
||||
}
|
||||
if !strings.Contains(key, "steps.cache-date.outputs.today") {
|
||||
t.Errorf("main.yml's blacksmith-setup-go-cache %s step key = %q, want it keyed by steps.cache-date.outputs.today", name, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers pins that every
|
||||
// consumer's restore key/restore-keys are textually identical to main.yml
|
||||
// seeder's save key (F7c review fix B2, closes a seeder/consumer key-mismatch
|
||||
// mutation): if a consumer's key format ever drifted from the seeder's (a
|
||||
// different hash segment order, a missing runner.arch, etc.) the seeder would
|
||||
// keep writing entries no consumer could ever restore, silently degrading
|
||||
// every advisory Blacksmith job back to a cold cache.
|
||||
func TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers(t *testing.T) {
|
||||
seeder := readCIWorkflow(t, "main.yml").job(t, "blacksmith-setup-go-cache")
|
||||
seederSave := seeder.step(t, "Save Blacksmith setup-go cache")
|
||||
seederKey := seederSave.With["key"]
|
||||
if seederKey == "" {
|
||||
t.Fatal("main.yml's blacksmith-setup-go-cache Save step has no key")
|
||||
}
|
||||
|
||||
for file, jobNames := range blacksmithSetupGoCacheConsumers {
|
||||
workflow := readCIWorkflow(t, file)
|
||||
for _, jobName := range jobNames {
|
||||
job := workflow.job(t, jobName)
|
||||
var restore *ciWorkflowStep
|
||||
for i := range job.Steps {
|
||||
step := &job.Steps[i]
|
||||
if actionFamily(step.Uses) == cacheRestoreActionFamily && strings.HasPrefix(step.With["key"], blacksmithSetupGoCacheKeyNamespace) {
|
||||
restore = step
|
||||
break
|
||||
}
|
||||
}
|
||||
if restore == nil {
|
||||
t.Errorf("%s job %s has no blacksmith-sg-v1- restore step", file, jobName)
|
||||
continue
|
||||
}
|
||||
if restore.With["key"] != seederKey {
|
||||
t.Errorf("%s job %s restore key = %q, want it identical to the seeder's save key %q", file, jobName, restore.With["key"], seederKey)
|
||||
}
|
||||
if !strings.Contains(restore.With["restore-keys"], strings.TrimSuffix(seederKey, "${{ steps.cache-date.outputs.today }}")) {
|
||||
t.Errorf("%s job %s restore-keys %q does not contain the seeder's key prefix (without the commit-specific suffix)", file, jobName, restore.With["restore-keys"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- General sweep: no Blacksmith-reachable advisory job may save a cache --
|
||||
|
||||
// generalCacheSweepWorkflows is every F7c advisory workflow plus main.yml
|
||||
|
|
@ -565,7 +300,7 @@ func TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers(t *testing.T) {
|
|||
// machinery. This list is every workflow this F7c round can actually edit
|
||||
// plus the one workflow (main.yml) whose seeder job this round added a new
|
||||
// guard to.
|
||||
var generalCacheSweepWorkflows = append(mapKeys(blacksmithSetupGoCacheConsumers), "main.yml")
|
||||
var generalCacheSweepWorkflows = []string{"main.yml"}
|
||||
|
||||
// blacksmithTrustContexts are the two event shapes a same-repo Blacksmith
|
||||
// `runs-on` ternary can route onto a `blacksmith-*` label for (F7c review fix
|
||||
|
|
|
|||
|
|
@ -23,41 +23,21 @@ func TestCIWorkflowArtifactOwnership(t *testing.T) {
|
|||
t.Run(workflowName, func(t *testing.T) {
|
||||
workflow := readCIWorkflow(t, workflowName)
|
||||
|
||||
for _, forbidden := range []string{
|
||||
"golangci-lint",
|
||||
"make ci-pr-policy",
|
||||
"make ci-pr-lint",
|
||||
} {
|
||||
for _, step := range workflow.Jobs["build-artifacts"].Steps {
|
||||
if strings.Contains(step.Run, forbidden) {
|
||||
t.Errorf("build-artifacts runs %q in step %q", forbidden, step.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pr.yml's PR Policy job is retired: its checks are Bazel tests
|
||||
// (TestPRPolicyChecksRunAsBazelTargets). main.yml keeps its own
|
||||
// copy until main.yml's legacy jobs go.
|
||||
if workflowName == "pr.yml" {
|
||||
if _, found := workflow.Jobs["pr-policy-wrapper"]; found {
|
||||
t.Errorf("pr.yml has a pr-policy-wrapper job; its checks run as Bazel tests")
|
||||
}
|
||||
for name, job := range workflow.Jobs {
|
||||
for _, step := range job.Steps {
|
||||
if strings.Contains(step.Run, "make ci-pr-policy") {
|
||||
t.Errorf("pr.yml job %s step %q runs make ci-pr-policy; its checks run as Bazel tests", name, step.Name)
|
||||
// The PR Policy and lint wrappers are retired: their checks are
|
||||
// Bazel tests (TestPRPolicyChecksRunAsBazelTargets) and nogo
|
||||
// (TestLintAndVetRunAsNogo), so no job may run them.
|
||||
for name, job := range workflow.Jobs {
|
||||
for _, step := range job.Steps {
|
||||
for _, forbidden := range []string{"golangci-lint", "make ci-pr-policy", "make ci-pr-lint"} {
|
||||
if strings.Contains(step.Run, forbidden) {
|
||||
t.Errorf("%s job %s step %q runs %q; its checks run as Bazel tests", workflowName, name, step.Name, forbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assertJobRunsExactly(t, workflow.job(t, "pr-policy-wrapper"), "make ci-pr-policy")
|
||||
}
|
||||
// Lint and vet are nogo inside Bazel (TestLintAndVetRunAsNogo):
|
||||
// no workflow job runs golangci-lint or the retired lint and vet
|
||||
// jobs.
|
||||
for _, retired := range []string{"pr-lint-wrapper", "go-vet-cache", "scripts-go-checks", "lint"} {
|
||||
for _, retired := range []string{"pr-policy-wrapper", "pr-lint-wrapper", "go-vet-cache", "scripts-go-checks", "lint"} {
|
||||
if _, found := workflow.Jobs[retired]; found {
|
||||
t.Errorf("%s has a %q job; lint and vet run as nogo in bazel.yml's test lane", workflowName, retired)
|
||||
t.Errorf("%s has a %q job; its checks run in bazel.yml's test lane", workflowName, retired)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -708,33 +688,61 @@ func TestMacOSTestJobsReuseWorkspaceBDBinary(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite pins the nightly
|
||||
// full-test job's embedded-Dolt step: it must set BEADS_TEST_EMBEDDED_DOLT=1
|
||||
// (the gate skipUnlessEmbeddedDolt checks) and run exactly
|
||||
// TestBatchApplyContract, TestLargeBatchApplyWallClock_Embedded, (F1)
|
||||
// TestLargeBatchApplyStatementCounts712_Embedded and the 458-issue
|
||||
// batch-create equivalence scenarios
|
||||
// (TestCreateBatchFastPathsMatchPerRowLarge_Embedded), non-race, after the main
|
||||
// "Full Test Suite" step. That main step never sets BEADS_TEST_EMBEDDED_DOLT,
|
||||
// so without this step the nightly job would never exercise a real
|
||||
// 1000-item apply through the embedded backend, nor the 712-item shape's
|
||||
// pinned statement-count baseline, at all — see the step's own comment in
|
||||
// nightly.yml for why non-race and why these tests specifically.
|
||||
func TestNightlyFullTestRunsEmbeddedDoltBatchApplySuite(t *testing.T) {
|
||||
job := readCIWorkflow(t, "nightly.yml").job(t, "full-test")
|
||||
const stepName = "Embedded Dolt batch-apply suite (non-race)"
|
||||
const wantRun = "go test -tags gms_pure_go -timeout 20m -run '^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded|TestLargeBatchApplyStatementCounts712_Embedded|TestCreateBatchFastPathsMatchPerRowLarge_Embedded)$' ./internal/storage/embeddeddolt"
|
||||
assertStepRunsExactly(t, job, stepName, wantRun)
|
||||
assertStepEnvValue(t, job, stepName, "BEADS_TEST_EMBEDDED_DOLT", "1")
|
||||
assertStepsBefore(t, job, []string{"Full Test Suite (including integration tests)"}, []string{stepName})
|
||||
if strings.Contains(wantRun, "-race") {
|
||||
t.Errorf("embedded-dolt nightly step run = %q, must stay non-race (race dramatically inflates this backend's own wall-clock)", wantRun)
|
||||
// TestEmbeddedDoltBatchApplySuiteRunsNonRaceUnderBazel pins the non-race
|
||||
// embedded batch-apply variant that replaced nightly.yml's retired go test
|
||||
// step: every race lane shrinks or skips the 1000-item apply, the 712-item
|
||||
// statement-count baseline and the 458-issue batch-create equivalence
|
||||
// scenarios (raceEnabled), so this target is their only full-size run. It
|
||||
// must stay non-race (go_test_race_off over embeddeddolt_test; race inflates
|
||||
// the embedded engine's own wall-clock), set BEADS_TEST_EMBEDDED_DOLT=1 (the
|
||||
// gate skipUnlessEmbeddedDolt checks), select exactly these tests, and stay in
|
||||
// the embedded tier (tag embedded), which bazel.yml runs on every PR, merge
|
||||
// group, push to main and night.
|
||||
func TestEmbeddedDoltBatchApplySuiteRunsNonRaceUnderBazel(t *testing.T) {
|
||||
build := readPolicyFile(t, sourceRepoRoot(t), "internal/storage/embeddeddolt/BUILD.bazel")
|
||||
rules := map[string]string{}
|
||||
for _, r := range bazelTopRules(build) {
|
||||
if m := regexp.MustCompile(`(?m)^ name = "([^"]+)",$`).FindStringSubmatch(r); m != nil {
|
||||
rules[m[1]] = r
|
||||
}
|
||||
}
|
||||
// N4 (F1 review): this step must still run (and report) even if an
|
||||
// earlier nightly step failed, and must carry its own explicit Go
|
||||
// timeout independent of the job-level timeout-minutes.
|
||||
if got := job.step(t, stepName).If; got != "${{ !cancelled() }}" {
|
||||
t.Errorf("embedded-dolt nightly step if = %q, want ${{ !cancelled() }}", got)
|
||||
raceOff := rules["embeddeddolt_race_off"]
|
||||
if !strings.HasPrefix(raceOff, "go_test_race_off(") || !strings.Contains(raceOff, `test = ":embeddeddolt_test",`) {
|
||||
t.Fatalf("embeddeddolt_race_off = %q, want go_test_race_off over :embeddeddolt_test", raceOff)
|
||||
}
|
||||
suite := rules["embeddeddolt_batch_apply_nonrace_test"]
|
||||
for _, want := range []string{
|
||||
`"$(rootpath :embeddeddolt_race_off)",`,
|
||||
`"-test.run=^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded|TestLargeBatchApplyStatementCounts712_Embedded|TestCreateBatchFastPathsMatchPerRowLarge_Embedded)$$",`,
|
||||
`env = {"BEADS_TEST_EMBEDDED_DOLT": "1"},`,
|
||||
`tags = ["embedded"],`,
|
||||
} {
|
||||
if !strings.Contains(suite, want) {
|
||||
t.Errorf("embeddeddolt_batch_apply_nonrace_test lacks %s:\n%s", want, suite)
|
||||
}
|
||||
}
|
||||
if strings.Contains(suite, ":embeddeddolt_test)") {
|
||||
t.Errorf("embeddeddolt_batch_apply_nonrace_test runs the race-configured :embeddeddolt_test; want :embeddeddolt_race_off")
|
||||
}
|
||||
}
|
||||
|
||||
// TestNightlyRunsNoGoTestOnARunner: nightly.yml's only test run is the
|
||||
// fresh Bazel call on rbe-west (ga-96smfk.22); its retired full-test,
|
||||
// bazel-go-test-json and measure jobs ran go test on GitHub runners.
|
||||
func TestNightlyRunsNoGoTestOnARunner(t *testing.T) {
|
||||
nightly := readCIWorkflow(t, "nightly.yml")
|
||||
for name, job := range nightly.Jobs {
|
||||
for _, step := range job.Steps {
|
||||
if regexp.MustCompile(`\bgo (test|build)\b|make ci-`).MatchString(step.Run) {
|
||||
t.Errorf("nightly.yml job %s step %q runs %q on a runner; run it under Bazel", name, step.Name, step.Run)
|
||||
}
|
||||
}
|
||||
if job.Uses != "" && job.Uses != "./.github/workflows/"+bazelWorkflowName {
|
||||
t.Errorf("nightly.yml job %s calls %s; only %s may be called", name, job.Uses, bazelWorkflowName)
|
||||
}
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(sourceRepoRoot(t), ".github/workflows/ci-measurements.yml")); !os.IsNotExist(err) {
|
||||
t.Errorf("ci-measurements.yml is back (stat err %v); its go test measurement suites ran on GitHub runners", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -889,9 +897,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
}
|
||||
})
|
||||
|
||||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "build-artifacts"), []goCacheStep{
|
||||
mainRestoreModuleCache(), mainRestoreBuildCache("non-race"), saveModuleCache(), saveBuildCache("non-race"),
|
||||
})
|
||||
// Blacksmith macOS: restores what blacksmith-macos-go-build-cache's
|
||||
// Blacksmith leg saves and owns only its race cache (day-bucketed, S7).
|
||||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "test"), []goCacheStep{
|
||||
|
|
@ -906,18 +911,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "windows-test-binaries-cache"), []goCacheStep{
|
||||
mainRestoreModuleCache(), mainRestoreXCompileCache(), saveModuleCacheAfterFailure(), saveXCompileCache(),
|
||||
})
|
||||
// F7b: race/non-race GOCACHE saves for same-repo PR consumers
|
||||
// (pr-preflight-platforms, check-doc-freshness-platforms)
|
||||
// that run on Blacksmith, whose cache namespace is invisible to
|
||||
// GitHub-hosted build-artifacts; its github venue leg seeds the fork
|
||||
// path's race cache (build-artifacts seeds its non-race one).
|
||||
assertGoCacheInventory(t, workflows["main.yml"].job(t, "blacksmith-go-build-cache"), []goCacheStep{
|
||||
mainRestoreModuleCache(),
|
||||
mainRestoreBuildCacheDayBucketedIf("race", "matrix.flavor == 'race'"),
|
||||
mainRestoreBuildCacheDayBucketedIf("non-race", "matrix.flavor == 'non-race'"),
|
||||
saveBuildCacheDayBucketedAfterFailureIf("race", "matrix.flavor == 'race'"),
|
||||
saveBuildCacheDayBucketedAfterFailureIf("non-race", "matrix.flavor == 'non-race'"),
|
||||
})
|
||||
// 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.
|
||||
|
|
@ -966,17 +959,9 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
})
|
||||
assertNoUnmanagedGoCacheSteps(t, workflows, map[string]map[string]bool{
|
||||
"main.yml": {
|
||||
"build-artifacts": true, "test": true, "test-windows": true,
|
||||
"windows-test-binaries-cache": true, "blacksmith-go-build-cache": true,
|
||||
"test": true, "test-windows": true,
|
||||
"windows-test-binaries-cache": true,
|
||||
"blacksmith-macos-go-build-cache": true,
|
||||
// F7c: blacksmith-setup-go-cache's own restore/save pair seeds the
|
||||
// self-defined blacksmith-sg-v1- cache namespace every advisory
|
||||
// Blacksmith consumer restores from (B2, F7c implementation
|
||||
// report); it is covered by its own
|
||||
// TestBlacksmithSetupGoSeedExistsForAdvisoryConsumers and
|
||||
// TestBlacksmithSetupGoCacheKeysMatchAcrossSeederAndConsumers in
|
||||
// ci_f7c_advisory_test.go, not by assertGoCacheInventory above.
|
||||
"blacksmith-setup-go-cache": true,
|
||||
},
|
||||
"pr.yml": {
|
||||
"worktree-remove-windows": true,
|
||||
|
|
@ -987,10 +972,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
"pr-risk.yml": {},
|
||||
})
|
||||
|
||||
mainArtifacts := workflows["main.yml"].job(t, "build-artifacts")
|
||||
assertStepsBefore(t, mainArtifacts, []string{"Restore Go module cache", "Restore non-race Go build cache"}, []string{"Build reusable Linux artifacts"})
|
||||
assertStepsBefore(t, mainArtifacts, []string{"Build reusable Linux artifacts", "Upload build artifacts"}, []string{"Save Go module cache", "Save non-race Go build cache"})
|
||||
|
||||
mainTest := workflows["main.yml"].job(t, "test")
|
||||
assertStepsBefore(t, mainTest, []string{"Restore Go module cache"}, []string{"Build", "Test"})
|
||||
assertStepsBefore(t, mainTest, []string{"Restore non-race Go build cache"}, []string{"Build"})
|
||||
|
|
@ -1020,7 +1001,6 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
assertStepsBefore(t, workflows["pr.yml"].job(t, "advisory-reports"),
|
||||
[]string{"Restore Go module cache"}, []string{"Type-check every module under examples/"})
|
||||
|
||||
assertGoCacheEnv(t, workflows["main.yml"].job(t, "build-artifacts"), "Build reusable Linux artifacts", "non-race")
|
||||
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")
|
||||
|
|
@ -1038,19 +1018,14 @@ func TestGoCacheOwnershipTopology(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "build-artifacts", "ubuntu-latest", "Save Go module cache", cacheMissCondition(goModuleCacheRestoreID))
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "build-artifacts", "ubuntu-latest", "Save non-race Go build cache", cacheMissCondition(goBuildCacheRestoreID("non-race")))
|
||||
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"], "blacksmith-go-build-cache", mainBlacksmithGoBuildCacheRunsOn, "Save race Go build cache", saveBuildCacheAfterFailureIf("race", "matrix.flavor == 'race'").ifCondition)
|
||||
assertGoCacheWriter(t, workflows["main.yml"], "blacksmith-go-build-cache", mainBlacksmithGoBuildCacheRunsOn, "Save non-race Go build cache", saveBuildCacheAfterFailureIf("non-race", "matrix.flavor == 'non-race'").ifCondition)
|
||||
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", "build-artifacts"},
|
||||
{"main.yml", "test"},
|
||||
{"main.yml", "test-windows"},
|
||||
{"main.yml", "windows-test-binaries-cache"},
|
||||
|
|
@ -2086,11 +2061,8 @@ const mainWindowsTestBinariesCacheRunsOn = "${{ matrix.runner == 'blacksmith' &&
|
|||
|
||||
// F7b: venue-matrix runs-on for main.yml jobs that seed a Blacksmith GOCACHE
|
||||
// alongside their GitHub-hosted seed ("venue: [blacksmith, github]"):
|
||||
// test-windows, blacksmith-go-build-cache and
|
||||
// blacksmith-macos-go-build-cache.
|
||||
const mainVenueBlacksmithUbuntu4vcpuRunsOn = "${{ matrix.venue == 'blacksmith' && 'blacksmith-4vcpu-ubuntu-2404' || 'ubuntu-latest' }}"
|
||||
// test-windows and blacksmith-macos-go-build-cache.
|
||||
const mainVenueBlacksmithWindows4vcpuRunsOn = "${{ matrix.venue == 'blacksmith' && 'blacksmith-4vcpu-windows-2025' || 'windows-latest' }}"
|
||||
const mainBlacksmithGoBuildCacheRunsOn = mainVenueBlacksmithUbuntu4vcpuRunsOn
|
||||
|
||||
// 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.
|
||||
|
|
@ -2402,26 +2374,19 @@ func TestSameRepoBlacksmithRunners(t *testing.T) {
|
|||
// to Blacksmith for same-repo PRs/merge_group only; forks,
|
||||
// Dependabot and push stay on ubuntu-latest.
|
||||
"docs-mintlify.yml": {"broken-links": sameRepoBlacksmith2vcpu},
|
||||
// main.yml's seeder job (B2, F7c implementation report) is the one
|
||||
// Blacksmith job that is NOT gated by the same-repo-PR expression: it
|
||||
// is push-to-main only (always trusted), so it wraps the literal
|
||||
// label in a trivial expression instead (see the job's own comment).
|
||||
// Tracked here so the "no other Blacksmith label leaks" sweep below
|
||||
// also covers main.yml.
|
||||
// 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": {
|
||||
"blacksmith-setup-go-cache": "${{ 'blacksmith-4vcpu-ubuntu-2404' }}",
|
||||
"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-go-build-cache's own single leg).
|
||||
// above restore from (test-windows's "venue" matrix).
|
||||
// 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,
|
||||
"blacksmith-go-build-cache": mainBlacksmithGoBuildCacheRunsOn,
|
||||
"test-windows": mainVenueBlacksmithWindows4vcpuRunsOn,
|
||||
// Same guard, seeding pr.yml's same-repo macOS legs.
|
||||
"blacksmith-macos-go-build-cache": mainBlacksmithMacOSGoBuildCacheRunsOn,
|
||||
// The macOS -race -short suite (Linux runs it under Bazel).
|
||||
|
|
@ -2671,19 +2636,24 @@ func TestPRPolicyChecksRunAsBazelTargets(t *testing.T) {
|
|||
t.Errorf("%s:%s tags = %v, want %s", c.build, c.target, tags, c.tags)
|
||||
}
|
||||
}
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
for name, job := range pr.Jobs {
|
||||
for _, step := range job.Steps {
|
||||
for _, moved := range []string{
|
||||
"check-build-tags.sh", "check-go-install-guidance.sh", "check-winget-portable-alias.sh",
|
||||
"check-versions.sh", "make fmt-check", "check-doc-freshness.sh", "make ci-pr-policy", "make api-check",
|
||||
} {
|
||||
if strings.Contains(step.Run, moved) {
|
||||
t.Errorf("pr.yml job %s step %q still runs %s, which is a Bazel test", name, step.Name, moved)
|
||||
// main.yml (push to main) too: bazel.yml's push run gates the same
|
||||
// targets, so no runner re-runs them after the merge.
|
||||
for _, wfName := range []string{"pr.yml", "main.yml"} {
|
||||
for name, job := range readCIWorkflow(t, wfName).Jobs {
|
||||
for _, step := range job.Steps {
|
||||
for _, moved := range []string{
|
||||
"check-build-tags.sh", "check-go-install-guidance.sh", "check-winget-portable-alias.sh",
|
||||
"check-versions.sh", "make fmt-check", "check-doc-freshness.sh", "make ci-pr-policy", "make api-check",
|
||||
"check-migration-hygiene.sh",
|
||||
} {
|
||||
if strings.Contains(step.Run, moved) && !(wfName == "pr.yml" && moved == "check-migration-hygiene.sh") {
|
||||
t.Errorf("%s job %s step %q still runs %s, which is a Bazel test", wfName, name, step.Name, moved)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pr := readCIWorkflow(t, "pr.yml")
|
||||
freshness := pr.job(t, "check-doc-freshness-platforms")
|
||||
for _, tuple := range freshness.Strategy.Matrix.Include {
|
||||
if tuple.ExpectedGOOS == "linux" {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ else
|
|||
fi
|
||||
|
||||
# Guard against a CGO-enabled bd: it exposes the full `bd federation` subcommand tree
|
||||
# that CI never produces (scripts/ci/pr-policy.sh build_docs_binary uses env
|
||||
# that CI never produces (scripts/check-doc-flags.sh is fed a
|
||||
# CGO_ENABLED=0 go build). A CGO build therefore emits ~hundreds of lines of federation
|
||||
# help that the committed, CI-built docs stub out ("built without CGO support"), so a
|
||||
# naive regen on a machine with a C compiler produces spurious federation churn.
|
||||
|
|
|
|||
|
|
@ -235,10 +235,10 @@ func sortedKeys[V any](m map[string]V) []string {
|
|||
func testPackageGateJobs(t *testing.T, prGateRequired []string) {
|
||||
t.Helper()
|
||||
workflow := readCIWorkflow(t, bazelWorkflowName)
|
||||
// main.yml's own package-mcp/package-npm jobs (nightly, not gated by
|
||||
// rbe) run the same language setup; bazel.yml's copy must not drift
|
||||
// from it.
|
||||
mainWorkflow := readCIWorkflow(t, "main.yml")
|
||||
// release.yml's release-package-mcp/release-package-npm jobs (the tag
|
||||
// build's package gates) run the same language setup; bazel.yml's copy
|
||||
// must not drift from it.
|
||||
mainWorkflow := readCIWorkflow(t, "release.yml")
|
||||
type pkgLane struct {
|
||||
job, detectOutput, langStepName, makeTarget string
|
||||
}
|
||||
|
|
@ -352,22 +352,22 @@ func testPackageGateJobs(t *testing.T, prGateRequired []string) {
|
|||
t.Errorf("%s step %q: if %q, want %q", lane.job, lane.langStepName, st.If, detectIf)
|
||||
}
|
||||
|
||||
// The language setup itself must not drift from main.yml's copy of
|
||||
// the same job (python-version / Node version / the uv install
|
||||
// command): main.yml's jobs are ungated by rbe, so they are the one
|
||||
// other place this exact setup is pinned.
|
||||
mainJob := mainWorkflow.job(t, lane.job)
|
||||
// The language setup itself must not drift from release.yml's copy
|
||||
// of the same gate (python-version / Node version / the uv install
|
||||
// command): the tag build is the one other place this exact setup
|
||||
// is pinned.
|
||||
mainJob := mainWorkflow.job(t, "release-"+lane.job)
|
||||
langStep := job.step(t, lane.langStepName)
|
||||
mainLangStep := mainJob.step(t, lane.langStepName)
|
||||
if langStep.Uses != mainLangStep.Uses || !reflect.DeepEqual(langStep.With, mainLangStep.With) {
|
||||
t.Errorf("%s %q: uses %q, with %v; main.yml's %s has uses %q, with %v",
|
||||
t.Errorf("%s %q: uses %q, with %v; release.yml's release-%s has uses %q, with %v",
|
||||
lane.job, lane.langStepName, langStep.Uses, langStep.With, lane.job, mainLangStep.Uses, mainLangStep.With)
|
||||
}
|
||||
if lane.job == bazelPackageMCPJobName {
|
||||
installUv := job.step(t, "Install uv")
|
||||
mainInstallUv := mainJob.step(t, "Install uv")
|
||||
if installUv.Run != mainInstallUv.Run {
|
||||
t.Errorf("%s Install uv: run %q; main.yml's has run %q", lane.job, installUv.Run, mainInstallUv.Run)
|
||||
t.Errorf("%s Install uv: run %q; release.yml's has run %q", lane.job, installUv.Run, mainInstallUv.Run)
|
||||
}
|
||||
}
|
||||
gateName := "Run " + map[string]string{bazelPackageMCPJobName: "MCP", bazelPackageNPMJobName: "npm"}[lane.job] + " package gate"
|
||||
|
|
|
|||
|
|
@ -919,6 +919,12 @@ func TestBazelRetiredLanesCannotBeNarrowed(t *testing.T) {
|
|||
[]string{"$(rootpath :embeddeddolt_test)", "-test.v", "-test.count=1", "-test.timeout=19m", "-test.run=^TestConformance$$/^Audit$$"},
|
||||
map[string]string{"BEADS_TEST_EMBEDDED_DOLT": "1"},
|
||||
},
|
||||
// nightly.yml's retired non-race embedded batch-apply step: the large
|
||||
// shapes every race lane shrinks or skips (raceEnabled).
|
||||
"//internal/storage/embeddeddolt:embeddeddolt_batch_apply_nonrace_test": {
|
||||
[]string{"$(rootpath :embeddeddolt_race_off)", "-test.v", "-test.count=1", "-test.timeout=19m", "-test.run=^(TestBatchApplyContract|TestLargeBatchApplyWallClock_Embedded|TestLargeBatchApplyStatementCounts712_Embedded|TestCreateBatchFastPathsMatchPerRowLarge_Embedded)$$"},
|
||||
map[string]string{"BEADS_TEST_EMBEDDED_DOLT": "1"},
|
||||
},
|
||||
"//cmd/bd:bd_proxied_test": {
|
||||
[]string{"$(rootpath //:.github/scripts/proxied-test-shard.sh)", "BEADS_TEST_CMD_BINARY", "$(rootpath :bd_test)"},
|
||||
map[string]string{
|
||||
|
|
|
|||
|
|
@ -82,8 +82,7 @@ repo_subset(
|
|||
include = [".github/workflows/*.yml"],
|
||||
)
|
||||
|
||||
# scripts/checkworkflowtags (`go run ./scripts/checkworkflowtags` in
|
||||
# scripts/ci/pr-policy.sh): the workflows' direct go commands declare
|
||||
# scripts/checkworkflowtags: the workflows' direct go commands declare
|
||||
# gms_pure_go.
|
||||
sh_test(
|
||||
name = "workflow_tags_test",
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ type workflowStep struct {
|
|||
// allowsBareCommands reports whether a workflow opts out of this check with the
|
||||
// repository's existing marker in its first five lines.
|
||||
//
|
||||
// This check runs in the required pr-policy lane, so without an opt-out a
|
||||
// This check is required (//scripts/repochecks:workflow_tags_test), so without an opt-out a
|
||||
// workflow that legitimately needs a bare `go` command has no way through. The
|
||||
// marker and its five-line window are not invented here: scripts/check-build-tags.sh
|
||||
// already honors exactly `^# build-tags: allow-bare` within `head -n 5`, and
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ func TestCheckDirRejectsEmptyInventory(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestCheckDirHonorsAllowBareMarker pins the file-level opt-out. This check runs
|
||||
// in the required pr-policy lane, so a workflow that legitimately needs a bare
|
||||
// TestCheckDirHonorsAllowBareMarker pins the file-level opt-out. This check is
|
||||
// required (//scripts/repochecks:workflow_tags_test), so a workflow that legitimately needs a bare
|
||||
// `go` command needs a way through, and the repository already has one:
|
||||
// scripts/check-build-tags.sh honors `# build-tags: allow-bare` within the first
|
||||
// five lines, and engdocs/ICU-POLICY.md documents that window. The same spelling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue