Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/artifact-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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: artifact-delete
on:
pull_request:
types: [closed]

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
artifact-delete:
uses: StackAdapt/actions/.github/workflows/stargate-delete.yml@main
with:
component: kvrocks-controller
branch: ${{ github.head_ref }}
56 changes: 56 additions & 0 deletions .github/workflows/artifact-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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: artifact-upload
on:
pull_request:
types: [opened, synchronize]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
artifact-upload-server:
if: "!contains(github.event.pull_request.labels.*.name, 'skip-kvrocks-controller-upload')"
strategy: # If you only need 1 architecture, remove this matrix strategy and directly pass in the architecture
matrix:
architecture: [amd64, arm64]
uses: StackAdapt/actions/.github/workflows/stargate-upload.yml@main
with:
component: kvrocks-controller
binary-name: kvctl-server
branch: ${{ github.head_ref }}
commit: ${{ github.event.pull_request.head.sha }}
architecture: ${{ matrix.architecture }}
make-command: server
output-dir: cmd/server
secrets:
action-token: ${{ secrets.GO_PRIVATE_MODULES }}
artifact-upload-client:
if: "!contains(github.event.pull_request.labels.*.name, 'skip-kvrocks-controller-upload')"
strategy: # If you only need 1 architecture, remove this matrix strategy and directly pass in the architecture
matrix:
architecture: [amd64, arm64]
uses: StackAdapt/actions/.github/workflows/stargate-upload.yml@main
with:
component: kvrocks-controller
binary-name: kvctl
branch: ${{ github.head_ref }}
commit: ${{ github.event.pull_request.head.sha }}
architecture: ${{ matrix.architecture }}
make-command: client
output-dir: cmd/client
secrets:
action-token: ${{ secrets.GO_PRIVATE_MODULES }}
71 changes: 71 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# 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: tags
on:
push:
branches:
- main

permissions:
contents: write
id-token: write # This is required for requesting the JWT

jobs:
tag:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag_version.outputs.new_tag }}
steps:
- uses: actions/checkout@v3
- name: Bump version and push tag
id: tag_version
uses: StackAdapt/github-tag-action@v6.1
with:
release_branches: main
github_token: ${{ secrets.GITHUB_TOKEN }}

artifact-upload-server:
needs: [tag]
strategy: # If you only need 1 architecture, remove this matrix strategy and directly pass in the architecture
matrix:
architecture: [amd64, arm64]
uses: StackAdapt/actions/.github/workflows/stargate-upload.yml@main
with:
component: kvrocks-controller
binary-name: kvctl-server
tag: ${{ needs.tag.outputs.tag }}
architecture: ${{ matrix.architecture }}
output-dir: cmd/server
make-command: server
secrets:
action-token: ${{ secrets.GO_PRIVATE_MODULES }}

artifact-upload-client:
needs: [tag]
strategy: # If you only need 1 architecture, remove this matrix strategy and directly pass in the architecture
matrix:
architecture: [amd64, arm64]
uses: StackAdapt/actions/.github/workflows/stargate-upload.yml@main
with:
component: kvrocks-controller
binary-name: kvctl
tag: ${{ needs.tag.outputs.tag }}
architecture: ${{ matrix.architecture }}
output-dir: cmd/client
make-command: client
secrets:
action-token: ${{ secrets.GO_PRIVATE_MODULES }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ cmd/server/kvrocks_controller
.kc_cli_history
.vscode/
vendor
cmd/client/kvctl
cmd/server/kvctl-server
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ CCCOLOR="\033[37;1m"
MAKECOLOR="\033[32;1m"
ENDCOLOR="\033[0m"

GOARCH ?= $(shell go env GOARCH)
GOOS ?= $(shell go env GOOS)
VERSION =`cat ../../VERSION.txt`
GO_PROJECT =github.com/stackadapt/kvrocks-controller
LDFLAGS := $(LDFLAGS) -X main.commit=$(GIT_COMMIT)${GIT_DIRTY} -X main.branch=$(GIT_BRANCH) -X main.date=$(DATE) -X $(GO_PROJECT)/version.Version=$(VERSION)

all: $(PROGRAM)

.PHONY: all


$(PROGRAM):
@bash scripts/build.sh
@echo ""
Expand All @@ -46,3 +51,11 @@ test:
lint:
@printf $(CCCOLOR)"GolangCI Lint...\n"$(ENDCOLOR)
@golangci-lint run

.PHONY: client
client:
cd cmd/client; CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build -v -ldflags "$(LDFLAGS)" -o ./kvctl

.PHONY: server
server:
cd cmd/server; CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build -v -ldflags "$(LDFLAGS)" -o ./kvctl-server
Loading