/
magefile.go
64 lines (50 loc) · 1.22 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// +build mage
package main
import (
"os"
"path/filepath"
"github.com/voyages-sncf-technologies/mageproj/mgp"
)
const (
projectName = "mageproj"
groupName = "voyages-sncf-technologies"
artifactRepo = "github.com"
gitRepo = "github.com"
)
var proj *mgp.MageProject
func init() {
packageName := filepath.Join(gitRepo, groupName, projectName)
artifactURL := "https://" + filepath.Join(artifactRepo, groupName, projectName, "releases")
gitURL := "https://" + filepath.Join(gitRepo, groupName, projectName)
withArtURL := mgp.WithArtifactURL(artifactURL)
withGitURL := mgp.WithGitURL(gitURL)
proj = mgp.NewMageProject(currentDir(), projectName, packageName,
withArtURL, withGitURL)
}
func currentDir() string {
workdir, err := os.Getwd()
if err != nil {
workdir = "."
}
return workdir
}
// Clean removes the build directory
func Clean() error {
return proj.Clean()
}
// Validate runs format and linters
func Validate() error {
return proj.Validate()
}
// Test runs tests with go test
func Test() error {
return proj.Test()
}
// Build builds binary in build dir
func Build() error {
return proj.Build()
}
// ChangeLog generates a ChangeLog based on git history
func ChangeLog() error {
return proj.ChangeLog()
}