chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"data-terminal-cloud/internal/safariconformance"
|
||||
)
|
||||
|
||||
func main() {
|
||||
capturePath := flag.String("capture", "", "safari-compatibility-capture-v1 JSON")
|
||||
candidateVersion := flag.String("candidate-version", "", "release candidate version")
|
||||
buildDigest := flag.String("build-digest", "", "sha256 immutable build digest")
|
||||
outputPath := flag.String("output", "", "absolute output report path")
|
||||
flag.Parse()
|
||||
if *capturePath == "" || strings.TrimSpace(*candidateVersion) == "" || strings.TrimSpace(*buildDigest) == "" || !filepath.IsAbs(*outputPath) {
|
||||
fmt.Fprintln(os.Stderr, "usage: safari-conformance -capture capture.json -candidate-version VERSION -build-digest sha256:... -output ABSOLUTE.json")
|
||||
os.Exit(2)
|
||||
}
|
||||
content, err := os.ReadFile(*capturePath)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "read Safari capture:", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
capture, err := safariconformance.ParseCapture(content)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(2)
|
||||
}
|
||||
report := safariconformance.Evaluate(capture, *candidateVersion, *buildDigest, time.Now().UTC())
|
||||
report.InputSHA256["safari_capture"] = safariconformance.SHA256(content)
|
||||
encoded, _ := json.MarshalIndent(report, "", " ")
|
||||
encoded = append(encoded, '\n')
|
||||
if err = os.WriteFile(*outputPath, encoded, 0o600); err != nil {
|
||||
fmt.Fprintln(os.Stderr, "write Safari report:", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
fmt.Printf("Safari compatibility conformance %s: %s\n", report.Result, *outputPath)
|
||||
if report.Result != "PASS" {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user