Skip to content

Commit

Permalink
Merge branch 'OpenIMSDK:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
PolarishT committed Jul 9, 2023
2 parents e0c097e + d4a6370 commit 6364de5
Show file tree
Hide file tree
Showing 80 changed files with 4,959 additions and 178 deletions.
2 changes: 2 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@ coverage:
pkg:
paths:
- server/pkg/*
- server/internal/*
- server/example/*
informational: true
patch: off
18 changes: 11 additions & 7 deletions .github/workflows/kubekf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ linters-settings:
exclude-forbidden: false
gomodguard:
allowed:
modules: # List of allowed modules
modules:
- gorm.io/gen # List of allowed modules
- gorm.io/gorm
- gorm.io/driver/mysql
- k8s.io/klog
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.18 AS build
FROM golang:alpine as builder
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)/"
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<h1 align="center" style="border-bottom: none">
<b>
<a href="https://docker.nsddd.top">OpenKF</a><br>
</b>
</h1>
<p align="center">
<img src="assets/logo-gif/openkf-logo-white.gif" width="60%" height="30%"/>
</p>
<h3 align="center" style="border-bottom: none">
⭐️ OpenKF(Open Knowledge Flow) is an online intelligent customer service system. ⭐️ <br>
<h3>


<p align=center>
<a href="https://goreportcard.com/report/github.com/OpenIMSDK/OpenKF"><img src="https://goreportcard.com/badge/github.com/OpenIMSDK/OpenKF" alt="A+"></a>
<a href="https://github.com/OpenIMSDK/OpenKF/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/OpenIMSDK/OpenKF/good%20first%20issue?logo=%22github%22" alt="good first"></a>
Expand All @@ -25,8 +21,8 @@
</p>

</p>
<br>

----

## 🧩 Awesome features

Expand Down Expand Up @@ -168,6 +164,8 @@ Before you start, please make sure your changes are in demand. The best for that

OpenIMSDK is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/OpenIMSDK/OpenKF/tree/main/LICENSE) for the full license text.

The OpenKF logo, including its variations and animated versions, displayed in this repository [OpenKF](https://github.com/OpenIMSDK/openkf) under the [assets/logo](./assets/logo) and [assets/logo-gif](assets/logo-gif) directories, are protected by copyright laws.


## 🔮 Thanks to our contributors!

Expand Down
36 changes: 35 additions & 1 deletion assets/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# `/assets`

Other assets to go along with your repository (images, logos, etc).
The `/assets` directory in the OpenKF repository contains various assets such as images, logos, and animated GIFs. These assets serve different purposes and contribute to the functionality and aesthetics of the OpenKF project.

## Directory Structure:

```bash
assets/
├── README.md # Documentation for the assets directory
├── images # Directory holding images related to OpenKF
│ ├── architecture.png # Image depicting the architecture of OpenKF
│ └── mvc.png # Image illustrating the Model-View-Controller (MVC) pattern
├── intive-slack.png # Image displaying the Intive Slack logo
├── logo # Directory containing various logo variations for OpenKF
│ ├── openkf-logo-black.png # OpenKF logo with a black background
│ ├── openkf-logo-blue.png # OpenKF logo with a blue background
│ ├── openkf-logo-green.png # OpenKF logo with a green background
│ ├── openkf-logo-purple.png # OpenKF logo with a purple background
│ ├── openkf-logo-white.png # OpenKF logo with a white background
│ ├── openkf-logo-yellow.png # OpenKF logo with a yellow background
│ ├── openkf-logo-yellow2.png # Another variation of OpenKF logo with a yellow background
│ └── openkf-logo.png # OpenKF logo with a transparent background
└── logo-gif # Directory containing animated GIF versions of the OpenKF logo
├── openkf-log-dark.gif # Dark-themed animated OpenKF logo
├── openkf-log-dazzling.gif # Dazzling-themed animated OpenKF logo
├── openkf-log-insipid.gif # Insipid-themed animated OpenKF logo
├── openkf-log-white.gif # White-colored animated OpenKF logo
└── openkf-log.gif # Animated OpenKF logo with a transparent background
```

## Copyright Notice:

The OpenKF logo, including its variations and animated versions, displayed in this repository [OpenKF](https://github.com/OpenIMSDK/openkf) under the `/assets/logo` and `/assets/logo-gif` directories, are protected by copyright laws.

The logo design is credited to @Xx(席欣).

Please respect the intellectual property rights and refrain from unauthorized use and distribution of these assets.
File renamed without changes
Binary file added assets/logo-gif/openkf-logo-black.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-gif/openkf-logo-dark.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-gif/openkf-logo-dazzling.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-gif/openkf-logo-insipid.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-gif/openkf-logo-white.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo-gif/openkf-logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-purple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo-yellow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo/openkf-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/contribution/cicd-actions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Continuous Integration and Automation

Every change on the OpenIM repository, either made through a pull request or direct push, triggers the continuous integration pipelines defined within the same repository. Needless to say, all the OpenIM contributions can be merged until all the checks pass (AKA having green builds).
Every change on the OpenKF repository, either made through a pull request or direct push, triggers the continuous integration pipelines defined within the same repository. Needless to say, all the OpenKF contributions can be merged until all the checks pass (AKA having green builds).

- [Continuous Integration and Automation](#continuous-integration-and-automation)
- [CI Platforms](#ci-platforms)
Expand Down Expand Up @@ -30,7 +30,7 @@ A contributor should verify their changes locally to speed up the pull request p

**User Makefile:**
```bash
root@PS2023EVRHNCXG:~/workspaces/openim/Open-IM-Server# make help 😊
root@PS2023EVRHNCXG:~/workspaces/OpenKF/Open-IM-Server# make help 😊

Usage: make <TARGETS> <OPTIONS> ...

Expand Down Expand Up @@ -71,7 +71,7 @@ DEBUG Whether or not to generate debug symbols. Default is 0. ❓

BINS Binaries to build. Default is all binaries under cmd. 🛠️
This option is available when using: make {build}(.multiarch) 🧰
Example: make build BINS="openim_api openim_cms_api".
Example: make build BINS="OpenKF_api OpenKF_cms_api".

PLATFORMS Platform to build for. Default is linux_arm64 and linux_amd64. 🌍
This option is available when using: make {build}.multiarch 🌍
Expand Down
13 changes: 8 additions & 5 deletions docs/contribution/code_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
- [Code conventions](#code-conventions)
- [POSIX shell](#posix-shell)
- [Go](#go)
- [Python](#python)
- [Directory and file conventions](#directory-and-file-conventions)
- [Testing conventions](#testing-conventions)

## POSIX shell

Expand All @@ -26,13 +26,16 @@
- Unless there's a good reason, the `package foo` line should match the name of the directory in which the `.go` file exists.
- Importers can use a different name if they need to disambiguate.

## Python

- [PEP 8](https://www.python.org/dev/peps/pep-0008/)
- [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)
- [Google Python Style Guide (Chinese)](https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_style_rules/)


## Directory and file conventions

- Avoid general utility packages. Packages called "util" are suspect. Instead, derive a name that describes your desired function. For example, the utility functions dealing with waiting for operations are in the `wait` package and include functionality like `Poll`. The full name is `wait.Poll`.
- All filenames should be lowercase.
- All source files and directories should use underscores, not dashes.
- Package directories should generally avoid using separators as much as possible. When package names are multiple words, they usually should be in nested subdirectories.

## Testing conventions

Please refer to [TESTING.md](../../tests/TESTING.md) document.
27 changes: 13 additions & 14 deletions docs/contribution/development.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Development Guide

Since OpenIM is written in Go, it is fair to assume that the Go tools are all one needs to contribute to this project. Unfortunately, there is a point where this no longer holds true when required to test or build local changes. This document elaborates on the required tooling for OpenIM development.
Since OpenKF is written in Go, it is fair to assume that the Go tools are all one needs to contribute to this project. Unfortunately, there is a point where this no longer holds true when required to test or build local changes. This document elaborates on the required tooling for OpenKF development.

- [Development Guide](#development-guide)
- [Non-Linux environment prerequisites](#non-linux-environment-prerequisites)
Expand All @@ -10,18 +10,18 @@ Since OpenIM is written in Go, it is fair to assume that the Go tools are all on
- [Go](#go)
- [Docker](#docker)
- [Vagrant](#vagrant)
- [Cloning, Building and Testing OpenIM](#cloning-building-and-testing-openim)
- [Cloning, Building and Testing OpenKF](#cloning-building-and-testing-openkf)
- [Dependency management](#dependency-management)

## Non-Linux environment prerequisites

All the test and build scripts within this repository were created to be run on GNU Linux development environments. Due to this, it is suggested to use the virtual machine defined on this repository's [Vagrantfile](../../Vagrantfile) to use them.
All the test and build scripts within this repository were created to be run on GNU Linux development environments. Due to this, it is suggested to use the virtual machine defined on this repository's [Vagrantfile](https://developer.hashicorp.com/vagrant/docs/vagrantfile) to build and test OpenKF.

Either way, if one still wants to build and test OpenIM on non-Linux environments, specific setups are to be followed.
Either way, if one still wants to build and test OpenKF on non-Linux environments, specific setups are to be followed.

### Windows Setup

To build OpenIM on Windows is only possible for versions that support Windows Subsystem for Linux (WSL). If the development environment in question has Windows 10, Version 2004, Build 19041 or higher, [follow these instructions to install WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10); otherwise, use a Linux Virtual machine instead.
To build OpenKF on Windows is only possible for versions that support Windows Subsystem for Linux (WSL). If the development environment in question has Windows 10, Version 2004, Build 19041 or higher, [follow these instructions to install WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10); otherwise, use a Linux Virtual machine instead.

### macOS Setup

Expand Down Expand Up @@ -49,32 +49,31 @@ export PATH

### Go

It is well known that OpenIM is written in [Go](http://golang.org). Please follow the [Go Getting Started guide](https://golang.org/doc/install) to install and set up the Go tools used to compile and run the test batteries.
It is well known that OpenKF is written in [Go](http://golang.org). Please follow the [Go Getting Started guide](https://golang.org/doc/install) to install and set up the Go tools used to compile and run the test batteries.

| OpenIM | requires Go |
| OpenKF | requires Go |
|----------------|-------------|
| 2.24 - 3.00 | 1.15 + |
| 3.30 + | 1.18 + |

### Docker

OpenIM build and test processes development require Docker to run certain steps. [Follow the Docker website instructions to install Docker](https://docs.docker.com/get-docker/) in the development environment.
OpenKF build and test processes development require Docker to run certain steps. [Follow the Docker website instructions to install Docker](https://docs.docker.com/get-docker/) in the development environment.

### Vagrant

As described in the [Testing documentation](../../tests/TESTING.md), all the smoke tests are run in virtual machines managed by Vagrant. To install Vagrant in the development environment, [follow the instructions from the Hashicorp website](https://www.vagrantup.com/downloads), alongside any of the following hypervisors:

- [VirtualBox](https://www.virtualbox.org/)
- [libvirt](https://libvirt.org/) and the [vagrant-libvirt plugin](https://github.com/vagrant-libvirt/vagrant-libvirt#installation)

## Cloning, Building and Testing OpenIM
## Cloning, Building and Testing OpenKF

These topics already have been addressed on their respective documents:

- [Git Workflow](./git-workflow.md)
- [Building](../../BUILDING.md)
- [Testing](../../tests/TESTING.md)
- [Git Workflow](./git_workflow.md)
- [CICD Actions OpenKF](./cicd-actions.md)
- [code_conventions](./code_conventions.md)

## Dependency management

OpenIM uses [go modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
OpenKF uses [go modules](https://github.com/golang/go/wiki/Modules) to manage dependencies.
Loading

0 comments on commit 6364de5

Please sign in to comment.