godog/Magefile.go

112 строки
1,8 КиБ
Go

//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 TestTags() {
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/tags.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 \
'`)
}