forked from mendersoftware/workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (50 loc) · 1.59 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
GO ?= go
GOFMT ?= gofmt "-s"
PACKAGES ?= $(shell $(GO) list ./...)
GOFILES := $(shell find . -name "*.go" -type f -not -path './vendor/*')
COMPOSECMD := docker-compose -f "docker-compose.yml" "up" -d
COMPOSEFILES_ACCEPTANCE_TESTING = -f tests/docker-compose.yml -f tests/docker-compose.acceptance.yml
.PHONY: all
all: fmt lint vet test
.PHONY: build
build:
$(GO) build -o bin/workflows .
.PHONY: test
test:
WORKFLOWS_MONGO_URL="mongodb://localhost" $(GO) test -cover -coverprofile=coverage.txt $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
.PHONY: test-short
test-short:
$(GO) test -cover -coverprofile=coverage.txt --short $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
.PHONY: fmt
fmt:
$(GOFMT) -w $(GOFILES)
.PHONY: docker
docker:
$(COMPOSECMD)
.PHONY: lint
lint:
for pkg in ${PACKAGES}; do \
golint -set_exit_status $$pkg || GOLINT_FAILED=1; \
done; \
[ -z "$$GOLINT_FAILED" ]
.PHONY: vet
vet:
$(GO) vet $(PACKAGES)
.PHONY: clean
clean:
$(GO) clean -modcache -x -i ./...
find . -name coverage.txt -delete
rm bin/*
.PHONY: acceptance-testing-up
acceptance-testing-up:
docker-compose $(COMPOSEFILES_ACCEPTANCE_TESTING) up --scale acceptance-testing=0 -d
.PHONY: acceptance-testing-run
acceptance-testing-run:
docker-compose $(COMPOSEFILES_ACCEPTANCE_TESTING) run --rm --no-deps acceptance-testing
.PHONY: acceptance-testing-logs
acceptance-testing-logs:
docker-compose $(COMPOSEFILES_ACCEPTANCE_TESTING) ps -a
docker-compose $(COMPOSEFILES_ACCEPTANCE_TESTING) logs
.PHONY: acceptance-testing-down
acceptance-testing-down:
docker-compose $(COMPOSEFILES_ACCEPTANCE_TESTING) down