influxdb/Makefile

163 lines
4.1 KiB
Makefile
Raw Normal View History

2018-05-22 17:28:04 +00:00
# Top level Makefile for the entire project
#
# This Makefile encodes the "go generate" prerequeisites ensuring that the proper tooling is installed and
# that the generate steps are executed when their prerequeisites files change.
#
2018-05-22 17:28:04 +00:00
# This Makefile follows a few conventions:
#
# * All cmds must be added to this top level Makefile.
# * All binaries are placed in ./bin, its recommended to add this directory to your PATH.
# * Each package that has a need to run go generate, must have its own Makefile for that purpose.
# * All recursive Makefiles must support the all target
2018-05-22 17:28:04 +00:00
#
SUBDIRS := query task
2018-05-22 17:28:04 +00:00
GO_ARGS=-tags '$(GO_TAGS)'
# Test vars can be used by all recursive Makefiles
export GOOS=$(shell go env GOOS)
export GO_BUILD=env GO111MODULE=on go build $(GO_ARGS)
export GO_TEST=env GO111MODULE=on go test $(GO_ARGS)
# Do not add GO111MODULE=on to the call to go generate so it doesn't pollute the environment.
2018-05-22 17:28:04 +00:00
export GO_GENERATE=go generate $(GO_ARGS)
export GO_VET=env GO111MODULE=on go vet $(GO_ARGS)
export PATH := $(PWD)/bin/$(GOOS):$(PATH)
2018-05-22 17:28:04 +00:00
# All go source files
SOURCES := $(shell find . -name '*.go' -not -name '*_test.go')
# All go source files excluding the vendored sources.
SOURCES_NO_VENDOR := $(shell find . -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
# All assets for chronograf
UISOURCES := $(shell find ui -type f -not \( -path ui/build/\* -o -path ui/node_modules/\* -o -path ui/.cache/\* -o -name Makefile -prune \) )
# All precanned dashboards
PRECANNED := $(shell find chronograf/canned -name '*.json')
2018-05-22 17:28:04 +00:00
# List of binary cmds to build
CMDS := \
bin/$(GOOS)/influx \
bin/$(GOOS)/influxd
2018-05-22 17:28:04 +00:00
# Default target to build all go commands.
2018-05-22 17:28:04 +00:00
#
# This target sets up the dependencies to correctly build all go commands.
2018-05-22 17:28:04 +00:00
# Other targets must depend on this target to correctly builds CMDS.
all: GO_ARGS=-tags 'assets $(GO_TAGS)'
all: node_modules subdirs ui generate $(CMDS)
2018-05-22 17:28:04 +00:00
# Target to build subdirs.
# Each subdirs must support the `all` target.
subdirs: $(SUBDIRS)
@for d in $^; do $(MAKE) -C $$d all; done
2018-05-22 17:28:04 +00:00
ui:
$(MAKE) -C ui all
2018-05-22 17:28:04 +00:00
#
# Define targets for commands
#
$(CMDS): $(SOURCES)
$(GO_BUILD) -o $@ ./cmd/$(shell basename "$@")
2018-05-22 17:28:04 +00:00
#
# Define targets for the web ui
2018-05-22 17:28:04 +00:00
#
node_modules: ui/node_modules
chronograf_lint:
make -C ui lint
ui/node_modules:
make -C ui node_modules
ui/build:
mkdir -p ui/build
2018-05-22 17:28:04 +00:00
#
# Define action only targets
#
fmt: $(SOURCES_NO_VENDOR)
gofmt -w -s $^
checkfmt:
./etc/checkfmt.sh
2018-05-22 17:28:04 +00:00
tidy:
GO111MODULE=on go mod tidy
checktidy:
./etc/checktidy.sh
chronograf/dist/dist_gen.go: ui/build $(UISOURCES)
$(GO_GENERATE) ./chronograf/dist/...
chronograf/server/swagger_gen.go: chronograf/server/swagger.json
$(GO_GENERATE) ./chronograf/server/...
chronograf/canned/bin_gen.go: $(PRECANNED)
$(GO_GENERATE) ./chronograf/canned/...
2018-07-24 20:18:21 +00:00
generate: chronograf/dist/dist_gen.go chronograf/server/swagger_gen.go chronograf/canned/bin_gen.go
test-js: node_modules
make -C ui test
2018-07-24 20:18:21 +00:00
test-go:
2018-05-22 17:28:04 +00:00
$(GO_TEST) ./...
feat(vault): add vault implementation of secret service test(platform): run testcontainer integration tests for nightly release Integration tests for the vault secret service using testcontiners should not run along with unit tests, however, they should run on some regular schedule. This commit introduces `make test-integration` which runs integration tests for vault using testcontainers. The command introduced relies on docker being available on the host it is executed on. chore(platform): make go modules tidy chore: try to fix go mod chore(platform): remove explicit logrus dependency chore(platform): run go mod tidy chore(platform): replace github.com/Sirupsen/logrus with github.com/sirupsen/logrus chore(platform): update docker dependency feat(vault): add vault implementation of secret service test(platform): run testcontainer integration tests for nightly release Integration tests for the vault secret service using testcontiners should not run along with unit tests, however, they should run on some regular schedule. This commit introduces `make test-integration` which runs integration tests for vault using testcontainers. The command introduced relies on docker being available on the host it is executed on. chore(platform): make go modules tidy chore: try to fix go mod chore(platform): run go mod tidy feat(vault): add vault implementation of secret service chore(platform): make go modules tidy feat(platform): add Put/Patch/Delete methods on secret service feat(vault): add Put/Patch/Delete methods on vault secret service feat(http): add http handler methods for secret service feat(bolt): add Put/Delete/Patch methods to bolt secret service feat(testing): add tests for Put/Patch/Delete methods in secret service feat(mock): add mock secret service feat(http): add tests for secrets endpoints feat(http): update swagger for secrets endpoints chore: run go mod tidy
2018-11-16 16:45:00 +00:00
test-integration: GO_TAGS=integration
test-integration:
$(GO_TEST) -count=1 ./...
test: test-go test-js
test-go-race:
$(GO_TEST) -race -count=1 ./...
2018-05-22 17:28:04 +00:00
vet:
2018-05-22 22:19:04 +00:00
$(GO_VET) -v ./...
bench:
2018-05-22 17:28:04 +00:00
$(GO_TEST) -bench=. -run=^$$ ./...
nightly: all
env GO111MODULE=on go run github.com/goreleaser/goreleaser --snapshot --rm-dist --publish-snapshots
clean:
$(MAKE) -C ui $(MAKECMDGOALS)
2018-05-22 17:28:04 +00:00
rm -rf bin
define CHRONOGIRAFFE
._ o o
\_`-)|_
,"" _\_
," ## | 0 0.
," ## ,-\__ `.
," / `--._;) - "HAI, I'm Chronogiraffe. Let's be friends!"
," ## /
," ## /
endef
export CHRONOGIRAFFE
chronogiraffe: subdirs generate $(CMDS)
@echo "$$CHRONOGIRAFFE"
run: chronogiraffe
./bin/$(GOOS)/influxd --developer-mode=true
generate-typescript-client:
cat http/cur_swagger.yml | yq read -j - > openapi.json
openapi-generator generate -g typescript-axios -o ui/src/api -i openapi.json
rm openapi.json
2018-05-22 17:28:04 +00:00
# .PHONY targets represent actions that do not create an actual file.
.PHONY: all subdirs $(SUBDIRS) ui run fmt checkfmt tidy checktidy test test-go test-js test-go-race bench clean node_modules vet nightly chronogiraffe