Этот коммит содержится в:
Fredrik Lönnblad 2020-02-29 17:50:44 -03:00
родитель 0d205bc43e
коммит 310ce24fb0
2 изменённых файлов: 14 добавлений и 30 удалений

Просмотреть файл

@ -15,15 +15,10 @@ executors:
- image: circleci/golang:1.14.0 - image: circleci/golang:1.14.0
commands: commands:
install:
description: "Install dependencies"
steps:
- run: GO111MODULE=on go mod vendor -v
vet: vet:
description: "Run go vet" description: "Run go vet"
steps: steps:
- run: go vet github.com/cucumber/godog - run: go vet ./...
- run: go vet github.com/cucumber/godog/colors
fmt: fmt:
description: "Run go fmt" description: "Run go fmt"
steps: steps:
@ -32,13 +27,7 @@ commands:
description: "Run golint" description: "Run golint"
steps: steps:
- run: go get -u golang.org/x/lint/golint - run: go get -u golang.org/x/lint/golint
- run: golint ./godog - run: golint ./...
- run: golint ./cmd/godog/main.go
godog:
description: "Run godog"
steps:
- run: go install ./cmd/godog
- run: godog -f progress
go_test: go_test:
description: "Run go test" description: "Run go test"
steps: steps:
@ -48,31 +37,35 @@ commands:
steps: steps:
- codecov/upload: - codecov/upload:
file: "coverage.txt" file: "coverage.txt"
godog:
description: "Run godog"
steps:
- run: go install ./cmd/godog
- run: godog -f progress
all: all:
description: "Run all commands against godog code" description: "Run all commands against godog code"
steps: steps:
- checkout - checkout
- install
- vet - vet
- fmt - fmt
- lint - lint
- godog
- go_test - go_test
- coverage - coverage
- godog
jobs: jobs:
go1_12: go1_12:
working_directory: /go/src/github.com/cucumber/godog working_directory: godog
executor: exec_go_1_12 executor: exec_go_1_12
steps: steps:
- all - all
go1_13: go1_13:
working_directory: /go/src/github.com/cucumber/godog working_directory: godog
executor: exec_go_1_13 executor: exec_go_1_13
steps: steps:
- all - all
go1_14: go1_14:
working_directory: /go/src/github.com/cucumber/godog working_directory: godog
executor: exec_go_1_14 executor: exec_go_1_14
steps: steps:
- all - all

Просмотреть файл

@ -28,7 +28,6 @@ import (
"fmt" "fmt"
"github.com/cucumber/godog" "github.com/cucumber/godog"
"github.com/cucumber/messages-go/v9"
) )
func thereAreGodogs(available int) error { func thereAreGodogs(available int) error {
@ -56,7 +55,7 @@ func FeatureContext(s *godog.Suite) {
s.Step("^I eat (\\d+)$", iEat) s.Step("^I eat (\\d+)$", iEat)
s.Step("^there should be (\\d+) remaining$", thereShouldBeRemaining) s.Step("^there should be (\\d+) remaining$", thereShouldBeRemaining)
s.BeforeScenario(func(*messages.Pickle) { s.BeforeScenario(func(interface{}) {
Godogs = 0 // clean the state before every scenario Godogs = 0 // clean the state before every scenario
}) })
} }
@ -68,8 +67,6 @@ import (
"fmt" "fmt"
"github.com/cucumber/godog" "github.com/cucumber/godog"
"github.com/cucumber/messages-go/v9"
"godogs" "godogs"
) )
@ -98,7 +95,7 @@ func FeatureContext(s *godog.Suite) {
s.Step("^I eat (\\d+)$", iEat) s.Step("^I eat (\\d+)$", iEat)
s.Step("^there should be (\\d+) remaining$", thereShouldBeRemaining) s.Step("^there should be (\\d+) remaining$", thereShouldBeRemaining)
s.BeforeScenario(func(*messages.Pickle) { s.BeforeScenario(func(interface{}) {
godogs.Godogs = 0 // clean the state before every scenario godogs.Godogs = 0 // clean the state before every scenario
}) })
} }
@ -328,18 +325,12 @@ func TestGodogBuildWithVendoredGodogAndMod(t *testing.T) {
} }
defer os.RemoveAll(gopath) defer os.RemoveAll(gopath)
pkg := filepath.Join(dir, "vendor", "github.com", "cucumber")
if err := os.MkdirAll(pkg, 0755); err != nil {
t.Fatal(err)
}
prevDir, err := os.Getwd() prevDir, err := os.Getwd()
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
// symlink godog package if err = exec.Command("go", "mod", "vendor").Run(); err != nil {
if err := os.Symlink(prevDir, filepath.Join(pkg, "godog")); err != nil {
t.Fatal(err) t.Fatal(err)
} }