fast-checks, PR Policy, and the Linux leg of check-doc-freshness-platforms ran repository guards on GitHub runners. They now run as Bazel tests in bazel.yml's `test` lane (remote, cached), each over only the files it reads: - tools/bazel/repo_subset.bzl picks a narrow, path-selected slice of //:repo_files at analysis time. scripts/repochecks/run_check.sh copies that slice into a throwaway git checkout and runs the unchanged guard there. - //scripts/repochecks: build_tags, workflow_tags, go_install_guidance, winget_portable_alias, migration_hygiene (checks A and B), fmt (registered SDK gofmt), doc_freshness, workapi_frontend_boundary, types_gen_drift (`make api-check` drift, oapi-codegen from go.mod). - //scripts:doc_freshness_required_test (integration lane, -required-suite) and //scripts/gitattributespolicy:gitattributespolicy_required_host_test cover the Linux doc-freshness leg. - check-versions stays covered by //internal/versioncheck:versioncheck_test. check-testing-short stays covered by //scripts:scripts_test. pr-policy-wrapper is deleted. fast-checks keeps only the two checks that need the PR base: migration hygiene's delta half (MIGRATION_HYGIENE_SCOPE= delta) and the .beads diff. check-doc-flags stays, because it builds bd from the pinned release tag. The example Go modules leave .bazelignore so gofmt and the grep guards see them. check_testcases.py now accepts --not-go //pkg:all. Refs: ga-96smfk.20 Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
package scripts_test
|
|
|
|
// Helpers shared by the package's test files, kept apart so a focused
|
|
// go_test over a few of them (//scripts:doc_freshness_required_test) compiles
|
|
// without the rest of the package.
|
|
|
|
import (
|
|
"errors"
|
|
"os/exec"
|
|
"path/filepath"
|
|
"runtime"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/testutil/bazeltest"
|
|
)
|
|
|
|
func sourceRepoRoot(t *testing.T) string {
|
|
t.Helper()
|
|
_, file, _, ok := runtime.Caller(0)
|
|
if !ok {
|
|
t.Fatal("runtime.Caller failed")
|
|
}
|
|
// Under Bazel the caller path is workspace-relative; CallerDir rebuilds it
|
|
// under the runfiles root, which holds the files scripts_test declares.
|
|
return filepath.Dir(bazeltest.CallerDir(file, "scripts"))
|
|
}
|
|
|
|
func msysPath(path string) string {
|
|
path = filepath.Clean(path)
|
|
path = filepath.ToSlash(path)
|
|
if len(path) >= 3 && path[1] == ':' && path[2] == '/' {
|
|
return "/" + strings.ToLower(path[:1]) + path[2:]
|
|
}
|
|
return path
|
|
}
|
|
|
|
func exitCode(err error) int {
|
|
if err == nil {
|
|
return 0
|
|
}
|
|
var exitErr *exec.ExitError
|
|
if errors.As(err, &exitErr) {
|
|
return exitErr.ExitCode()
|
|
}
|
|
return -1
|
|
}
|