diff --git a/.github/workflows/ci-pr.yaml b/.github/workflows/ci-pr.yaml
new file mode 100644
index 00000000..50402ad0
--- /dev/null
+++ b/.github/workflows/ci-pr.yaml
@@ -0,0 +1,51 @@
+#
+# 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.
+#
+
+name: CI - Test
+on:
+ pull_request:
+ branches:
+ - master
+ - 'v[0-9]+.*' # release branch
+ workflow_dispatch:
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ test:
+ name: test
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java: [ '8', '11']
+ steps:
+ - uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: ${{ matrix.java }}
+ - name: ci
+ run: ./scripts/ci-test.sh
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 9791013f..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-dist: trusty
-
-language: java
-
-jdk:
- - openjdk8
- - openjdk11
-
-cache:
- directories:
- - $HOME/.m2
-
-script:
- - ./scripts/travis.sh
diff --git a/README.md b/README.md
index 5ddd29a8..bbdbb475 100644
--- a/README.md
+++ b/README.md
@@ -72,7 +72,7 @@ For each type of request(get, set, multiset, etc.), we collect 8 metrics:
We use io.dropwizard.metrics library to calculate the request count.
-Currently, metrics are integrated with open-falcon(http://open-falcon.com/),
-which push counters to local http agent http://127.0.0.1:1988/push/v1.
+Currently, metrics are integrated with open-falcon(http://open-falcon.com/),
+which push counters to local http agent http://127.0.0.1:1988/push/v1.
If you'd like to integrate pegasus client with other monitor system, please let us know ASAP.
diff --git a/pom.xml b/pom.xml
index 6854c7e1..d426fe55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -126,6 +126,11 @@
javax.annotation-api
1.3.2
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.12.2
+
@@ -390,6 +395,45 @@
0.13
+
+ com.diffplug.spotless
+ spotless-maven-plugin
+ 2.12.2
+
+
+
+
+ *.md
+ .gitignore
+
+
+
+
+ true
+ 4
+
+
+
+
+
+ src/main/java/com/xiaomi/infra/pegasus/apps/*
+ src/main/java/com/xiaomi/infra/pegasus/replication/*
+
+
+ 1.7
+
+
+
+
+
+
+
+ check
+
+ compile
+
+
+
diff --git a/scripts/travis.sh b/scripts/ci-test.sh
similarity index 87%
rename from scripts/travis.sh
rename to scripts/ci-test.sh
index 0ff149c8..0e8cd129 100755
--- a/scripts/travis.sh
+++ b/scripts/ci-test.sh
@@ -33,22 +33,19 @@ function shellcheck_must_pass()
exit 1
fi
}
-shellcheck_must_pass ./scripts/format-all.sh
-shellcheck_must_pass ./scripts/travis.sh
-
-# ensure source files are well formatted
-./scripts/format-all.sh
-if [[ $(git status -s) ]]; then
- git status -s
- echo "please format the above files before commit"
- exit 1
-fi
+shellcheck_must_pass ./scripts/ci-test.sh
# The new version of pegasus client is not compatible with old version server which contains old rpc protocol,
# So we use snapshot version of pegasus-tools, because we don`t have a new release version, which contains the new version of rpc protocol,
PEGASUS_PKG="pegasus-tools-2.0.0-5d969e8-glibc2.12-release"
PEGASUS_PKG_URL="https://github.com/apache/incubator-pegasus/releases/download/v2.0.0/pegasus-tools-2.0.0-5d969e8-glibc2.12-release.tar.gz"
+# check format
+if ! mvn spotless:check
+then
+ exit 1
+fi
+
# start pegasus onebox environment
if [ ! -f $PEGASUS_PKG.tar.gz ]; then
wget $PEGASUS_PKG_URL
diff --git a/scripts/format-all.sh b/scripts/format-all.sh
deleted file mode 100755
index 9209c354..00000000
--- a/scripts/format-all.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/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.
-#
-
-
-SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
-PROJECT_DIR=$(dirname "${SCRIPT_DIR}")
-cd "${PROJECT_DIR}" || exit 1
-
-SRC_FILES=(src/main/java/com/xiaomi/infra/pegasus/client/*.java
- src/main/java/com/xiaomi/infra/pegasus/metrics/*.java
- src/main/java/com/xiaomi/infra/pegasus/rpc/*.java
- src/main/java/com/xiaomi/infra/pegasus/rpc/async/*.java
- src/main/java/com/xiaomi/infra/pegasus/operator/*.java
- src/main/java/com/xiaomi/infra/pegasus/tools/*.java
- src/main/java/com/xiaomi/infra/pegasus/rpc/interceptor/*.java
- src/main/java/com/xiaomi/infra/pegasus/client/request/*.java
- src/main/java/com/xiaomi/infra/pegasus/base/*.java
- src/main/java/com/xiaomi/infra/pegasus/example/*.java
- src/main/java/com/xiaomi/infra/pegasus/security/*.java
- src/test/java/com/xiaomi/infra/pegasus/client/*.java
- src/test/java/com/xiaomi/infra/pegasus/metrics/*.java
- src/test/java/com/xiaomi/infra/pegasus/rpc/async/*.java
- src/test/java/com/xiaomi/infra/pegasus/tools/*.java
- src/test/java/com/xiaomi/infra/pegasus/base/*.java
- src/test/java/com/xiaomi/infra/pegasus/security/*.java
- )
-
-if [ ! -f "${PROJECT_DIR}"/google-java-format-1.7-all-deps.jar ]; then
- wget https://github.com/google/google-java-format/releases/download/google-java-format-1.7/google-java-format-1.7-all-deps.jar
-fi
-java -jar "${PROJECT_DIR}"/google-java-format-1.7-all-deps.jar --replace "${SRC_FILES[@]}"
diff --git a/src/test/java/com/xiaomi/infra/pegasus/rpc/async/MetaSessionTest.java b/src/test/java/com/xiaomi/infra/pegasus/rpc/async/MetaSessionTest.java
index 3179dcb4..2ce948e8 100644
--- a/src/test/java/com/xiaomi/infra/pegasus/rpc/async/MetaSessionTest.java
+++ b/src/test/java/com/xiaomi/infra/pegasus/rpc/async/MetaSessionTest.java
@@ -327,7 +327,7 @@ public void testDNSMetaUnavailable() {
.build());
MetaSession metaMock = Mockito.spy(manager.getMetaSession());
List metaList = metaMock.getMetaList();
- metaList.remove(0); // del the "localhost:34601"
+ metaList.clear(); // del the "localhost:34601" resolve right results
metaList.add(manager.getReplicaSession(rpc_address.fromIpPort("172.0.0.1:34602")));
metaList.add(manager.getReplicaSession(rpc_address.fromIpPort("172.0.0.1:34603")));
metaList.add(manager.getReplicaSession(rpc_address.fromIpPort("172.0.0.1:34601")));