Skip to content
Closed
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
15 changes: 15 additions & 0 deletions .github/workflows/artifact-delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 }}
40 changes: 40 additions & 0 deletions .github/workflows/artifact-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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 }}
55 changes: 55 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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
18 changes: 15 additions & 3 deletions 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 @@ -43,6 +48,13 @@ test:
@scripts/run-test.sh
@cd scripts && sh teardown.sh && cd ..

lint:
@printf $(CCCOLOR)"GolangCI Lint...\n"$(ENDCOLOR)
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