diff --git a/Magefile.go b/Magefile.go new file mode 100644 index 0000000..43f96fa --- /dev/null +++ b/Magefile.go @@ -0,0 +1,88 @@ +//go:build mage +// +build mage + +package main + +import ( + // mage:import + . "magefile/docker" +) + +var ( + GolangVolume = "/gopath/go/1.17" +) + +func init() { + AppName = "godog" + ImageName = "my/go" +} + +func Test() { + Bash(`sudo docker run -ti --rm \ + -h host \ + --net=bridge \ + -v /etc/localtime:/etc/localtime:ro \ + -v ` + GolangVolume + `:/usr/local/go:ro \ + \ + -v /gopath:/gopath:rw \ + -v ${PWD}:/app \ + \ + -e GOPATH=/gopath \ + -e GOCACHE=/gopath/gocache \ + \ + -w /app \ + -u 1000 \ + \ + --entrypoint=/bin/bash \ + \ + ` + ImageName + " -c '" + `set -x; \ + make test \ + '`) +} + +func TestSnippets() { + Bash(`sudo docker run -ti --rm \ + -h host \ + --net=bridge \ + -v /etc/localtime:/etc/localtime:ro \ + -v ` + GolangVolume + `:/usr/local/go:ro \ + \ + -v /gopath:/gopath:rw \ + -v ${PWD}:/app \ + \ + -e GOPATH=/gopath \ + -e GOCACHE=/gopath/gocache \ + \ + -w /app \ + -u 1000 \ + \ + --entrypoint=/bin/bash \ + \ + ` + ImageName + " -c '" + `set -x; \ + godog run -f progress -c 4 \ + features/snippets.feature \ + '`) +} + +func Install() { + Bash(`sudo docker run -ti --rm \ + -h host \ + --net=bridge \ + -v /etc/localtime:/etc/localtime:ro \ + -v ` + GolangVolume + `:/usr/local/go:ro \ + \ + -v /gopath:/gopath:rw \ + -v ${PWD}:/app \ + \ + -e GOPATH=/gopath \ + -e GOCACHE=/gopath/gocache \ + \ + -w /app \ + -u 1000 \ + \ + --entrypoint=/bin/bash \ + \ + ` + ImageName + " -c '" + `set -x; \ + go install ./cmd/godog \ + '`) +}