diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff49cce..e71699d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,7 +49,7 @@ jobs: go mod download - name: Run CI lint - run: make lint + run: sh helper/golint.sh - name: Run test cover run: sh helper/test-cover.sh diff --git a/.gitignore b/.gitignore index 07212df..3235773 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ dist default.etcd */**/*.bolt bench/bench +helper/bench/bench +helper/qs/qs # Output file of unit test coverage coverage.* profile.* diff --git a/Makefile b/Makefile deleted file mode 100644 index 7907302..0000000 --- a/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# The old school Makefile, following are required targets. The Makefile is written -# to allow building multiple binaries. You are free to add more targets or change -# existing implementations, as long as the semantics are preserved. -# -# make - default to 'build' target -# make lint - code analysis -# make test - run unit test (or plus integration test) -# make clean - clean up targets -# -# -# The makefile is also responsible to populate project version information. -# - -# -# Tweak the variables based on your project. -# - - -# -# These variables should not need tweaking. -# - -# It's necessary to set this because some environments don't link sh -> bash. -export SHELL := /bin/bash - -# It's necessary to set the errexit flags for the bash shell. -export SHELLOPTS := errexit - -# Project output directory. -OUTPUT_DIR := ./bin - -# Current version of the project. -VERSION ?= $(shell git describe --tags --always --dirty) -BRANCH ?= $(shell git branch | grep \* | cut -d ' ' -f2) -GITCOMMIT ?= $(shell git rev-parse HEAD) -GITTREESTATE ?= $(if $(shell git status --porcelain),dirty,clean) -BUILDDATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") -appVersion ?= $(VERSION) - - -# Track code version with Docker Label. -DOCKER_LABELS ?= git-describe="$(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty)" - -# Golang standard bin directory. -GOPATH ?= $(shell go env GOPATH) -BIN_DIR := $(GOPATH)/bin -GOLANGCI_LINT := $(BIN_DIR)/golangci-lint - -# Default golang flags used in build and test -# -count: run each test and benchmark 1 times. Set this flag to disable test cache -export GOFLAGS ?= -count=1 - -# -# Define all targets. At least the following commands are required: -# - -# All targets. -.PHONY: lint test - -# more info about `GOGC` env: https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint -lint: $(GOLANGCI_LINT) $(HELM_LINT) - @$(GOLANGCI_LINT) run - -$(GOLANGCI_LINT): - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(BIN_DIR) v1.41.0 - -test: - @go test -v -race -gcflags=-l -coverpkg=./... -coverprofile=coverage.out.tmp ./... - @go tool cover -func coverage.out | tail -n 1 | awk '{ print "Total coverage: " $$3 }' - -.PHONY: clean -clean: - @-rm -vrf ${OUTPUT_DIR} output coverage.out coverage.out.tmp - diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 96b6d78..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,31 +0,0 @@ -version: '3.3' -services: - api: - image: 'yedf/dtm' - environment: - IS_DOCKER: '1' - ports: - - '36789:36789' - - '36790:36790' - volumes: - - .:/app/work - - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - command: ['/app/dtm/main', 'dev'] - working_dir: /app/work - extra_hosts: - - 'host.docker.internal:host-gateway' - db: - image: 'mysql:5.7' - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: 1 - volumes: - - /etc/localtime:/etc/localtime:ro - - /etc/timezone:/etc/timezone:ro - command: - [ - '--character-set-server=utf8mb4', - '--collation-server=utf8mb4_unicode_ci', - ] - ports: - - '3306:3306' diff --git a/README-cn.md b/helper/README-cn.md similarity index 99% rename from README-cn.md rename to helper/README-cn.md index 15b2500..cf7b013 100644 --- a/README-cn.md +++ b/helper/README-cn.md @@ -28,7 +28,7 @@ DTM是一款变革性的分布式事务框架,提供了傻瓜式的使用方 ## 亮点 -* 极易接入 +* 极易上手 - 零配置启动服务,提供非常简单的HTTP接口,极大降低上手分布式事务的难度,新手也能快速接入 * 跨语言 - 可适合多语言栈的公司使用。方便go、python、php、nodejs、ruby、c# 各类语言使用。 diff --git a/README-en.md b/helper/README-en.md similarity index 100% rename from README-en.md rename to helper/README-en.md diff --git a/bench/Makefile b/helper/bench/Makefile similarity index 100% rename from bench/Makefile rename to helper/bench/Makefile diff --git a/bench/main.go b/helper/bench/main.go similarity index 96% rename from bench/main.go rename to helper/bench/main.go index f5793f9..e8cb94c 100644 --- a/bench/main.go +++ b/helper/bench/main.go @@ -4,12 +4,12 @@ import ( "fmt" "os" - "github.com/dtm-labs/dtm/bench/svr" "github.com/dtm-labs/dtm/dtmcli" "github.com/dtm-labs/dtm/dtmcli/logger" "github.com/dtm-labs/dtm/dtmsvr" "github.com/dtm-labs/dtm/dtmsvr/config" "github.com/dtm-labs/dtm/dtmsvr/storage/registry" + "github.com/dtm-labs/dtm/helper/bench/svr" "github.com/dtm-labs/dtm/test/busi" ) diff --git a/bench/prepare.sh b/helper/bench/prepare.sh similarity index 100% rename from bench/prepare.sh rename to helper/bench/prepare.sh diff --git a/bench/setup-redis6.sh b/helper/bench/setup-redis6.sh similarity index 100% rename from bench/setup-redis6.sh rename to helper/bench/setup-redis6.sh diff --git a/bench/setup.sh b/helper/bench/setup.sh similarity index 100% rename from bench/setup.sh rename to helper/bench/setup.sh diff --git a/bench/svr/http.go b/helper/bench/svr/http.go similarity index 100% rename from bench/svr/http.go rename to helper/bench/svr/http.go diff --git a/bench/test-boltdb.sh b/helper/bench/test-boltdb.sh similarity index 100% rename from bench/test-boltdb.sh rename to helper/bench/test-boltdb.sh diff --git a/bench/test-flash-sales.sh b/helper/bench/test-flash-sales.sh similarity index 100% rename from bench/test-flash-sales.sh rename to helper/bench/test-flash-sales.sh diff --git a/bench/test-mysql.sh b/helper/bench/test-mysql.sh similarity index 100% rename from bench/test-mysql.sh rename to helper/bench/test-mysql.sh diff --git a/bench/test-redis.sh b/helper/bench/test-redis.sh similarity index 100% rename from bench/test-redis.sh rename to helper/bench/test-redis.sh diff --git a/helper/golint.sh b/helper/golint.sh new file mode 100644 index 0000000..6c4b568 --- /dev/null +++ b/helper/golint.sh @@ -0,0 +1,4 @@ +set -x + +curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.0 +$(go env GOPATH)/bin/golangci-lint run