build: bootstrap Go toolchain and generated APIs
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
SHELL := /bin/sh
|
||||
|
||||
COMPOSE := docker compose -f deploy/compose.yaml
|
||||
GO_PACKAGES := ./...
|
||||
|
||||
.PHONY: generate fmt lint test test-race test-coverage test-integration test-e2e test-status build verify \
|
||||
_toolchain-generate _toolchain-fmt _toolchain-lint _toolchain-test _toolchain-test-race \
|
||||
_toolchain-test-coverage _toolchain-build _toolchain-verify
|
||||
|
||||
ifeq ($(IN_TOOLCHAIN),1)
|
||||
generate: _toolchain-generate
|
||||
fmt: _toolchain-fmt
|
||||
lint: _toolchain-lint
|
||||
test: _toolchain-test
|
||||
test-race: _toolchain-test-race
|
||||
test-coverage: _toolchain-test-coverage
|
||||
build: _toolchain-build
|
||||
verify: _toolchain-verify
|
||||
else
|
||||
generate:
|
||||
$(COMPOSE) run --rm toolchain make generate
|
||||
fmt:
|
||||
$(COMPOSE) run --rm toolchain make fmt
|
||||
lint:
|
||||
$(COMPOSE) run --rm toolchain make lint
|
||||
test:
|
||||
$(COMPOSE) run --rm toolchain make test
|
||||
test-race:
|
||||
$(COMPOSE) run --rm toolchain make test-race
|
||||
test-coverage:
|
||||
$(COMPOSE) run --rm toolchain make test-coverage
|
||||
build:
|
||||
$(COMPOSE) run --rm toolchain make build
|
||||
verify:
|
||||
$(COMPOSE) run --rm toolchain make verify
|
||||
endif
|
||||
|
||||
test-integration:
|
||||
./scripts/test-integration
|
||||
|
||||
test-e2e:
|
||||
./scripts/test-e2e
|
||||
|
||||
test-status:
|
||||
./scripts/test-env status
|
||||
|
||||
_toolchain-generate:
|
||||
buf generate
|
||||
|
||||
_toolchain-fmt:
|
||||
test -z "$$(gofmt -l $$(find cmd internal test -name '*.go' -type f 2>/dev/null))"
|
||||
buf format --diff --exit-code
|
||||
|
||||
_toolchain-lint:
|
||||
./scripts/check-buf-lint
|
||||
go vet $(GO_PACKAGES)
|
||||
|
||||
_toolchain-test:
|
||||
go test -shuffle=on $(GO_PACKAGES)
|
||||
|
||||
_toolchain-test-race:
|
||||
go test -race -shuffle=on $(GO_PACKAGES)
|
||||
|
||||
_toolchain-test-coverage:
|
||||
mkdir -p coverage
|
||||
go test -shuffle=on -covermode=atomic -coverprofile=coverage/unit.out $(GO_PACKAGES)
|
||||
|
||||
_toolchain-build:
|
||||
mkdir -p bin
|
||||
CGO_ENABLED=0 GOOS=linux go build -trimpath -o bin/rvbox-server ./cmd/rvbox-server
|
||||
CGO_ENABLED=0 GOOS=linux go build -trimpath -o bin/rvc ./cmd/rvc
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -trimpath -o bin/rvbox.exe ./cmd/rvbox
|
||||
|
||||
_toolchain-verify: _toolchain-fmt _toolchain-lint _toolchain-test _toolchain-build
|
||||
git diff --exit-code -- gen/go
|
||||
|
||||
Reference in New Issue
Block a user