laconicd/Makefile
Prathamesh Musale 213c390c37
Some checks failed
Integration Tests / test-integration (push) Successful in 2m48s
E2E Tests / test-e2e (push) Successful in 4m56s
Lint / Run golangci-lint (push) Successful in 5m6s
Unit Tests / test-unit (push) Successful in 3m22s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 10m40s
SDK Tests / sdk_tests (push) Successful in 10m55s
SDK Tests / sdk_tests_auctions (push) Failing after 16m7s
Rename laconic2d to laconicd (#26)
Part of https://www.notion.so/Rename-laconic2d-to-laconicd-9028d0c020d24d1288e92ebcb773d7a7

Co-authored-by: neeraj <neeraj.rtly@gmail.com>
Reviewed-on: cerc-io/laconic2d#26
Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
2024-04-01 09:57:26 +00:00

109 lines
2.5 KiB
Makefile

#!/usr/bin/make -f
DOCKER := $(shell which docker)
LACONIC_BINARY = laconicd
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
# Update the ldflags with the app, client & server names
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=laconic \
-X github.com/cosmos/cosmos-sdk/version.AppName=$(LACONIC_BINARY) \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT)
BUILD_FLAGS := -ldflags '$(ldflags)'
BUILDDIR ?= $(CURDIR)/build
###########
# Install #
###########
go.sum: go.mod
echo "Ensure dependencies have not been modified ..." >&2
go mod verify
go mod tidy
BUILD_TARGETS := build install
build: BUILD_ARGS=-o $(BUILDDIR)/
build-linux:
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
@echo "--> installing laconicd"
go $@ $(BUILD_FLAGS) $(BUILD_ARGS) ./...
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
all: install
.PHONY: build build-linux install
##################
### Protobuf ###
##################
protoVer=0.14.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
proto-all: proto-format proto-lint proto-gen
proto-gen:
@echo "Generating protobuf files..."
@$(protoImage) sh ./scripts/protocgen.sh
@go mod tidy
proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
proto-lint:
@$(protoImage) buf lint proto/ --error-format=json
.PHONY: proto-all proto-gen proto-format proto-lint
#################
### Linting ###
#################
golangci_lint_cmd=golangci-lint
golangci_version=v1.51.2
lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run ./... --timeout 15m
lint-fix:
@echo "--> Running linter and fixing issues"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run ./... --fix --timeout 15m
.PHONY: lint lint-fix
#################
### Tests ###
#################
test-integration:
$(MAKE) -C tests test-integration
test-e2e:
$(MAKE) -C tests test-e2e
test-unit:
go test ./utils/... ./cmd/... -mod=readonly -test.v