File tree Expand file tree Collapse file tree 6 files changed +80
-56
lines changed
Expand file tree Collapse file tree 6 files changed +80
-56
lines changed Original file line number Diff line number Diff line change 1+ name : Testing
2+
3+ on :
4+ push :
5+ branches : [ v0.3 ]
6+ pull_request :
7+ branches : [ v0.3 ]
8+
9+ jobs :
10+ lint :
11+ name : Lint
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Check out code
15+ uses : actions/checkout@v2
16+ - name : golangci-lint
17+ uses : golangci/golangci-lint-action@v2
18+
19+ test :
20+ name : Test
21+ runs-on : ubuntu-latest
22+ needs : [ lint ]
23+
24+ services :
25+ rabbit :
26+ image : rabbitmq:3.6-management-alpine
27+ ports :
28+ - " 5672"
29+ - " 15672"
30+
31+ mongo :
32+ image : mongo:3
33+ ports :
34+ - " 27017"
35+
36+ steps :
37+ - name : Set up Go
38+ uses : actions/setup-go@v2
39+ - name : Check out code
40+ uses : actions/checkout@v2
41+ - name : Run unit tests
42+ run : go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
43+ - name : Run integration tests
44+ if : success()
45+ run : go run ./cmd/goengine/...
46+ env :
47+ BROKER_DSN : amqp://guest:guest@localhost:${{ job.services.rabbit.ports[5672] }}/
48+ STORAGE_DSN : mongodb://localhost:${{ job.services.mongo.ports[27017] }}/
49+
50+ - name : Upload coverage to Codecov
51+ uses : codecov/codecov-action@v1
52+ if : success()
53+ with :
54+ file : ./coverage.txt
55+ fail_ci_if_error : false
Original file line number Diff line number Diff line change @@ -24,4 +24,5 @@ _testmain.go
2424* .test
2525* .prof
2626debug
27- gin-bin
27+ gin-bin
28+ coverage.txt
Original file line number Diff line number Diff line change 1+ # See https://golangci-lint.run/usage/configuration/#config-file for more information
2+ run :
3+ timeout : 5m
4+ linters :
5+ disable-all : true
6+ enable :
7+ - gofmt
8+ - golint
9+ - goimports
10+ fast : false
11+ linters-settings :
12+ gofmt :
13+ simplify : false
14+ issues :
15+ exclude-use-default : false
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11NO_COLOR =\033[0m
22OK_COLOR =\033[32;01m
33
4- PKG_SRC := github.com/hellofresh/goengine
5-
6- deps :
7- @echo " $( OK_COLOR) ==> Installing test dependencies$( NO_COLOR) "
8- @go get -u github.com/onsi/ginkgo/ginkgo
9- @go get -u github.com/onsi/gomega
10-
11- vet :
12- @echo " $( OK_COLOR) ==> checking code correctness with 'go vet' tool$( NO_COLOR) "
13- @go vet ./...
14-
15- lint : tools.golint
16- @echo " $( OK_COLOR) ==> checking code style with 'golint' tool$( NO_COLOR) "
17- @go list ./... | xargs -n 1 golint -set_exit_status
18-
19- test-integration : lint vet
4+ test-integration :
205 @echo " $( OK_COLOR) ==> Running integration tests$( NO_COLOR) "
21- @STORAGE_DSN=mongodb://localhost:27017/ BROKER_DSN=amqp://guest:guest@localhost:5672/ go run $( PKG_SRC ) /cmd/goengine/...
6+ @STORAGE_DSN=mongodb://localhost:27017/ BROKER_DSN=amqp://guest:guest@localhost:5672/ go run . /cmd/goengine/...
227
23- test-unit : lint vet
8+ test-unit :
249 @echo " $( OK_COLOR) ==> Running unit tests$( NO_COLOR) "
25- @ginkgo -r
26-
27- # ---------------
28- # -- tools
29- # ---------------
30-
31- tools : tools.golint
10+ @go test -cover -coverprofile=coverage.txt -covermode=atomic ./...
3211
33- tools.golint :
34- @command -v golint > /dev/null ; if [ $$ ? -ne 0 ]; then \
35- echo " --> installing golint" ; \
36- go get golang.org/x/lint/golint; \
37- fi
12+ lint :
13+ @echo " $( OK_COLOR) ==> Linting with golangci-lint$( NO_COLOR) "
14+ @docker run -it --rm -v $(pwd ) :/app -w /app golangci/golangci-lint:v1.39.0 golangci-lint run -v
Original file line number Diff line number Diff line change @@ -8,6 +8,6 @@ services:
88 - " 5672:5672"
99
1010 mongo :
11- image : mongo
11+ image : mongo:3
1212 ports :
1313 - " 27017:27017"
You can’t perform that action at this time.
0 commit comments