78 lines
2.1 KiB
Makefile
78 lines
2.1 KiB
Makefile
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:
|
|
@test -n "$(RUN_ID)" || (echo "RUN_ID is required" >&2; exit 2)
|
|
./scripts/test-env status --run-id "$(RUN_ID)"
|
|
|
|
_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 run ./test/harness coverage
|
|
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 -ldflags '-H=windowsgui' -o bin/rvbox.exe ./cmd/rvbox
|
|
|
|
_toolchain-verify: _toolchain-fmt _toolchain-lint _toolchain-test _toolchain-build
|
|
git diff --exit-code -- gen/go
|