Fetch benchmark before checkout

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

View File

@@ -47,8 +47,11 @@ func main() {
if err != nil {
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()
time.Sleep(200 * time.Millisecond)
log.Printf("Adding benchmark results")
@@ -72,8 +75,17 @@ func getHeadHash() string {
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() {
gitCheckout := exec.Command("git", "checkout", "benchmark")
gitCheckout := exec.Command("git", "checkout", "origin/benchmark")
gitCheckout.Dir = "../"
out, err := gitCheckout.CombinedOutput()
if err != nil {