From 5b59141c3ae90804adda2a671490c437aa10eecf Mon Sep 17 00:00:00 2001 From: David Dworken Date: Fri, 15 Apr 2022 18:12:26 -0700 Subject: [PATCH] optimize test execution time by only building the client once + add Makefile target for action tests --- Makefile | 4 ++++ client/client_test.go | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fb201a9..5ae5097 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,13 @@ forcetest: go clean -testcache HISHTORY_TEST=1 go test -p 1 ./... + test: HISHTORY_TEST=1 go test -p 1 ./... +acttest: + act push -j test + release: expr `cat VERSION` + 1 > VERSION git add VERSION diff --git a/client/client_test.go b/client/client_test.go index 1af01cb..e694bae 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -23,6 +23,11 @@ import ( func TestMain(m *testing.M) { defer shared.RunTestServer()() + cmd := exec.Command("go", "build", "-o", "/tmp/client") + err := cmd.Run() + if err != nil { + panic(fmt.Sprintf("failed to build client: %v", err)) + } m.Run() } @@ -163,8 +168,7 @@ func TestIntegrationWithNewDevice(t *testing.T) { } func installHishtory(t *testing.T, userSecret string) string { - out := RunInteractiveBashCommands(t, `go build -o /tmp/client -/tmp/client install `+userSecret) + out := RunInteractiveBashCommands(t, `/tmp/client install `+userSecret) r := regexp.MustCompile(`Setting secret hishtory key to (.*)`) matches := r.FindStringSubmatch(out) if len(matches) != 2 {