Fetch benchmark before checkout

This commit is contained in:
2024-07-23 18:31:47 +02:00
parent 123d90b4f5
commit e0abb0ca70

View File

@@ -48,7 +48,10 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
log.Printf("Done; Checking out benchmark branch") log.Printf("Benchmarking done; Fetching benchmark branch")
fetchBenchmark()
time.Sleep(200 * time.Millisecond)
log.Printf("Checking out benchmark branch")
checkoutBenchmark() checkoutBenchmark()
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
log.Printf("Adding benchmark results") log.Printf("Adding benchmark results")
@@ -72,8 +75,17 @@ func getHeadHash() string {
return strings.TrimSpace(string(out)) return strings.TrimSpace(string(out))
} }
func fetchBenchmark() {
gitFetch := exec.Command("git", "fetch", "origin", "benchmark")
gitFetch.Dir = "../"
out, err := gitFetch.CombinedOutput()
if err != nil {
log.Fatalf("Could not fetch benchmark branch with code %v and error %v", err, string(out))
}
}
func checkoutBenchmark() { func checkoutBenchmark() {
gitCheckout := exec.Command("git", "checkout", "benchmark") gitCheckout := exec.Command("git", "checkout", "origin/benchmark")
gitCheckout.Dir = "../" gitCheckout.Dir = "../"
out, err := gitCheckout.CombinedOutput() out, err := gitCheckout.CombinedOutput()
if err != nil { if err != nil {