You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/06/11 00:24:17 UTC
[servicecomb-kie] branch master updated: SCB-1312 Create CI for
servicecomb-kie
This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git
The following commit(s) were added to refs/heads/master by this push:
new 33c1241 SCB-1312 Create CI for servicecomb-kie
33c1241 is described below
commit 33c124181d8f7046c5b08cf02fa564815a269b63
Author: Shawn <xi...@gmail.com>
AuthorDate: Tue Jun 11 08:24:12 2019 +0800
SCB-1312 Create CI for servicecomb-kie
---
.travis.yml | 50 +++++++++++++++++++++++++++++++++++++++
scripts/travis/deadCodeChecker.sh | 24 +++++++++++++++++++
scripts/travis/formatChecker.sh | 24 +++++++++++++++++++
scripts/travis/goConstChecker.sh | 24 +++++++++++++++++++
scripts/travis/goCycloChecker.sh | 24 +++++++++++++++++++
scripts/travis/goLintChecker.sh | 24 +++++++++++++++++++
scripts/travis/goVetChecker.sh | 8 +++++++
scripts/travis/misspellChecker.sh | 24 +++++++++++++++++++
scripts/travis/start_deps.sh | 18 ++++++++++++++
scripts/travis/unit_test.sh | 32 +++++++++++++++++++++++++
10 files changed, 252 insertions(+)
diff --git a/.travis.yml b/.travis.yml
new file mode 100755
index 0000000..a619141
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,50 @@
+language: go
+sudo: required
+go:
+ - 1.11
+install: true
+
+before_script:
+ - mkdir -p $HOME/gopath/src/github.com/apache/servicecomb-kie
+ - rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/apache/servicecomb-kie/
+ - export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/apache/servicecomb-kie
+ - cd $HOME/gopath/src/github.com/apache/servicecomb-kie
+
+jobs:
+ include:
+ - stage: Format Checker
+ script: bash scripts/travis/formatChecker.sh
+ - stage: DeadCode Checker
+ script:
+ - go get -u github.com/tsenart/deadcode
+ - bash scripts/travis/deadCodeChecker.sh
+ - stage: Misspell Checker
+ script:
+ - go get -u github.com/client9/misspell
+ - bash scripts/travis/misspellChecker.sh
+ - stage: GoConst Checker
+ script:
+ - go get -u github.com/jgautheron/goconst/cmd/goconst
+ - bash scripts/travis/goConstChecker.sh
+ - stage: GoLint Checker
+ script:
+ - go get -u github.com/golang/lint/golint
+ - bash scripts/travis/goLintChecker.sh
+ - stage: GoCyclo Checker
+ script:
+ - go get github.com/fzipp/gocyclo
+ - bash scripts/travis/goCycloChecker.sh
+ - stage: Unit Test
+ script:
+ - bash scripts/travis/start_deps.sh
+ - go get github.com/mattn/goveralls
+ - go get golang.org/x/tools/cmd/cover
+ - GO111MODULE=on go mod download
+ - GO111MODULE=on go mod vendor
+ - bash scripts/travis/unit_test.sh && $HOME/gopath/bin/goveralls -coverprofile=coverage.txt -service=travis-ci
+
+ - stage: Build
+ script:
+ - cd build
+ - ./build_server.sh
+
diff --git a/scripts/travis/deadCodeChecker.sh b/scripts/travis/deadCodeChecker.sh
new file mode 100755
index 0000000..70f9879
--- /dev/null
+++ b/scripts/travis/deadCodeChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(find . -type d -not -path "./vendor/*" | xargs deadcode)
+if [ $? == 0 ]; then
+ echo "Hurray....all code's are reachable and utilised..."
+ exit 0
+else
+ echo "There are some deadcode in the project...please remove the unused code"
+ exit 1
+fi
diff --git a/scripts/travis/formatChecker.sh b/scripts/travis/formatChecker.sh
new file mode 100755
index 0000000..8d45994
--- /dev/null
+++ b/scripts/travis/formatChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(find . -name "*.go" -not -path "./vendor/*" -not -path ".git/*" | xargs gofmt -s -d)
+if [ $? == 0 ]; then
+ echo "Hurray....all code is formatted properly..."
+ exit 0
+else
+ echo "There is issues's with the code formatting....please run go fmt on your code"
+ exit 1
+fi
diff --git a/scripts/travis/goConstChecker.sh b/scripts/travis/goConstChecker.sh
new file mode 100755
index 0000000..ae9d86e
--- /dev/null
+++ b/scripts/travis/goConstChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(goconst ./... | grep -v vendor | grep -v third_party)
+if [ $? == 0 ]; then
+ echo "No goConst problem"
+ exit 0
+else
+ echo "Has goConst Problem"
+ exit 1
+fi
diff --git a/scripts/travis/goCycloChecker.sh b/scripts/travis/goCycloChecker.sh
new file mode 100755
index 0000000..11fd9d3
--- /dev/null
+++ b/scripts/travis/goCycloChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(find . -name "*.go" -not -path "./vendor/*" -not -path ".git/*" -not -path "./third_party/*" | grep -v _test | xargs gocyclo -over 16)
+if [ $? == 0 ]; then
+ echo "All function has less cyclomatic complexity..."
+ exit 0
+else
+ echo "Fucntions/function has more cyclomatic complexity..."
+ exit 1
+fi
diff --git a/scripts/travis/goLintChecker.sh b/scripts/travis/goLintChecker.sh
new file mode 100755
index 0000000..dfa3254
--- /dev/null
+++ b/scripts/travis/goLintChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(golint ./... | grep -v vendor | grep -v third_party | grep -v stutters | grep -v _test | grep -v examples | grep -v benchmark)
+if [ $? == 0 ]; then
+ echo "No GoLint warnings found"
+ exit 0
+else
+ echo "GoLint Warnings found"
+ exit 1
+fi
diff --git a/scripts/travis/goVetChecker.sh b/scripts/travis/goVetChecker.sh
new file mode 100755
index 0000000..8b15de5
--- /dev/null
+++ b/scripts/travis/goVetChecker.sh
@@ -0,0 +1,8 @@
+diff -u <(echo -n) <(find . -type d -not -path "./vendor/*" -not -path "./third_party/*"| xargs go vet )
+if [ $? == 0 ]; then
+ echo "Hurray....all OKAY..."
+ exit 0
+else
+ echo "There are some static issues in the project...please run go vet"
+ exit 1
+fi
diff --git a/scripts/travis/misspellChecker.sh b/scripts/travis/misspellChecker.sh
new file mode 100755
index 0000000..3d69e1e
--- /dev/null
+++ b/scripts/travis/misspellChecker.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+# 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.
+diff -u <(echo -n) <(find . -type f -not -path "./vendor/*" -not -path "./third_party/*" -print0 | xargs -0 misspell)
+if [ $? == 0 ]; then
+ echo "No Misspell found"
+ exit 0
+else
+ echo "Misspell found"
+ exit 1
+fi
diff --git a/scripts/travis/start_deps.sh b/scripts/travis/start_deps.sh
new file mode 100755
index 0000000..b4587ef
--- /dev/null
+++ b/scripts/travis/start_deps.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+# 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.
+
+docker-compose up -f $GOPATH/src/github.com/apache/servicecomb-kie/deployments/docker/docker-compose.yaml
\ No newline at end of file
diff --git a/scripts/travis/unit_test.sh b/scripts/travis/unit_test.sh
new file mode 100755
index 0000000..7568afd
--- /dev/null
+++ b/scripts/travis/unit_test.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# 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 -e
+# Make the Coverage File
+echo "mode: atomic" > coverage.txt
+
+#Start the Test
+for d in $(go list ./... | grep -v vendor | grep -v third_party | grep -v examples); do
+ echo $d
+ echo $GOPATH
+ cd $GOPATH/src/$d
+ if [ $(ls | grep _test.go | wc -l) -gt 0 ]; then
+ go test -v -cover -covermode atomic -coverprofile coverage.out
+ if [ -f coverage.out ]; then
+ sed '1d;$d' coverage.out >> $GOPATH/src/github.com/apache/servicecomb-kie/coverage.txt
+ fi
+ fi
+done