diff --git a/.github/workflows/kubekf.yml b/.github/workflows/kubekf.yml index 34e514f..5e7bc78 100644 --- a/.github/workflows/kubekf.yml +++ b/.github/workflows/kubekf.yml @@ -44,6 +44,10 @@ jobs: run: | make tidy + - name: Run go format + run: | + make format + - name: Generate all necessary files, such as error code files run: | make generate @@ -59,7 +63,7 @@ jobs: - name: Build source code for host platform run: | - # make build # skip build for now + make build # skip build for now - name: Collect Test Coverage File uses: actions/upload-artifact@v1.0.0 @@ -70,12 +74,12 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - # skip for now - # - name: Login to DockerHub - # uses: docker/login-action@v1 - # with: - # username: ${{ env.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} + # skip for now + # - name: Login to DockerHub + # uses: docker/login-action@v1 + # with: + # username: ${{ env.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} # skip for now # - name: Build docker images for host arch and push images to registry diff --git a/Dockerfile b/Dockerfile index d6b8dd7..8eece81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.18 AS build \ No newline at end of file +FROM golang:alpine as builder \ No newline at end of file diff --git a/Makefile b/Makefile index ba3fc9d..0d72595 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,8 @@ ifeq (, $(shell git status --porcelain 2>/dev/null)) endif GIT_COMMIT:=$(shell git rev-parse HEAD) -IMG ?= ghcr.io/OpenIMSDK/OpenKF:latest +# Image URL to use all building/pushing image targets +IMG ?= openim/openkf:test BUILDFILE = "./main.go" BUILDAPP = "$(OUTPUT_DIR)/" @@ -72,9 +73,7 @@ MAKEFLAGS += --no-print-directory endif # The OS must be linux when building docker images -PLATFORMS ?= linux_amd64 linux_arm64 -# The OS can be linux/windows/darwin when building binaries -# PLATFORMS ?= darwin_amd64 windows_amd64 linux_amd64 linux_arm64 +PLATFORMS ?= linux_s390x linux_mips64 linux_mips64le darwin_amd64 windows_amd64 linux_amd64 linux_arm64 linux_ppc64le # Set a specific PLATFORM ifeq ($(origin PLATFORM), undefined) @@ -211,6 +210,12 @@ test.junit-report: tools.verify.go-junit-report SERVER_DIR := server +## run: Run the server. +.PHONY: run +run: + @echo "===========> Run the server" + @cd $(SERVER_DIR) && $(GO) run main.go + ## tidy: tidy go.mod .PHONY: tidy tidy: @@ -269,7 +274,7 @@ cover: test.junit-report ## docker-build: Build docker image with the manager. .PHONY: docker-build docker-build: test - docker build -t ${IMG} . + docker build --pull --no-cache . -t ${IMG} ## docker-push: Push docker image with the manager. .PHONY: docker-push @@ -279,7 +284,7 @@ docker-push: ## docker-buildx-push: Push docker image with the manager using buildx. .PHONY: docker-buildx-push docker-buildx-push: - docker buildx build --platform linux/arm64,linux/amd64 -t ${IMG} . --push + docker buildx build -f --pull --no-cache --platform=$(PLATFORMS) --push . -t $(IMG) ## copyright-verify: Validate boilerplate headers for assign files. .PHONY: copyright-verify diff --git a/docs/contribution/issue specification.md b/docs/contribution/issue specification.md deleted file mode 100644 index 5cd618a..0000000 --- a/docs/contribution/issue specification.md +++ /dev/null @@ -1,40 +0,0 @@ -# issue specification - - we use [lot issues](https://github.com/openIMSDK/openKF/issues) before reporting bugs, Please make sure that has been - searching similar [question](https://github.com/OpenIMSDK/OpenKF/issues), because they may have already answered or - is being repaired. New questions should be directed - to [question assistant](https://github.com/OpenIMSDK/OpenKF/issues/new/choose) submitted. For bug reports, include - code that can - be used to reproduce the problem and how to reproduce - it. For new feature suggestions, indicate the changes you want and the expected behavior. - -## **for committer** - -##### **working for pr** - -- commiters should finish code unit test again and record test dirary and if nessary do somke test -- commiters should check for code - convenant [code convenant](https://github.com/OpenIMSDK/OpenKF/blob/main/CONTRIBUTING.md) - -##### **working for issue management** - -- add labels to each issue and check it out. -- format issue style when needed. -- keep in touch with each contributor. -- Keep up with the status of the issue. -- assign one or more who to solve it. - -## **for contributor** - -##### **raise issue** - -- developers should add full labels for issue you raised.(including **kind**(问题类型 such as,feat,bug),**Degree of - importance**(重要程度 emergency,important,normal),**strategy**(处置策略 such as self ,paticipant,coperation),* - *progress**(进度 such as running,later),**size**(问题规模 such as L,M,XXL)) - -##### **claim issue and make pr** - -- developers can claim it by comment (want to claim + issueId) -- when doing pr process, developer should make Incremental testing at first and then doing **/contributor.md 's** - process. - diff --git a/docs/contribution/issue_specification.md b/docs/contribution/issue_specification.md new file mode 100644 index 0000000..ae65d94 --- /dev/null +++ b/docs/contribution/issue_specification.md @@ -0,0 +1,37 @@ +# Issue Specification + +Before reporting bugs, we highly recommend utilizing the [GitHub Issues](https://github.com/openIMSDK/openKF/issues) page. Please ensure to search for similar questions on the [issue board](https://github.com/OpenIMSDK/OpenKF/issues) as your query might have already been addressed or is currently being resolved. For new questions, kindly submit them through the [question assistant](https://github.com/OpenIMSDK/OpenKF/issues/new/choose). + +When reporting bugs, include the necessary code to reproduce the problem and provide step-by-step instructions. For new feature suggestions, clearly describe the desired changes and expected behavior. + +## For Committers + +### Working on Pull Requests + +- Committers should re-run unit tests on their code and document the test results. If necessary, conduct smoke tests. +- It is essential for committers to adhere to the [code covenant](https://github.com/OpenIMSDK/OpenKF/blob/main/CONTRIBUTING.md) regarding code formatting. + +### Working on Issue Management + +- Assign appropriate labels to each issue and regularly review them. +- Format issue descriptions when required. +- Maintain effective communication with contributors. +- Stay updated on the status of each issue. +- Assign one or more individuals to work on resolving the issues. + +## For Contributors + +### Raising an Issue + +developers should add full labels for issue you raised.(including **kind**(问题类型 such as,feat,bug),**Degree of importance**(重要程度 emergency,important,normal),**strategy**(处置策略 such as self ,paticipant,coperation), **progress**(进度 such as running,later),**size**(问题规模 such as L,M,XXL)) + +### Claiming an Issue and Making Pull Requests + +- Developers can claim an issue by commenting "want to claim + issue ID." +- When creating a pull request, developers should conduct incremental testing before proceeding with the process outlined in `/contributor.md`. + +**Additional Details:** + +The labels used within the project are synced from the [openim-yaml.yaml](https://github.com/kubecub/github-label-syncer/blob/main/labels-templates/openim-yaml.yaml) file. The [github-label-syncer](https://github.com/kubecub/github-label-syncer) project automatically validates and syncs these labels with the OpenIM-Server repository. A script is employed to periodically retrieve or sync the labels from OpenIM-Server using the actions mechanism. This synchronization process is incremental and also takes into consideration modifications. When adding labels to OpenKF, existing labels are not removed. + +The labeling process is primarily automated through robots, with minimal manual intervention for label selection. In the future, the powerful Prow system will be leveraged to further enhance community management tasks and enable a high degree of automation. diff --git a/docs/images/openkf-log.png b/docs/images/openkf-log.png new file mode 100644 index 0000000..7f9ffe6 Binary files /dev/null and b/docs/images/openkf-log.png differ diff --git a/docs/test/e2e.md b/docs/test/e2e.md new file mode 100644 index 0000000..a4d0a51 --- /dev/null +++ b/docs/test/e2e.md @@ -0,0 +1,2 @@ +# Running End-to-end Tests on Remote Clusters + diff --git a/docs/test/integration.md b/docs/test/integration.md new file mode 100644 index 0000000..7fc6572 --- /dev/null +++ b/docs/test/integration.md @@ -0,0 +1,2 @@ +# Writing and Running Integration Tests + diff --git a/docs/website/.gitignore b/docs/website/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/docs/website/Makefile b/docs/website/Makefile new file mode 100644 index 0000000..28e0d44 --- /dev/null +++ b/docs/website/Makefile @@ -0,0 +1,37 @@ +REPO_ROOT:=${CURDIR}/.. +# setup go for managing hugo +PATH:=$(shell cd $(REPO_ROOT) && . hack/build/setup-go.sh && echo "$${PATH}") +# go1.9+ can autodetect GOROOT, but if some other tool sets it ... +GOROOT:= +# enable modules +GO111MODULE=on +# disable CGO by default for static binaries +CGO_ENABLED=0 +export PATH GOROOT GO111MODULE CGO_ENABLED +# work around broken PATH export +SPACE:=$(subst ,, ) +SHELL:=env PATH=$(subst $(SPACE),\$(SPACE),$(PATH)) $(SHELL) + +# from https://github.com/kubernetes/website/blob/master/Makefile +DOCKER = docker +HUGO_VERSION = 0.60.0 +DOCKER_IMAGE = jojomi/hugo:$(HUGO_VERSION) +DOCKER_RUN = $(DOCKER) run --rm --interactive --tty --volume $(realpath $(CURDIR)/..):/src -p 1313:1313 --workdir /src/site --entrypoint=hugo --platform linux/amd64 $(DOCKER_IMAGE) + +HUGO_BIN:=$(REPO_ROOT)/bin/hugo + +$(HUGO_BIN): + go build -o $(HUGO_BIN) github.com/gohugoio/hugo + +hugo: $(HUGO_BIN) + +serve: hugo + $(HUGO_BIN) server --bind="0.0.0.0" \ + --ignoreCache \ + --buildFuture \ + --disableFastRender + +build: hugo + $(HUGO_BIN) + +.PHONY: build serve hugo \ No newline at end of file diff --git a/server/internal/router/router.go b/server/internal/router/router.go index 20825eb..b25b40c 100644 --- a/server/internal/router/router.go +++ b/server/internal/router/router.go @@ -18,7 +18,7 @@ import ( swaggerFiles "github.com/swaggo/files" ginSwagger "github.com/swaggo/gin-swagger" - _ "github.com/OpenIMSDK/OpenKF/server/docs" + // "github.com/OpenIMSDK/OpenKF/server/docs" "github.com/gin-gonic/gin"