build: add magefile

This commit is contained in:
Dan Anglin 2021-09-05 16:18:29 +01:00
parent 3a19b7b16d
commit 528a30476e
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 38 additions and 0 deletions

1
go.mod
View file

@ -3,6 +3,7 @@ module forge.dananglin.me.uk/code/dananglin/helix
go 1.16
require (
github.com/magefile/mage v1.11.0
github.com/pulumi/pulumi-docker/sdk/v3 v3.1.0
github.com/pulumi/pulumi/sdk/v3 v3.11.0
github.com/urfave/cli/v2 v2.3.0

2
go.sum
View file

@ -125,6 +125,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=

35
magefile.go Normal file
View file

@ -0,0 +1,35 @@
//+build mage
package main
import (
"os"
"github.com/magefile/mage/sh"
)
var Default = Build
var binary = "helix"
func Clean() error {
var err error
if err = sh.Run("go", "clean", "./..."); err != nil {
return err
}
if err = os.Remove(binary); err != nil {
return err
}
return nil
}
func Test() error {
return sh.Run("go", "test", ".")
}
func Build() error {
return sh.Run("go", "build", "-o", binary, "cmd/helix/main.go")
}