diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c34da64 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + ignore: + # Ignore Kubernetes dependencies to have full control on them. + - dependency-name: "k8s.io/*" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml new file mode 100644 index 0000000..e52266b --- /dev/null +++ b/.github/workflows/dev.yaml @@ -0,0 +1,27 @@ +name: dev + +on: [push, pull_request] + +jobs: + test: + name: Test with Coverage + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' + - name: Check out code + uses: actions/checkout@v2 + - name: Install dependencies + run: | + go mod download + - name: Run Unit tests + run: | + go test -race -covermode atomic -coverprofile=covprofile ./... + - name: Install goveralls + run: go install github.com/mattn/goveralls@latest + - name: Send coverage + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: goveralls -coverprofile=covprofile -service=github diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..f414d65 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,50 @@ +name: release + +on: + push: + tags: + - '*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - + name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.20 + - + name: Docker Login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GH_TOKEN }} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Docker Setup Buildx + id: buildx + uses: docker/setup-buildx-action@v3.0.0 + - + name: Available buildx platforms + run: echo ${{ steps.buildx.outputs.platforms }} + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/README.md b/README.md index 2c1a6b6..4604491 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RedisOperator +# RedisOperator [![Coverage Status](https://coveralls.io/repos/github/alauda/redis-operator/badge.svg?branch=main)](https://coveralls.io/github/alauda/redis-operator?branch=main) https://github.com/spotahome/redis-operator https://github.com/ucloud/redis-cluster-operator diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go index 3bb124f..1173801 100644 --- a/pkg/util/util_test.go +++ b/pkg/util/util_test.go @@ -135,8 +135,8 @@ func TestSlot(t *testing.T) { if !fullSlots.IsFullfilled() { t.Errorf("specified shard slots not fullfilled all slots") } - if total > 16384 { - t.Errorf("specified shard slots duplicated") + if total == 16384 { + t.Errorf("shard slots must duplicated") } }