From 087c1b352ab08c73a7e6627a1123a6065277e1c6 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 1 Sep 2020 09:21:47 +0200 Subject: [PATCH] Add aliases and comments --- magefile.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/magefile.go b/magefile.go index 140a2950d..2d467e24f 100644 --- a/magefile.go +++ b/magefile.go @@ -45,6 +45,11 @@ var ( BinLocation = "" PkgVersion = "master" ApiPackages = []string{} + + // Aliases are mage aliases of targets + Aliases = map[string]interface{}{ + "integration-test": IntegrationTest, + } ) func setVersion() { @@ -145,7 +150,7 @@ func runAndStreamOutput(cmd string, args ...string) { } } -// Clean all build, executable and bindata files. +// Cleans all build, executable and bindata files. func Clean() error { if err := exec.Command("go", "clean", "./...").Run(); err != nil { return err @@ -162,17 +167,20 @@ func Clean() error { return nil } +// Runs all tests except integration tests func Test() { // We run everything sequentially and not in parallel to prevent issues with real test databases args := append([]string{"test", Goflags[0], "-p", "1"}, ApiPackages...) runAndStreamOutput("go", args...) } +// Runs the tests and builds the coverage html file from coverage output func TestCoverage() { mg.Deps(Test) runAndStreamOutput("go", "tool", "cover", "-html=cover.out", "-o", "cover.html") } +// Runs the integration tests func IntegrationTest() { // We run everything sequentially and not in parallel to prevent issues with real test databases runAndStreamOutput("go", "test", Goflags[0], "-p", "1", PACKAGE+"/pkg/integrations")