ci: run release compatibility in PR admission

This commit is contained in:
chichuan
2026-08-06 11:16:19 +08:00
parent 4bcf71fb9e
commit 37fbb110e3
2 changed files with 35 additions and 0 deletions
+28
View File
@@ -384,6 +384,34 @@ func TestReleaseChangelogExtractionAllowsLowercaseTodoProductName(t *testing.T)
}
}
func TestInterfaceIntegrityWorkflowContract(t *testing.T) {
root, err := filepath.Abs(filepath.Join("..", ".."))
if err != nil {
t.Fatalf("Abs(repo root) error = %v", err)
}
data, err := os.ReadFile(filepath.Join(root, ".github", "workflows", "ci.yml"))
if err != nil {
t.Fatalf("ReadFile(ci.yml) error = %v", err)
}
workflow := string(data)
interfaceStart := strings.Index(workflow, "\n interface-integrity:\n")
interfaceEnd := strings.Index(workflow, "\n cli-smoke:\n")
if interfaceStart < 0 || interfaceEnd <= interfaceStart {
t.Fatal("Code Admission workflow missing Interface Integrity job boundaries")
}
interfaceJob := workflow[interfaceStart:interfaceEnd]
for _, want := range []string{
"name: Check complete CLI command compatibility",
"./scripts/policy/check-command-compatibility.sh",
`--base-ref "$COMPATIBILITY_BASE_REF"`,
`--stable-ref "$COMPATIBILITY_STABLE_REF"`,
} {
if !strings.Contains(interfaceJob, want) {
t.Errorf("Interface Integrity job missing release-equivalent compatibility contract %q", want)
}
}
}
func TestChangelogPRFastPathWorkflowContract(t *testing.T) {
root, err := filepath.Abs(filepath.Join("..", ".."))
if err != nil {