Skip to content

Commit 7eb4de2

Browse files
committed
Run all tests in CI
1 parent 77734a9 commit 7eb4de2

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

.travis.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ go:
99
- "1.11"
1010
- "stable"
1111

12+
env:
13+
- MAKE_TASK=test-unit
14+
- MAKE_TASK=test-integration
15+
16+
before_install:
17+
- docker-compose up -d
18+
1219
install:
1320
- go get -v -d
1421
- go get -u github.com/onsi/ginkgo/ginkgo
1522
- go get -u github.com/onsi/gomega
1623

17-
script: ginkgo -r
24+
script:
25+
- make $MAKE_TASK
26+
27+
after_script:
28+
- docker-compose down -v

Gopkg.lock

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
NO_COLOR=\033[0m
2+
OK_COLOR=\033[32;01m
3+
4+
format:
5+
@echo "$(OK_COLOR)==> checking code formating with 'gofmt' tool$(NO_COLOR)"
6+
@gofmt -l -s cmd pkg | grep ".*\.go"; if [ "$$?" = "0" ]; then exit 1; fi
7+
8+
vet:
9+
@echo "$(OK_COLOR)==> checking code correctness with 'go vet' tool$(NO_COLOR)"
10+
@go vet ./...
11+
12+
lint: tools.golint
13+
@echo "$(OK_COLOR)==> checking code style with 'golint' tool$(NO_COLOR)"
14+
@go list ./... | xargs -n 1 golint -set_exit_status
15+
16+
test-integration: lint format vet
17+
@echo "$(OK_COLOR)==> Running integration tests$(NO_COLOR)"
18+
@STORAGE_DSN=mongodb://localhost:27017/ BROKER_DSN=amqp://guest:guest@localhost:5672/ go run ./cmd/goengine/...
19+
20+
test-unit: lint format vet
21+
@echo "$(OK_COLOR)==> Running unit tests$(NO_COLOR)"
22+
@ginkgo -r
23+
24+
#---------------
25+
#-- tools
26+
#---------------
27+
28+
tools: tools.golint
29+
30+
tools.golint:
31+
@command -v golint >/dev/null ; if [ $$? -ne 0 ]; then \
32+
echo "--> installing golint"; \
33+
go get github.com/golang/lint/golint; \
34+
fi

0 commit comments

Comments
 (0)