forked from murtll/terraform-provider-regru
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (60 loc) · 1.86 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Версия провайдера
VERSION := 0.2.1
# Определение пути для установки плагина
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
PLUGIN_DIR := $(HOME)/.terraform.d/plugins/registry.terraform.io/letenkov/regru/$(VERSION)/$(OS_ARCH)
PLUGIN_NAME := terraform-provider-regru_v$(VERSION)
BUILD_OUTPUT := $(PLUGIN_DIR)/$(PLUGIN_NAME)
# Компиляция и установка провайдера
.PHONY: build
build:
@echo "Building Terraform provider..."
mkdir -p $(PLUGIN_DIR)
go build -o $(BUILD_OUTPUT)
@echo "Build completed and installed at $(BUILD_OUTPUT)"
# Получение версии Go из go.mod
.PHONY: go-version
go-version:
@grep ^go go.mod | awk '{ print $$2 }'
# Запуск тестов
.PHONY: test
test:
@echo "Running tests..."
go test ./... -v
@echo "Tests completed"
# Форматирование кода
.PHONY: fmt
fmt:
@echo "Formatting code..."
go fmt ./...
@echo "Code formatted"
# Линтинг кода
.PHONY: lint
lint:
@echo "Linting code..."
go vet ./...
@echo "Linting completed"
# Очистка сборочных артефактов
.PHONY: clean
clean:
@echo "Cleaning up..."
rm -f $(BUILD_OUTPUT)
@echo "Cleanup completed"
# Установка всех зависимостей
.PHONY: install-deps
install-deps:
@echo "Installing dependencies..."
go mod tidy
@echo "Dependencies installed"
# Помощь
.PHONY: help
help:
@echo "Usage:"
@echo " make build Build and install the Terraform provider"
@echo " make go-version Get the Go version from go.mod"
@echo " make test Run tests"
@echo " make fmt Format the code"
@echo " make lint Lint the code"
@echo " make clean Clean up build artifacts"
@echo " make install-deps Install all dependencies"
@echo " make help Display this help message"