-
Notifications
You must be signed in to change notification settings - Fork 2
/
Magefile.go
38 lines (32 loc) · 908 Bytes
/
Magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//go:build mage
// +build mage
package main
import (
"github.com/magefile/mage/mg"
// mage:import
build "github.com/grafana/grafana-plugin-sdk-go/build"
"github.com/magefile/mage/sh"
"os"
"path"
)
// Default configures the default target.
var Default = build.BuildAll
// Server builds the example server inside cmd/server
func Server() error {
os.Chdir(path.Join("cmd", "server"))
defer os.Chdir(path.Join("..", ".."))
if err := sh.Run("go", "build", "-v"); err != nil {
return err
}
return nil
}
// CleanAll runs the 'clean' target and also removes the example server binary in cmd/server
func CleanAll() error {
mg.Deps(build.Clean)
return os.Remove(path.Join("cmd", "server", "server"))
}
// TestAll runs all test for the backend (go test ./...), it's different than 'test', which runs tests only
// in the pkg package.
func TestAll() error {
return sh.RunV("go", "test", "./...")
}