Cleanup make targets

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-11-30 23:59:20 +01:00
parent 0b13fb19e7
commit 4cbb4810ad

View File

@@ -29,6 +29,9 @@ GO_VET= $(GO_BASE) vet
TEST_FLAGS?= -race -cover -coverprofile=coverage.out
E2E_CONFIG ?= $(CURDIR)/e2e/console/testdata/config.yaml
E2E_COVER_DIR ?= $(CURDIR)/coverage/e2e
DOCKER_IMAGE_NAME= ghcr.io/getprobo/probo
DOCKER_TAG_NAME?= latest
@@ -72,43 +75,29 @@ test-bench: TEST_FLAGS+=-bench=.
test-bench: test ## Run benchmark tests
.PHONY: test-e2e
test-e2e: E2E_CONFIG?=$(CURDIR)/e2e/console/testdata/config.yaml
test-e2e: CGO_ENABLED=1
test-e2e: ## Run console e2e tests
@echo "Building probod binary..."
CGO_ENABLED=0 $(GO) build $(LDFLAGS) $(GCFLAGS) -o bin/probod-e2e ./cmd/probod
@echo "Running e2e tests..."
PROBO_E2E_BINARY=$(CURDIR)/bin/probod-e2e \
test-e2e: bin/probod ## Run console e2e tests
PROBO_E2E_BINARY=$(CURDIR)/bin/probod \
PROBO_E2E_CONFIG=$(E2E_CONFIG) \
CGO_ENABLED=1 $(GO) test -count=1 -v ./e2e/console/...
bin/probod-coverage:
CGO_ENABLED=0 $(GO_BUILD) -cover -o $@ $(PROBOD_SRC)
.PHONY: test-e2e-coverage
test-e2e-coverage: E2E_COVER_DIR?=$(CURDIR)/coverage/e2e
test-e2e-coverage: E2E_CONFIG?=$(CURDIR)/e2e/console/testdata/config.yaml
test-e2e-coverage: CGO_ENABLED=1
test-e2e-coverage: ## Build coverage binary and run e2e tests with coverage
@echo "Building coverage-instrumented binary..."
CGO_ENABLED=0 $(GO) build $(LDFLAGS) $(GCFLAGS) -cover -o bin/probod-coverage ./cmd/probod
@$(RM) -rf $(E2E_COVER_DIR)
@$(MKDIR) -p $(E2E_COVER_DIR)
@echo "Running e2e tests with coverage..."
test-e2e-coverage: bin/probod-coverage ## Run e2e tests with coverage
@$(RM) -rf $(E2E_COVER_DIR) && $(MKDIR) -p $(E2E_COVER_DIR)
PROBO_E2E_BINARY=$(CURDIR)/bin/probod-coverage \
PROBO_E2E_COVERDIR=$(E2E_COVER_DIR) \
PROBO_E2E_CONFIG=$(E2E_CONFIG) \
CGO_ENABLED=1 $(GO) test -count=1 -v ./e2e/console/...
@echo "Generating coverage report..."
$(GO) tool covdata textfmt -i=$(E2E_COVER_DIR) -o=coverage-e2e.out
$(GO) tool cover -html=coverage-e2e.out -o=coverage-e2e.html
@echo "E2E coverage report generated: coverage-e2e.html"
.PHONY: coverage-combined
coverage-combined: E2E_COVER_DIR?=./coverage/e2e
coverage-combined: coverage-report test-e2e-coverage ## Generate combined coverage report (unit + e2e)
@echo "Merging coverage reports..."
@cat coverage.out > coverage-combined.out
@tail -n +2 coverage-e2e.out >> coverage-combined.out
$(GO) tool cover -html=coverage-combined.out -o=coverage-combined.html
@echo "Combined coverage report generated: coverage-combined.html"
.PHONY: build
build: @probo/emails @probo/console @probo/trust bin/probod