2019-04-13 03:05:11 +02:00
|
|
|
.PHONY: build install compile test e2e doc fmt lint vet release
|
2022-01-12 23:52:07 +02:00
|
|
|
export CGO_ENABLED=0
|
2018-09-18 22:42:38 +02:00
|
|
|
|
2023-03-28 19:35:56 +02:00
|
|
|
LAB_BIN ?= lab
|
2018-09-18 22:42:38 +02:00
|
|
|
DIR_BIN = ./bin
|
|
|
|
DIR_PKG = ./pkg
|
2018-10-14 21:38:14 +02:00
|
|
|
DIR_E2E = ./e2e
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
default: build
|
|
|
|
|
2019-03-27 23:24:49 +02:00
|
|
|
build: vet generate test compile
|
2018-09-18 22:42:38 +02:00
|
|
|
|
2023-02-07 19:58:43 +02:00
|
|
|
install-tools:
|
|
|
|
go install honnef.co/go/tools/cmd/staticcheck@latest && \
|
|
|
|
go install golang.org/x/tools/cmd/goimports@latest && \
|
|
|
|
go install github.com/mgechev/revive@latest
|
|
|
|
|
2019-04-13 03:05:11 +02:00
|
|
|
install:
|
|
|
|
go get
|
|
|
|
|
2018-09-26 03:49:42 +02:00
|
|
|
compile:
|
2022-01-12 23:52:07 +02:00
|
|
|
go build -v -o ${DIR_BIN}/ferret \
|
2021-04-09 00:46:17 +02:00
|
|
|
${DIR_E2E}/cli.go
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
test:
|
2022-01-12 23:52:07 +02:00
|
|
|
go test ${DIR_PKG}/...
|
2018-10-17 02:50:06 +02:00
|
|
|
|
|
|
|
cover:
|
2022-01-12 23:52:07 +02:00
|
|
|
go test -coverprofile=coverage.txt -covermode=atomic ${DIR_PKG}/... && \
|
2018-10-26 04:13:41 +02:00
|
|
|
curl -s https://codecov.io/bash | bash
|
2018-09-18 22:42:38 +02:00
|
|
|
|
2018-10-14 21:38:14 +02:00
|
|
|
e2e:
|
2023-03-28 19:35:56 +02:00
|
|
|
${LAB_BIN} --timeout=120 --attempts=5 --concurrency=1 --wait=http://127.0.0.1:9222/json/version --runtime=bin://./bin/ferret --files=./e2e/tests --cdn=./e2e/pages/dynamic --cdn=./e2e/pages/static
|
2018-10-14 21:38:14 +02:00
|
|
|
|
2018-10-25 01:40:57 +02:00
|
|
|
bench:
|
|
|
|
go test -run=XXX -bench=. ${DIR_PKG}/...
|
|
|
|
|
2018-09-18 22:42:38 +02:00
|
|
|
generate:
|
2018-09-27 23:03:49 +02:00
|
|
|
go generate ${DIR_PKG}/...
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
doc:
|
|
|
|
godoc -http=:6060 -index
|
|
|
|
|
|
|
|
# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
|
|
|
|
fmt:
|
2023-02-07 19:58:43 +02:00
|
|
|
go fmt ${DIR_PKG}/... && \
|
|
|
|
goimports -w -local github.com/MontFerret ./pkg ./e2e
|
2018-09-18 22:42:38 +02:00
|
|
|
|
2018-10-06 00:59:42 +02:00
|
|
|
# https://github.com/mgechev/revive
|
|
|
|
# go get github.com/mgechev/revive
|
2018-09-18 22:42:38 +02:00
|
|
|
lint:
|
2023-02-07 19:58:43 +02:00
|
|
|
staticcheck ./pkg/compiler ./pkg/drivers ./pkg/runtime ./pkg/stdlib && \
|
2019-09-05 04:57:46 +02:00
|
|
|
revive -config revive.toml -formatter stylish -exclude ./pkg/parser/fql/... -exclude ./vendor/... ./...
|
2018-09-18 22:42:38 +02:00
|
|
|
|
|
|
|
# http://godoc.org/code.google.com/p/go.tools/cmd/vet
|
|
|
|
# go get code.google.com/p/go.tools/cmd/vet
|
|
|
|
vet:
|
2021-04-09 00:46:17 +02:00
|
|
|
go vet ${DIR_PKG}/...
|