forked from elastic/elastic-package
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
128 lines (89 loc) · 4.35 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
CODE_COVERAGE_REPORT_FOLDER = $(PWD)/build/test-coverage
CODE_COVERAGE_REPORT_NAME_UNIT = $(CODE_COVERAGE_REPORT_FOLDER)/coverage-unit-report
VERSION_IMPORT_PATH = github.com/elastic/elastic-package/internal/version
VERSION_COMMIT_HASH = `git describe --always --long --dirty`
VERSION_BUILD_TIME = `date +%s`
DEFAULT_VERSION_TAG ?=
VERSION_TAG = `(git describe --exact-match --tags 2>/dev/null || echo '$(DEFAULT_VERSION_TAG)') | tr -d '\n'`
VERSION_LDFLAGS = -X $(VERSION_IMPORT_PATH).CommitHash=$(VERSION_COMMIT_HASH) -X $(VERSION_IMPORT_PATH).BuildTime=$(VERSION_BUILD_TIME) -X $(VERSION_IMPORT_PATH).Tag=$(VERSION_TAG)
.PHONY: build
build:
go build -ldflags "$(VERSION_LDFLAGS)" -o elastic-package
clean:
rm -rf build
rm -f elastic-package
format:
go run golang.org/x/tools/cmd/goimports -local github.com/elastic/elastic-package/ -w .
install:
go install -ldflags "$(VERSION_LDFLAGS)" github.com/elastic/elastic-package
lint:
go run honnef.co/go/tools/cmd/staticcheck ./...
licenser:
go run github.com/elastic/go-licenser -license Elastic
gomod:
go mod tidy
update-readme:
cd tools/readme; go run main.go
update: update-readme
$(CODE_COVERAGE_REPORT_FOLDER):
mkdir -p $@
test-go: $(CODE_COVERAGE_REPORT_FOLDER)
# -count=1 is included to invalidate the test cache. This way, if you run "make test-go" multiple times
# you will get fresh test results each time. For instance, changing the source of mocked packages
# does not invalidate the cache so having the -count=1 to invalidate the test cache is useful.
go run gotest.tools/gotestsum --format standard-verbose -- -count 1 -coverprofile=$(CODE_COVERAGE_REPORT_NAME_UNIT).out ./...
test-go-ci: $(CODE_COVERAGE_REPORT_FOLDER)
mkdir -p $(PWD)/build/test-results
mkdir -p $(PWD)/build/test-coverage
go run gotest.tools/gotestsum --junitfile "$(PWD)/build/test-results/TEST-unit.xml" -- -count=1 -coverprofile=$(CODE_COVERAGE_REPORT_NAME_UNIT).out ./...
go run github.com/boumenot/gocover-cobertura < $(CODE_COVERAGE_REPORT_NAME_UNIT).out > $(CODE_COVERAGE_REPORT_NAME_UNIT).xml
test-stack-command-default:
./scripts/test-stack-command.sh
# Oldest minor where fleet is GA.
test-stack-command-oldest:
./scripts/test-stack-command.sh 7.14.2
test-stack-command-7x:
./scripts/test-stack-command.sh 7.17.19
# Keeping a test for 8.6 because it has an specific configuration file.
test-stack-command-86:
./scripts/test-stack-command.sh 8.6.2
test-stack-command-8x:
./scripts/test-stack-command.sh 8.15.0-ee2f4d91-SNAPSHOT
test-stack-command-with-apm-server:
APM_SERVER_ENABLED=true ./scripts/test-stack-command.sh
test-stack-command-with-self-monitor:
SELF_MONITOR_ENABLED=true ./scripts/test-stack-command.sh
test-stack-command: test-stack-command-default test-stack-command-7x test-stack-command-800 test-stack-command-8x test-stack-command-with-apm-server
test-check-packages: test-check-packages-with-kind test-check-packages-other test-check-packages-parallel test-check-packages-with-custom-agent test-check-packages-benchmarks test-check-packages-false-positives test-check-packages-with-logstash
test-check-packages-with-kind:
PACKAGE_TEST_TYPE=with-kind ./scripts/test-check-packages.sh
test-check-packages-other:
PACKAGE_TEST_TYPE=other ./scripts/test-check-packages.sh
test-check-packages-false-positives:
PACKAGE_TEST_TYPE=false_positives ./scripts/test-check-false-positives.sh
test-check-packages-with-logstash:
PACKAGE_TEST_TYPE=with-logstash ./scripts/test-check-packages.sh
test-check-packages-benchmarks:
PACKAGE_TEST_TYPE=benchmarks ./scripts/test-check-packages.sh
test-check-packages-parallel:
PACKAGE_TEST_TYPE=parallel ./scripts/test-check-packages.sh
test-check-packages-with-custom-agent:
PACKAGE_TEST_TYPE=with-custom-agent ./scripts/test-check-packages.sh
test-build-zip:
./scripts/test-build-zip.sh
test-install-zip:
./scripts/test-install-zip.sh
test-install-zip-shellinit:
./scripts/test-install-zip.sh -s
test-system-test-flags:
./scripts/test-system-test-flags.sh
test-profiles-command:
./scripts/test-profiles-command.sh
test-check-update-version:
./scripts/test-check-update-version.sh
test: test-go test-stack-command test-check-packages test-profiles-command test-build-zip test-check-update-version
check-git-clean:
git update-index --really-refresh
git diff-index --quiet HEAD
check: check-static test check-git-clean
check-static: build format lint licenser gomod update check-git-clean