feat: expose runtime build version

This commit is contained in:
姚章浩
2026-07-27 12:10:17 +08:00
parent aa0513eb59
commit 2c0ed7cc67
7 changed files with 159 additions and 5 deletions
+32
View File
@@ -0,0 +1,32 @@
package scripts
import (
"os"
"strings"
"testing"
)
func TestDeployLocalBuildsItsSelectedSourceAndVerifiesVersion(t *testing.T) {
data, err := os.ReadFile("deploy-local.sh")
if err != nil {
t.Fatal(err)
}
source := string(data)
if strings.Contains(source, `root="/home/zheromiku/dobotai-platform"`) {
t.Fatal("deploy script must not hard-code the production checkout")
}
for _, fragment := range []string{
`BASH_SOURCE[0]`,
`DOBOTAI_SOURCE_ROOT`,
`git -C "$root" status --porcelain`,
`git -C "$root" rev-parse HEAD`,
`main.version`,
`main.commitSHA`,
`main.buildTime`,
`http://127.0.0.1:8090/version`,
} {
if !strings.Contains(source, fragment) {
t.Errorf("deploy script missing %q", fragment)
}
}
}