All checks were successful
Implement a stateless Go service that routes /api/v1/send_push and /api/v1/ack by platform prefix to configured backends, enabling mixed official and custom mobile clients on a single PushNotificationServer URL. Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.1 KiB
Makefile
70 lines
2.1 KiB
Makefile
PROJECT_NAME := mattermost-push-proxy-router
|
|
CGO_ENABLED ?= 0
|
|
PORT ?= 8066
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
LDFLAGS := -X main.version=$(VERSION)
|
|
|
|
GOLANGCI_LINT_VERSION := v2.12.2
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
## help: Display this help message
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /' | sort
|
|
|
|
# ── Build ────────────────────────────────────────────────────────
|
|
|
|
## build: Build the production binary
|
|
.PHONY: build
|
|
build:
|
|
CGO_ENABLED=$(CGO_ENABLED) go build -ldflags "$(LDFLAGS)" -o $(PROJECT_NAME) .
|
|
|
|
## build-snapshot: Build all platforms locally via goreleaser (snapshot)
|
|
.PHONY: build-snapshot
|
|
build-snapshot:
|
|
goreleaser build --snapshot --clean
|
|
|
|
# ── Development ──────────────────────────────────────────────────
|
|
|
|
## dev: Run the router locally
|
|
.PHONY: dev
|
|
dev:
|
|
go run .
|
|
|
|
## serve: Build and run the production server
|
|
.PHONY: serve
|
|
serve: build
|
|
./$(PROJECT_NAME)
|
|
|
|
# ── Quality ──────────────────────────────────────────────────────
|
|
|
|
## test: Run unit tests
|
|
.PHONY: test
|
|
test:
|
|
go test ./...
|
|
|
|
## format: Format code and tidy modules
|
|
.PHONY: format
|
|
format:
|
|
go fmt ./...
|
|
go mod tidy
|
|
|
|
## ci-lint: Run linter (auto-installs golangci-lint for CI)
|
|
.PHONY: ci-lint
|
|
ci-lint:
|
|
@which golangci-lint > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
|
golangci-lint run ./...
|
|
|
|
## lint: Run linters
|
|
.PHONY: lint
|
|
lint: ci-lint
|
|
|
|
# ── Cleanup ──────────────────────────────────────────────────────
|
|
|
|
## clean: Remove build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f $(PROJECT_NAME) $(PROJECT_NAME)-*
|
|
rm -rf dist/
|