From 935a58738e2d32b5649be8592086092eb5404dff Mon Sep 17 00:00:00 2001 From: Joe Zou <yixian.zou@gmail.com> Date: Tue, 3 Nov 2020 09:26:22 +0800 Subject: [PATCH] add Makefile into travis and remove shell --- .travis.yml | 10 +-------- Makefile | 4 ++-- README.md | 20 ++++++++---------- README_CN.md | 22 +++++++++---------- before_ut.bat | 43 -------------------------------------- before_ut.sh | 43 -------------------------------------- before_validate_license.sh | 26 ----------------------- 7 files changed, 22 insertions(+), 146 deletions(-) delete mode 100644 before_ut.bat delete mode 100755 before_ut.sh delete mode 100644 before_validate_license.sh diff --git a/.travis.yml b/.travis.yml index 566c88ece..7b338c277 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,15 +16,7 @@ install: true # define ci-stage script: # license-check - - echo 'start license check' - - go fmt ./... && [[ -z `git status -s` ]] - - sh before_validate_license.sh - - chmod u+x /tmp/tools/license/license-header-checker - - /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] - # unit-test - - echo 'start unit-test' - - chmod u+x before_ut.sh && ./before_ut.sh - - go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic + - make verify # integrate-test - chmod +x integrate_test.sh && ./integrate_test.sh diff --git a/Makefile b/Makefile index 75a5ec634..73fc703ab 100644 --- a/Makefile +++ b/Makefile @@ -57,14 +57,14 @@ prepareZk: prepare: prepareZk prepareLic .PHONE: test -test: clean +test: clean prepareZk $(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic deps: prepare $(GO_GET) -v -t -d ./... .PHONY: license -license: clean prepare +license: clean prepareLic $(GO_LICENSE_CHECKER) -v -a -r -i vendor $(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]] .PHONY: verify diff --git a/README.md b/README.md index 9e1edd3af..27ffc1b60 100644 --- a/README.md +++ b/README.md @@ -144,28 +144,26 @@ https://dubbogo.github.io/dubbo-go-website (**Improving**) ## Quick Start -[dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md) carefully to learn how to dispose the configuration and compile the program. +[dubbo-go-samples](https://github.com/apache/dubbo-go-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/apache/dubbo-go-samples/blob/master/README.md) carefully to learn how to dispose the configuration and compile the program. ## Running unit tests -### Prepare +### Run -Mac/Linux ```bash -sh ./before_ut.sh +make verify ``` -Windows +### Verify license + ```bash -before_ut.bat +make license ``` -### Run -```bash -go test ./... +### Run unit test -# coverage -go test ./... -coverprofile=coverage.txt -covermode=atomic +```bash +make test ``` ## Build diff --git a/README_CN.md b/README_CN.md index b76d8983d..42b65a822 100644 --- a/README_CN.md +++ b/README_CN.md @@ -144,29 +144,27 @@ https://dubbogo.github.io/dubbo-go-website (**瀹屽杽涓�**) ## 杩愯鍗曟祴 -### 鍑嗗 +### 鎵ц鍏ㄩ儴鏍¢獙 -Mac/Linux ```bash -sh ./before_ut.sh +make verify ``` -Windows +### 鏍¢獙璁稿彲璇� + ```bash -before_ut.bat +make license ``` -### 鎵ц -```bash -go test ./... +### 鎵ц鍗曞厓娴嬭瘯 -# coverage -go test ./... -coverprofile=coverage.txt -covermode=atomic +```bash +make test ``` ## 缂栬瘧 -璇风Щ姝� [dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples) +璇风Щ姝� [dubbo-go-samples](https://github.com/apache/dubbo-go-samples) ## 濡備綍璐$尞 @@ -211,4 +209,4 @@ go test ./... -coverprofile=coverage.txt -covermode=atomic <tr></tr> </tbody> </table> -</div> +</div> \ No newline at end of file diff --git a/before_ut.bat b/before_ut.bat deleted file mode 100644 index b8d72e4a8..000000000 --- a/before_ut.bat +++ /dev/null @@ -1,43 +0,0 @@ -:: -:: Licensed to the Apache Software Foundation (ASF) under one or more -:: contributor license agreements. See the NOTICE file distributed with -:: this work for additional information regarding copyright ownership. -:: The ASF licenses this file to You under the Apache License, Version 2.0 -:: (the "License"); you may not use this file except in compliance with -:: the License. You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -set zkJarName=zookeeper-3.4.9-fatjar.jar -set remoteJarUrl="https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/%zkJarName%" -set zkJarPath=remoting/zookeeper/zookeeper-4unittest/contrib/fatjar -set zkJar=%zkJarPath%/%zkJarName% - -if not exist "%zkJar%" ( - md "%zkJarPath%" - curl -L %remoteJarUrl% -o %zkJar% -) - -md config_center\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "config_center/zookeeper/zookeeper-4unittest/contrib/fatjar/" - -md registry\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "registry/zookeeper/zookeeper-4unittest/contrib/fatjar/" - -md cluster\router\chain\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "cluster/router/chain/zookeeper-4unittest/contrib/fatjar/" - -md cluster\router\condition\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "cluster/router/condition/zookeeper-4unittest/contrib/fatjar/" - -md cluster/router/tag/zookeeper-4unittest/contrib/fatjar -xcopy /f "%zkJar%" "cluster/router/tag/zookeeper-4unittest/contrib/fatjar/" - -md metadata\report\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar/" \ No newline at end of file diff --git a/before_ut.sh b/before_ut.sh deleted file mode 100755 index b55e424ef..000000000 --- a/before_ut.sh +++ /dev/null @@ -1,43 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -zkJarName="zookeeper-3.4.9-fatjar.jar" -remoteJarUrl="https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/${zkJarName}" -zkJarPath="remoting/zookeeper/zookeeper-4unittest/contrib/fatjar" -zkJar="${zkJarPath}/${zkJarName}" - -if [ ! -f "${zkJar}" ]; then - mkdir -p ${zkJarPath} - wget -P "${zkJarPath}" ${remoteJarUrl} -fi - -mkdir -p config_center/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} config_center/zookeeper/zookeeper-4unittest/contrib/fatjar - -mkdir -p registry/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} registry/zookeeper/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/chain/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/chain/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/condition/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/condition/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/tag/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/tag/zookeeper-4unittest/contrib/fatjar - -mkdir -p metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar \ No newline at end of file diff --git a/before_validate_license.sh b/before_validate_license.sh deleted file mode 100644 index 8fa6e381c..000000000 --- a/before_validate_license.sh +++ /dev/null @@ -1,26 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -remoteLicenseCheckerPath="https://github.com/dubbogo/resources/raw/master/tools/license" -remoteLicenseCheckerName="license-header-checker" -remoteLicenseCheckerURL="${remoteLicenseCheckerPath}/${remoteLicenseCheckerName}" -remoteLicenseName="license.txt" -remoteLicenseURL="${remoteLicenseCheckerPath}/${remoteLicenseName}" - -licensePath="/tmp/tools/license" -mkdir -p ${licensePath} -wget -P "${licensePath}" ${remoteLicenseCheckerURL} -wget -P "${licensePath}" ${remoteLicenseURL} -- GitLab