From a3d710f4fe8786e80f0308896781486bf30d21a1 Mon Sep 17 00:00:00 2001 From: Zhenzhen Zhao Date: Thu, 17 Feb 2022 22:29:13 +0800 Subject: [PATCH] fix(goreleaser): build with git version info (#53) * test(huobi): add huobi e2e tests * fix(goreleaser): build with git version info --- .goreleaser.yml | 5 ++++- Makefile | 14 +++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index fd8f27a..f6d9e04 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -6,10 +6,13 @@ before: builds: - env: - CGO_ENABLED=0 + binary: double-entry-generator goos: - linux - windows - darwin + ldflags: + - -s -w -X github.com/deb-sig/double-entry-generator/pkg/version.VERSION={{.Version}} -X github.com/deb-sig/double-entry-generator/pkg/version.REPOROOT=github.com/deb-sig/double-entry-generator -X github.com/deb-sig/double-entry-generator/pkg/version.COMMIT={{.ShortCommit}} archives: - replacements: darwin: Darwin @@ -20,7 +23,7 @@ archives: checksum: name_template: 'checksums.txt' snapshot: - name_template: "{{ .Tag }}-next" + name_template: "{{ .Version }}-SNAPSHOT" changelog: sort: asc filters: diff --git a/Makefile b/Makefile index 3513119..105cbc7 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ BIN_DIR := $(GOPATH)/bin GOLANGCI_LINT := $(BIN_DIR)/golangci-lint # All targets. -.PHONY: lint test build container push help clean test-go test-wechat test-alipay format check-format +.PHONY: lint test build container push help clean test-go test-wechat test-alipay test-huobi test-htsec format check-format goreleaser-build-test help: ## Display this help @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) @@ -65,9 +65,11 @@ install: build ## Install the double-entry-generator binary clean: ## Clean all the temporary files @rm -rf ./bin + @rm -rf ./dist @rm -rf ./test/output + @rm -rf ./double-entry-generator -test: test-go test-alipay test-wechat test-htsec ## Run all tests +test: test-go test-alipay test-wechat test-huobi test-htsec ## Run all tests test-go: ## Run Golang tests @go test ./... @@ -78,6 +80,9 @@ test-alipay: ## Run tests for Alipay provider test-wechat: ## Run tests for WeChat provider @$(SHELL) ./test/wechat-test.sh +test-huobi: ## Run tests for huobi provider + @$(SHELL) ./test/huobi-test.sh + test-htsec: ## Run tests for htsec provider @$(SHELL) ./test/htsec-test.sh @@ -85,4 +90,7 @@ format: ## Format code @gofmt -s -w pkg check-format: ## Check if the format looks good. - @go fmt ./... \ No newline at end of file + @go fmt ./... + +goreleaser-build-test: ## Goreleaser build for testing + goreleaser build --single-target --snapshot --rm-dist