2024-12-15 08:39:18 +00:00
|
|
|
GOLANGCI_LINT := go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
|
|
|
|
SWAG := go run github.com/swaggo/swag/cmd/swag@v1.16.4
|
2024-12-15 06:36:33 +00:00
|
|
|
|
2024-12-24 19:40:37 +00:00
|
|
|
GIT_VERSION = $(shell git describe --tags)
|
|
|
|
APP_VERSION ?= $(GIT_VERSION)
|
|
|
|
DOCKER_TAG ?= $(APP_VERSION)
|
|
|
|
|
2024-12-15 06:36:33 +00:00
|
|
|
format:
|
2024-12-17 15:48:10 +00:00
|
|
|
@echo "🛠️ Format and Lint code with golangci-lint"
|
|
|
|
$(GOLANGCI_LINT) run
|
|
|
|
$(SWAG) fmt
|
|
|
|
@echo "✅ Format and Lint done."
|
|
|
|
|
|
|
|
format-fix:
|
2024-12-15 08:39:18 +00:00
|
|
|
@echo "🛠️ Format and Lint code with golangci-lint"
|
|
|
|
$(GOLANGCI_LINT) run --fix
|
|
|
|
$(SWAG) fmt
|
|
|
|
@echo "✅ Format and Lint done."
|
2024-12-15 06:36:33 +00:00
|
|
|
|
2024-12-15 08:39:18 +00:00
|
|
|
swag:
|
|
|
|
$(SWAG) init -g cmd/aides-repo-api/main.go
|
|
|
|
|
2024-12-17 15:48:10 +00:00
|
|
|
build:
|
|
|
|
go build \
|
2025-01-07 14:54:16 +00:00
|
|
|
-ldflags="-X 'code.aides.space/aides-infra/aides-repo-api/internal/config.Version=$(APP_VERSION)'" \
|
2024-12-17 15:48:10 +00:00
|
|
|
-o aides-repo-api \
|
|
|
|
./cmd/aides-repo-api/main.go
|
|
|
|
|
2024-12-17 16:28:37 +00:00
|
|
|
release:
|
|
|
|
go build \
|
2025-01-07 14:54:16 +00:00
|
|
|
-ldflags="-s -w -X 'code.aides.space/aides-infra/aides-repo-api/internal/config.Version=$(APP_VERSION)'" \
|
2024-12-17 16:28:37 +00:00
|
|
|
-o aides-repo-api \
|
|
|
|
./cmd/aides-repo-api/main.go
|
|
|
|
|
2024-12-17 15:48:10 +00:00
|
|
|
build-docker:
|
2024-12-24 19:40:37 +00:00
|
|
|
docker build \
|
|
|
|
--build-arg APP_VERSION=${APP_VERSION} \
|
|
|
|
-t ghcr.io/aides-infra/aides-repo-api:${DOCKER_TAG}\
|
|
|
|
.
|
2024-12-17 15:48:10 +00:00
|
|
|
|
2024-12-26 13:42:54 +00:00
|
|
|
test-coverage:
|
|
|
|
go test ./... -v -coverpkg=./... -coverprofile=coverage.out
|
|
|
|
bash scripts/coverage-badge.sh
|