From fca7fb6e4a8f142964b1242e5b67116c56005858 Mon Sep 17 00:00:00 2001 From: Softonik Date: Wed, 25 May 2022 06:10:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20Magefile.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Magefile.go | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Magefile.go 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 \ + '`) +}