-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
115 lines (99 loc) · 2.13 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File generated by cdo from CONTRIBUTING.md; DO NOT EDIT.
SHELL=bash
.SHELLFLAGS=-e -o pipefail -c
.PHONY: __help__
__help__:
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@echo ' all Clean build'
@echo ' build Build the executable binary'
@echo ' clean Clean the working directory'
@echo ' coverage View the test coverage report'
@echo ' docker Building a Docker image'
@echo ' examples Run examples'
@echo ' format Format the go source codes'
@echo ' lint Run the linter'
@echo ' makefile Generate the Makefile'
@echo ' readme Update README.md'
@echo ' snapshot Create the executable binary with a snapshot version'
@echo ' test Run the tests'
@echo ' tools Install the required tools'
# Clean build
.PHONY: all
all: clean makefile format lint test build snapshot readme examples docker
# Build the executable binary
.PHONY: build
build:
@(\
go build -ldflags="-w -s" -o build/k6exec ./cmd/k6exec;\
)
# Clean the working directory
.PHONY: clean
clean:
@(\
rm -rf ./coverage.txt ./build;\
)
# View the test coverage report
.PHONY: coverage
coverage: test
@(\
go tool cover -html=coverage.txt;\
)
# Building a Docker image
.PHONY: docker
docker:
@(\
docker build -t k6exec -f Dockerfile.goreleaser build;\
)
# Run examples
.PHONY: examples
examples:
@(\
find examples -type f | xargs -n 1 ./build/k6exec run;\
)
# Format the go source codes
.PHONY: format
format:
@(\
go fmt ./...;\
)
# Run the linter
.PHONY: lint
lint:
@(\
golangci-lint run ./...;\
)
# Generate the Makefile
.PHONY: makefile
makefile:
@(\
cdo --makefile Makefile;\
)
# Update README.md
.PHONY: readme
readme:
@(\
go run ./tools/gendoc README.md;\
mdcode update;\
)
# Create the executable binary with a snapshot version
.PHONY: snapshot
snapshot:
@(\
goreleaser build --snapshot --clean --single-target -o build/k6exec;\
)
# Run the tests
.PHONY: test
test:
@(\
go test -count 1 -race -coverprofile=coverage.txt -timeout 60s ./...;\
)
# Install the required tools
.PHONY: tools
tools:
@(\
eget szkiba/mdcode;\
eget golangci/golangci-lint;\
eget oven-sh/bun;\
)