diff --git a/.ci/build.sh b/.ci/build.sh deleted file mode 100755 index 9be12fe6a53..00000000000 --- a/.ci/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -set -x -set -euo pipefail - -mvn clean compile \ No newline at end of file diff --git a/.ci/test.sh b/.ci/test.sh deleted file mode 100755 index 6ba95963458..00000000000 --- a/.ci/test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -x -set -euo pipefail - -export RAWKV_PD_ADDRESSES=127.0.0.1:2379 -export TXNKV_PD_ADDRESSES=127.0.0.1:3379 -mvn clean test \ No newline at end of file diff --git a/config/pd.toml b/.github/config/pd.toml similarity index 79% rename from config/pd.toml rename to .github/config/pd.toml index f2795de343f..526fa3fa745 100644 --- a/config/pd.toml +++ b/.github/config/pd.toml @@ -1,4 +1,4 @@ # PD Configuration. [replication] enable-placement-rules = true -max-replicas = 1 \ No newline at end of file +max-replicas = 1 diff --git a/.github/config/tikv_rawkv.toml b/.github/config/tikv_rawkv.toml new file mode 100644 index 00000000000..5ee1bfe07ed --- /dev/null +++ b/.github/config/tikv_rawkv.toml @@ -0,0 +1,18 @@ +# TiKV Configuration. + +[raftstore] +# set store capacity, if no set, use disk capacity. +capacity = "8G" +pd-heartbeat-tick-interval = "2s" +pd-store-heartbeat-tick-interval = "5s" +split-region-check-tick-interval = "1s" + +[storage] +enable-ttl = true + +[rocksdb] +max-open-files = 10000 + +[raftdb] +max-open-files = 10000 + diff --git a/.github/config/tikv_txnkv.toml b/.github/config/tikv_txnkv.toml new file mode 100644 index 00000000000..c083cfa31b0 --- /dev/null +++ b/.github/config/tikv_txnkv.toml @@ -0,0 +1,14 @@ +# TiKV Configuration. + +[raftstore] +# set store capacity, if no set, use disk capacity. +capacity = "8G" +pd-heartbeat-tick-interval = "2s" +pd-store-heartbeat-tick-interval = "5s" +split-region-check-tick-interval = "1s" + +[rocksdb] +max-open-files = 10000 + +[raftdb] +max-open-files = 10000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..c2fbf68aa88 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,71 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + +jobs: + format: + name: Check Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8.0' + distribution: 'adopt' + - run: | + ./dev/javafmt + if [[ $(git diff) != "" ]] + then + echo "code format error, please run the following commands:" + echo " ./dev/javafmt" + exit 1 + fi + + integration-test: + name: Integration Test - ${{ matrix.tikv_version }} + runs-on: ubuntu-latest + strategy: + matrix: + tikv_version: [nightly, v5.0.4, v5.3.0, v5.4.0] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8.0' + distribution: 'adopt' + - name: Install TiUP + run: curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh + - name: Start TiUP Playground + run: | + # Start TiKV in APIV1TTL + /home/runner/.tiup/bin/tiup playground ${{ matrix.tikv_version }} --mode tikv-slim --kv 1 --without-monitor --kv.config /home/runner/work/client-java/client-java/.github/config/tikv_rawkv.toml --pd.config /home/runner/work/client-java/client-java/.github/config/pd.toml &> raw.out 2>&1 & + + # The first run of `tiup` has to download all components so it'll take longer. + sleep 1m 30s + + # Start TiKV in APIV1 + /home/runner/.tiup/bin/tiup playground ${{ matrix.tikv_version }} --mode tikv-slim --kv 1 --without-monitor --kv.config /home/runner/work/client-java/client-java/.github/config/tikv_txnkv.toml --pd.config /home/runner/work/client-java/client-java/.github/config/pd.toml &> txn.out 2>&1 & + + sleep 30s + + # Parse PD address from `tiup` output + echo "RAWKV_PD_ADDRESSES=$(cat raw.out | grep -oP '(?<=PD client endpoints: \[)[0-9\.:]+(?=\])')" >> $GITHUB_ENV + echo "TXNKV_PD_ADDRESSES=$(cat txn.out | grep -oP '(?<=PD client endpoints: \[)[0-9\.:]+(?=\])')" >> $GITHUB_ENV + + # Log the output + echo "$(cat raw.out)" >&2 + echo "$(cat txn.out)" >&2 + - name: Run Integration Test + run: mvn clean test + - name: Upload coverage + uses: codecov/codecov-action@v2 + with: + files: ${{ github.workspace }}/target/site/jacoco/jacoco.xml + fail_ci_if_error: true + verbose: true diff --git a/README.md b/README.md index 7243d78bc47..b2f0d66ee43 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Maven Central](https://img.shields.io/maven-central/v/org.tikv/tikv-client-java.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.tikv%22%20AND%20a:%22tikv-client-java%22) +[![Slack](https://img.shields.io/badge/chat-on%20Slack-brightgreen.svg)](https://slack.tidb.io/invite?team=tikv-wg&channel=client) +[![codecov](https://codecov.io/gh/tikv/client-java/branch/master/graph/badge.svg?token=nSAjGaN0EH)](https://codecov.io/gh/tikv/client-java) + ## TiKV JAVA Client A Java client for [TiDB](https://github.com/pingcap/tidb)/[TiKV](https://github.com/tikv/tikv). diff --git a/pom.xml b/pom.xml index 88f177b0aa0..4efa43f8db4 100644 --- a/pom.xml +++ b/pom.xml @@ -479,7 +479,7 @@ jacoco-site - package + test report