Add aliases and comments

This commit is contained in:
kolaente 2020-09-01 09:21:47 +02:00
parent 26ff6ec7a4
commit 087c1b352a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 9 additions and 1 deletions

View File

@ -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")