-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (57 loc) · 1.85 KB
/
Makefile
File metadata and controls
65 lines (57 loc) · 1.85 KB
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
65
SHELL=/bin/bash -euo pipefail
.PHONY: all
all: clean format lint install lock unittest
.PHONY: format
format:
@echo "running format target..."
@echo "running gofmt..."
@gofmt -s -w -l .
@echo "gofmt passed!"
@echo "format target passed!"
.PHONY: lint
lint:
@echo "running lint target..."
@echo "running shellcheck..."
@find . -name '*.sh' -print0 | xargs -n1 -0 shellcheck
@echo "shellcheck passed!"
@echo "running gofmt (without persisting modifications)..."
@[[ $$(gofmt -s -l . | wc -c) -eq 0 ]];
@echo "gofmt passed!"
@echo "running golangci-lint..."
@golangci-lint run --timeout 5m0s
@echo "golangci-lint passed!"
@echo "lint target passed!"
.PHONY: install
install:
@echo "running install target..."
@echo "installing docker-lock into docker's cli-plugins folder..."
@mkdir -p "$${HOME}/.docker/cli-plugins"
@CGO_ENABLED=0 go build -o "$${HOME}/.docker/cli-plugins" ./cmd/docker-lock
@echo "installation passed!"
@echo "install target passed!"
.PHONY: lock
lock:
@echo "running docker lock generate..."
@test -e "$${HOME}/.docker/cli-plugins/docker-lock" || (echo "failed - please run 'make install' first"; exit 1)
@docker lock generate
@echo "docker lock generate passed!"
.PHONY: unittest
unittest:
@echo "running unittest target..."
@echo "running go test's unit tests, writing coverage output to coverage.html..."
@go test -race ./... -v -count=1 -coverprofile=coverage.out
@go tool cover -html=coverage.out -o coverage.html
@echo "go test passed!"
@echo "unittest target passed!"
.PHONY: clean
clean:
@echo "running clean target..."
@echo "removing docker-lock from docker's cli-plugins folder..."
@rm -f "$${HOME}"/.docker/cli-plugins/docker-lock*
@echo "removing passed!"
@echo "clean target passed!"
.PHONY: inttest
inttest: clean install
@echo "running inttest target..."
@./test/demo-app/tests.sh
@echo "inttest target passed!"