feat: Improve help information (#390)

pull/391/head
Xinwei Xiong 2 years ago committed by GitHub
parent 70df36152d
commit a550886af5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,19 +16,22 @@ This document provides guidelines and best practices to help you contribute effe
- [Release version](#Release-version) - [Release version](#Release-version)
- [Contact Us](#Contact-Us) - [Contact Us](#Contact-Us)
## What we expect of you ## What we expect of you
We hope that anyone can join Open-IM-Server , even if you are a student, writer, translator We hope that anyone can join Open-IM-Server , even if you are a student, writer, translator
Please meet the minimum version of the Go language published in [go.mod](./go.mod). If you want to manage the Go language version, we provide tools to install [gvm](https://github.com/moovweb/gvm) in our [Makefile](./Makefile) Please meet the minimum version of the Go language published in [go.mod](./go.mod). If you want to manage the Go language version, we provide tools to install [gvm](https://github.com/moovweb/gvm) in our [Makefile](./Makefile)
You'd better use Linux OR WSL as the development environment, Linux with [Makefile](./Makefile) can help you quickly build and test Open-IM-Server project. You'd better use Linux as the development environment, Linux with [Makefile](./Makefile) can help you quickly build and test Open-IM-Server project.
If you are familiar with [Makefile](./Makefile) , you can easily see the clever design of the Open-IM-Server Makefile. Storing the necessary tools such as golangci in the `/tools` directory can avoid some tool version issues. If you are familiar with [Makefile](./Makefile) , you can easily see the clever design of the Open-IM-Server Makefile. Storing the necessary tools such as golangci in the `/tools` directory can avoid some tool version issues.
The [Makefile](./Makefile) is for every developer, even if you don't know how to use the Makefile tool, don't worry, we provide two great commands to get you up to speed with the Makefile architecture, `make help` and `make help-all`, it can reduce problems of the developing environment. The [Makefile](./Makefile) is for every developer, even if you don't know how to use the Makefile tool, don't worry, we provide two great commands to get you up to speed with the Makefile architecture, `make help` and `make help-all`, it can reduce problems of the developing environment.
## Code of ConductCode of Conduct
## Code of Conduct
#### Code and doc contribution #### Code and doc contribution
@ -54,30 +57,35 @@ Every action to make project Open-IM-Server better is encouraged. On GitHub, eve
#### Design documents #### Design documents
For any substantial design, there should be a well-crafted design document. This document is not just a simple record, but also a detailed description and manifestation, which can help team members better understand the design thinking and grasp the design direction. In the process of writing the design document, we can choose to use tools such as `Google Docs` or `Notion`, and even mark RFC in [issues](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) or [discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions) for better collaboration. Of course, after completing the design document, we should also add it to our [Shared Drive](https://drive.google.com/drive/) and notify the appropriate working group to let everyone know of its existence. Only by doing so can we maximize the effectiveness of the design document and provide strong support for the smooth progress of the project. For any substantial design, there should be a well-crafted design document. This document is not just a simple record, but also a detailed description and manifestation, which can help team members better understand the design thinking and grasp the design direction. In the process of writing the design document, we can choose to use tools such as `Google Docs` or `Notion`, and even mark **RFC** in [issues](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) or [discussions](https://github.com/OpenIMSDK/Open-IM-Server/discussions) for better collaboration. Of course, after completing the design document, we should also add it to our [Shared Drive](https://drive.google.com/drive/) and notify the appropriate working group to let everyone know of its existence. Only by doing so can we maximize the effectiveness of the design document and provide strong support for the smooth progress of the project.
Anybody can access the shared Drive for reading. To get access to comment. Once you've done that, head to the [shared Drive](https://drive.google.com/) and behold all the docs. Anybody can access the shared Drive for reading. To get access to comment. Once you've done that, head to the [shared Drive](https://drive.google.com/) and behold all the docs.
In addition to that, we'd love to invite you to [join our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) where you can play with your imagination, tell us what you're working on, and get a quick response. In addition to that, we'd love to invite you to [Join Our Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) where you can play with your imagination, tell us what you're working on, and get a quick response.
When documenting a new design, we recommend a 2-step approach: When documenting a new design, we recommend a 2-step approach:
1. Use the short-form RFC template to outline your ideas and get early feedback. 1. Use the short-form **RFC** template to outline your ideas and get early feedback.
2. Once you have received sufficient feedback and consensus, you may use the longer-form design doc template to specify and discuss your design in more details. 2. Once you have received sufficient feedback and consensus, you may use the **longer-form design doc template** to specify and discuss your design in more details.
In order to contribute a feature to Open-IM-Server you'll need to go through the following steps: **In order to contribute a feature to Open-IM-Server you'll need to go through the following steps:**
+ Discuss your idea with the appropriate [working groups](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) on the working group's Slack channel. + Discuss your idea with the appropriate [working groups](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) on the working group's Slack channel.
+ Once there is general agreement that the feature is useful, create a GitHub issue to track the discussion. The issue should include information about the requirements and use cases that it is trying to address. + Once there is general agreement that the feature is useful, create a GitHub issue to track the discussion. The issue should include information about the requirements and use cases that it is trying to address.
+ Include a discussion of the proposed design and technical details of the implementation in the issue. + Include a discussion of the proposed design and technical details of the implementation in the issue.
But keep in mind that there is no guarantee of it being accepted and so it is usually best to get agreement on the idea/design before time is spent coding it. However, sometimes seeing the exact code change can help focus discussions, so the choice is up to you. But keep in mind that there is no guarantee of it being accepted and so it is usually best to get agreement on the **idea/design** before time is spent coding it. However, sometimes seeing the exact code change can help focus discussions, so the choice is up to you.
## Getting Started ## Getting Started
To propose PR for the Open-IM-Server item, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps: > **Note**
>
> A simple example allows you to quickly contribute your first **PR** to Open-IM-Server.
> To propose PR for the Open-IM-Server item, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps:
1. Fork the repository(Open-IM-Server) 1. **Fork** the repository(Open-IM-Server)
2. **CLONE** your own repository to master locally. Use `git clone https://github.com/<your-username>/Open-IM-Server.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. 2. **CLONE** your own repository to master locally. Use `git clone https://github.com/<your-username>/Open-IM-Server.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make.
@ -88,9 +96,9 @@ To propose PR for the Open-IM-Server item, we assume you have registered a GitHu
git remote set-url --push upstream no-pushing git remote set-url --push upstream no-pushing
``` ```
With this remote setting, you can check your git remote configuration like this: With this remote setting, you can check your **git remote configuration** like this:
```bash ```go
git remote -v git remote -v
origin https://github.com/<your-username>/Open-IM-Server.git (fetch) origin https://github.com/<your-username>/Open-IM-Server.git (fetch)
origin https://github.com/<your-username>/Open-IM-Server.git (push) origin https://github.com/<your-username>/Open-IM-Server.git (push)
@ -114,29 +122,23 @@ To propose PR for the Open-IM-Server item, we assume you have registered a GitHu
git checkout -b <new-branch> git checkout -b <new-branch>
``` ```
Make any change on the `new-branch` then use [Makefile](./Makefile) build and test your codes. Make any change on the `new-branch` then use [Makefile](./Makefile) **build** and **test** your codes.
5. **Commit your changes** to your local branch, lint before committing and commit with sign-off 5. **Commit your changes** to your local branch, lint before committing and commit with sign-off
```bash ```bash
git rebase upstream/main git rebase upstream/main
make link # golangci-lint run -c .golangci.yml make lint # golangci-lint run -c .golangci.yml
git add -A # add changes to staging git add -A # add changes to staging
git commit -a -s -m "message for your changes" # -s adds a Signed-off-by trailer git commit -a -s -m "fix: message for your changes" # -s adds a Signed-off-by trailer
``` ```
6. **Push your branch** to your forked repository, it is recommended to have only one commit for a PR. 6. **Push your branch** to your forked repository, it is recommended to have only one commit for a **PR**.
```bash ```bash
# sync up with upstream # sync up with upstream
git fetch upstream main git fetch upstream
git rebase upstream/main git rebase upstream/main
git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one
git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch># sync up with upstream
git fetch upstream main
git rebase upstream/main
git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one git rebase -i <commit-id> # rebase with interactive mode to squash your commits into a single one
git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch> git push # push to the remote repository, if it's a first time push, run git push --set-upstream origin <new-branch>
``` ```
@ -164,6 +166,8 @@ To propose PR for the Open-IM-Server item, we assume you have registered a GitHu
It is recommended to review your changes before filing a pull request. Check if your code doesn't conflict with the main branch and no redundant code is included. It is recommended to review your changes before filing a pull request. Check if your code doesn't conflict with the main branch and no redundant code is included.
## Style and Specification ## Style and Specification
We divide the problem into security and general problems: We divide the problem into security and general problems:
@ -172,7 +176,7 @@ We divide the problem into security and general problems:
Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of Open-IM-Server, please do not discuss it in public and even do not open a public issue. Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of Open-IM-Server, please do not discuss it in public and even do not open a public issue.
Instead we encourage you to send us a private email to winxu81@gmail.com to report this. Instead we encourage you to send us a private email to 4closetool3@gmail.com to report this.
#### Reporting general issues #### Reporting general issues
@ -197,6 +201,9 @@ To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](
Also, we must be reminded when submitting a new question about Open-IM-Server, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on. Also, we must be reminded when submitting a new question about Open-IM-Server, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on.
> **Note**
> We have requirements for **Commits**, **PR**, **Docs**, and good standards help us collaborate better and understand what you're doing.
#### Commit Rules #### Commit Rules
Actually in Open-IM-Server, we take two rules serious when committing: Actually in Open-IM-Server, we take two rules serious when committing:
@ -237,47 +244,58 @@ No matter what the commit message, or commit content is, we do take more emphasi
An example for this could be: An example for this could be:
```bash ```bash
git commit -a -s -m "docs: add a new section to the README" git commit -a -s -m "docs: add a new section to the readme"
``` ```
#### PR Description #### PR Description
PR is the only way to make change to Open-IM-Server project files. To help reviewers better get your purpose, PR description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request. PR is the only way to make change to Open-IM-Server project files. To help reviewers better get your purpose, **PR** description could not be too detailed. We encourage contributors to follow the [PR template](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/.github/PULL_REQUEST_TEMPLATE.md) to finish the pull request.
You can find some very formal PR in [RFC](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) issues and learn about them. You can find some very formal PR in [RFC](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) issues and learn about them.
**📖 Opening PRs:** **📖 Opening PRs:**
+ As long as you are working on your PR, please mark it as a draft + As long as you are working on your **PR**, please mark it as a draft.
+ Please make sure that your PR is up-to-date with the latest changes in `main` + Please make sure that your **PR** is up-to-date with the latest changes in `main`
+ Mention the issue that your PR is addressing (Fix: #{ID_1}, #{ID_2}) + Mention the issue that your **PR** is addressing. For example, `Fixes: #{ID_1}, #{ID_2}`
+ Make sure that your PR passes all checks + Make sure that your **PR** passes all checks.
**🈴 Reviewing PRs:** **🈴 Reviewing PRs:**
+ Be respectful and constructive + Be respectful and constructive.
+ Assign yourself to the PR + Assign yourself to the **PR**.
+ Check if all checks are passing + Check if all checks are passing.
+ Suggest changes instead of simply commenting on found issues + Suggest changes instead of simply commenting on found issues.
+ If you are unsure about something, ask the author + If you are unsure about something, ask the author.
+ If you are not sure if the changes work, try them out + If you are not sure if the changes work, try them out.
+ Reach out to other reviewers if you are unsure about something + Reach out to other reviewers if you are unsure about something.
+ If you are happy with the changes, approve the PR + If you are happy with the changes, approve the **PR**.
+ Merge the PR once it has all approvals and the checks are passing + Merge the **PR** once it has all approvals and the checks are passing.
**⚠️ DCO check:** **⚠️ DCO check:**
We have a DCO check that runs on every pull request to ensure code quality and maintainability. This check verifies that the commit has been signed off, indicating that you have read and agreed to the provisions of the Developer Certificate of Origin. If you have not yet signed off on the commit, you can use the following command to sign off on the last commit you made: We have a [DCO check](https://github.com/apps/dco) which runs on every **PR** to verify that the commit has been signed off.
Once [installed](https://github.com/apps/dco#usage), this integration will set the [status](https://developer.github.com/v3/repos/statuses/) to `failed` if commits in a **Pull Request** do not contain a valid `Signed-off-by` line.
To sign off the last commit you made, you can use:
```bash ```bash
git commit --amend --signoff git commit --amend --signoff
``` ```
Please note that signing off on a commit is a commitment that you have read and agreed to the provisions of the Developer Certificate of Origin. If you have not yet read this document, we strongly recommend that you take some time to read it carefully. If you have any questions about the content of this document, or if you need further assistance, please contact an administrator or relevant personnel. Contributors *sign-off* that they adhere to these requirements by adding a `Signed-off-by` line to commit messages.
Git even has a `-s` command line option to append this automatically to your commit message:
```bash
git commit -s -m "docs: this is my commit message"
```
You can also automate signing off your commits by adding the following to your `.zshrc` or `.bashrc`: You can also automate signing off your commits by adding the following to your `.zshrc` or `.bashrc`:
```go ```bash
cat ~/.bashrc || cat ~/.zshrc
git() { git() {
if [ $# -gt 0 ] && [[ "$1" == "commit" ]] ; then if [ $# -gt 0 ] && [[ "$1" == "commit" ]] ; then
shift shift
@ -289,16 +307,38 @@ git() {
``` ```
#### CI actions
We host CI on [GitHub Actions](https://github.com/OpenIMSDK/Open-IM-Server/actions), we will make sure PR pass tests before we can merge it.
These two kind of tests: `lint` and `unit test`
`lint` tests if your code matches our code conventions, please consult [golangci-lint](https://golangci-lint.run/) and [lint config](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/.golangci.yml)
> **Note**
>
> You can use the [Makefile](./Makefile) to run Lint with the command `make lint`.
`unit test` runs all the test in code, and the code coverage should not less than 60 percent, record us in [codeclimate](https://codeclimate.com/github/OpenIMSDK/Open-IM-Server) Open-IM-Server the unit test coverage data.
> **Note**
>
> We use the [Makefile](./Makefile) utility, `make tese` to run the unit tests, and the `make cover` utility to check the unit test coverage.
Try your best to keep every function has been tested, it keeps the function behaves as intended.
#### Docs Contribution #### Docs Contribution
The documentation for Open-IM-Server includes: **The documentation for Open-IM-Server includes:**
+ [README.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/README.md): This file includes the basic information and instructions for getting started with Open-IM-Server. + [README.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/README.md): This file includes the basic information and instructions for getting started with Open-IM-Server.
+ [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to Open-IM-Server's codebase, such as how to submit issues, pull requests, and code reviews. + [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md): This file contains guidelines for contributing to Open-IM-Server's codebase, such as how to submit issues, pull requests, and code reviews.
+ [DEVELOPGUIDE.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/DEVELOPGUIDE.md): This file provides a more in-depth guide to developing Open-IM-Server, including information on the project's architecture, coding conventions, and testing practices. + [DEVELOPGUIDE.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/DEVELOPGUIDE.md): This file provides a more in-depth guide to developing Open-IM-Server, including information on the project's architecture, coding conventions, and testing practices.
+ [Official Documentation](https://doc.rentsoft.cn/): This is the official documentation for Open-IM-Server, which includes comprehensive information on all of its features, configuration options, and troubleshooting tips. + [Official Documentation](https://doc.rentsoft.cn): This is the official documentation for Open-IM-Server, which includes comprehensive information on all of its features, configuration options, and troubleshooting tips.
Please obey the following rules to better format the docs, which would greatly improve the reading experience. **Please obey the following rules to better format the docs, which would greatly improve the reading experience.**
1. Please do not use Chinese punctuations in English docs, and vice versa. 1. Please do not use Chinese punctuations in English docs, and vice versa.
2. Please use upper case letters where applicable, like the first letter of sentences / headings, etc. 2. Please use upper case letters where applicable, like the first letter of sentences / headings, etc.
@ -307,9 +347,18 @@ Please obey the following rules to better format the docs, which would greatly i
5. Please use the correct case for technical terms, such as using `HTTP` instead of http, `MySQL` rather than mysql, `Kubernetes` instead of kubernetes, etc. 5. Please use the correct case for technical terms, such as using `HTTP` instead of http, `MySQL` rather than mysql, `Kubernetes` instead of kubernetes, etc.
6. Please check if there's any typos in the docs before submitting PRs. 6. Please check if there's any typos in the docs before submitting PRs.
**Markfile Lint:**
We integrated in the CICD actions [markdownlint](https://github.com/markdownlint/markdownlint), it detects Markfile specification.
> **Note**
> We recommend reading [markdownlint rules](https://github.com/markdownlint/markdownlint/blob/main/docs/RULES.md), This document contains a description of all rules, what they are checking for, as well as an examples of documents that break the rule and corrected versions of the examples.
## Engage to help anything ## Engage to help anything
We choose GitHub as the primary place for Open-IM-Server to collaborate. So the latest updates of Open-IM-Server are always here. Although contributions via PR is an explicit way to help, we still call for any other ways. We choose GitHub as the primary place for Open-IM-Server to collaborate. So the latest updates of Open-IM-Server are always here. Although contributions via **PR** is an explicit way to help, we still call for any other ways.
+ reply to other's [issues](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) if you could; + reply to other's [issues](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) if you could;
+ help solve other user's problems; + help solve other user's problems;
@ -320,16 +369,18 @@ We choose GitHub as the primary place for Open-IM-Server to collaborate. So the
In a word, **ANY HELP IS CONTRIBUTION.** In a word, **ANY HELP IS CONTRIBUTION.**
## Release version ## Release version
Releases of Open-IM-Server are done using [Release Please](https://github.com/googleapis/release-please) and [GoReleaser](https://goreleaser.com/). The workflow looks like this: Releases of Open-IM-Server are done using [Release Please](https://github.com/googleapis/release-please) and [GoReleaser](https://goreleaser.com/). The workflow looks like this:
🎯 A PR is merged to the `main` branch: 🎯 **A PR is merged to the `main` branch:**
+ Release please is triggered, creates or updates a new release PR + Release please is triggered, creates or updates a new release PR
+ This is done with every merge to main, the current release PR is updated every time + This is done with every merge to main, the current release PR is updated every time
🎯 Merging the 'release please' PR to `main`: 🎯 **Merging the 'release please' PR to `main`:**
+ Release please is triggered, creates a new release and updates the changelog based on the commit messages + Release please is triggered, creates a new release and updates the changelog based on the commit messages
+ GoReleaser is triggered, builds the binaries and attaches them to the release + GoReleaser is triggered, builds the binaries and attaches them to the release
@ -337,7 +388,7 @@ Releases of Open-IM-Server are done using [Release Please](https://github.com/go
With the next relevant merge, a new release PR will be created and the process starts again With the next relevant merge, a new release PR will be created and the process starts again
**👀 Manually setting the version:** 👀 **Manually setting the version:**
If you want to manually set the version, you can create a PR with an empty commit message that contains the version number in the commit message. For example: If you want to manually set the version, you can create a PR with an empty commit message that contains the version number in the commit message. For example:
@ -355,7 +406,7 @@ Our most recommended way to get in touch is through [Slack](https://join.slack.c
In addition to Slack, we also offer the following ways to get in touch: In addition to Slack, we also offer the following ways to get in touch:
+ <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" target="_blank"><img src="https://img.shields.io/badge/slack-%40OpenIMSDKCore-informational?logo=slack&style=flat-square"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel. + <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg" target="_blank"><img src="https://img.shields.io/badge/Slack-OpenIM%2B-blueviolet?logo=slack&amp;logoColor=white"></a>: We also have Slack channels for you to communicate and discuss. To join, visit https://slack.com/ and join our [👀 Open-IM-Server slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg) team channel.
+ <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email. + <a href="https://mail.google.com/mail/u/0/?fs=1&tf=cm&to=4closetool3@gmail.com" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail](winxu81@gmail.com). If you have any questions or issues that need resolving, or any suggestions and feedback for our open source projects, please feel free to contact us via email.
+ <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information. + <a href="https://doc.rentsoft.cn/" target="_blank"><img src="https://img.shields.io/badge/%E5%8D%9A%E5%AE%A2-%40OpenIMSDKCore-blue?style=social&logo=Octopus%20Deploy"></a>: Read our [blog](https://doc.rentsoft.cn/). Our blog is a great place to stay up-to-date with Open-IM-Server projects and trends. On the blog, we share our latest developments, tech trends, and other interesting information.
+ <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible. + <a href="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" target="_blank"><img src="https://img.shields.io/badge/%E5%BE%AE%E4%BF%A1-OpenIMSDKCore-brightgreen?logo=wechat&style=flat-square"></a>: Add [Wechat](https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg) and indicate that you are a user or developer of Open-IM-Server. We will process your request as soon as possible.

@ -23,13 +23,13 @@ VERSION_PACKAGE=github.com/OpenIMSDK/Open-IM-Server/pkg/version
# ============================================================================== # ==============================================================================
# Includes # Includes
include scripts/make-rules/common.mk # make sure include common.mk at the first include line include script/make-rules/common.mk # make sure include common.mk at the first include line
include scripts/make-rules/golang.mk include script/make-rules/golang.mk
include scripts/make-rules/image.mk include script/make-rules/image.mk
include scripts/make-rules/copyright.mk include script/make-rules/copyright.mk
include scripts/make-rules/gen.mk include script/make-rules/gen.mk
include scripts/make-rules/dependencies.mk include script/make-rules/dependencies.mk
include scripts/make-rules/tools.mk include script/make-rules/tools.mk
# ============================================================================== # ==============================================================================
# Usage # Usage

@ -137,7 +137,7 @@ all services build success
### SCRIPT DESCRIPTION ### SCRIPT DESCRIPTION
> Open-IM script provides service compilation, start, and stop scripts. There are four Open-IM script start modules, one is the http+rpc service start module, the second is the websocket service start module, then the msg_transfer module, and the last is the push module > Open-IM script provides service compilation, start, and stop script. There are four Open-IM script start modules, one is the http+rpc service start module, the second is the websocket service start module, then the msg_transfer module, and the last is the push module
- path_info.cfg&&style_info.cfg&&functions.sh - path_info.cfg&&style_info.cfg&&functions.sh
- Contains the path information of each module, including the path where the source code is located, the name of the service startup, the shell print font style, and some functions for processing shell strings - Contains the path information of each module, including the path where the source code is located, the name of the service startup, the shell print font style, and some functions for processing shell strings

@ -30,7 +30,7 @@ RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure
#set directory to map logs,config file,script file. #set directory to map logs,config file,script file.
VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"] VOLUME ["/Open-IM-Server/logs","/Open-IM-Server/config","/Open-IM-Server/script","/Open-IM-Server/db/sdk"]
#Copy scripts files and binary files to the blank image #Copy script files and binary files to the blank image
COPY --from=build /Open-IM-Server/script /Open-IM-Server/script COPY --from=build /Open-IM-Server/script /Open-IM-Server/script
COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin COPY --from=build /Open-IM-Server/bin /Open-IM-Server/bin

@ -0,0 +1,62 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Makefile helper functions for common tasks
#
# ==============================================================================
# Makefile helper functions for common tasks
# Help information for the makefile package
define makehelp
@printf "\n\033[1mUsage: make <TARGETS> <OPTIONS> ...\033[0m\n\n\\033[1mTargets:\\033[0m\n\n"
@sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-28s\033[0m %s\n", $$1, $$2}' | sed -e 's/^/ /'
@printf "\n\033[1m$$USAGE_OPTIONS\033[0m\n"
endef
# Here are some examples of builds
define MAKEFILE_EXAMPLE
# make build BINS=imctl Only a single imctl binary is built.
# make -j $(nproc) all Run tidy gen add-copyright format lint cover build concurrently.
# make gen Generate all necessary files.
# make linux.arm64 imctl is compiled on arm64 platform.
# make verify-copyright Verify the license headers for all files.
# make install-deepcopy-gen Install deepcopy-gen tools if the license is missing.
# make build BINS=imctl V=1 DEBUG=1 Build debug binaries for only imctl.
# make multiarch PLATFORMS="linux_arm64 linux_amd64" V=1 Build binaries for both platforms.
endef
export MAKEFILE_EXAMPLE
# Define all help functions @printf "\n\033[1mCurrent imctl version information: $(shell imctl version):\033[0m\n\n"
define makeallhelp
@printf "\n\033[1mMake example:\033[0m\n\n"
$(call MAKEFILE_EXAMPLE)
@printf "\n\033[1mAriables:\033[0m\n\n"
@echo " DEBUG: $(DEBUG)"
@echo " BINS: $(BINS)"
@echo " PLATFORMS: $(PLATFORMS)"
@echo " V: $(V)"
endef
# Help information for other makefile packages
CUT_OFF?="---------------------------------------------------------------------------------"
HELP_NAME:=$(shell basename $(MAKEFILE_LIST))
define smallhelp
@sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-35s\033[0m %s\n", $$1, $$2}' | sed -e 's/^/ /'
@echo $(CUT_OFF)
endef

@ -0,0 +1,59 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
#
# ==============================================================================
# wget https://github.com/google/addlicense/releases/download/v1.0.0/addlicense_1.0.0_Linux_x86_64.tar.gz
# Makefile helper functions for copyright
#
LICENSE_TEMPLATE ?= $(ROOT_DIR)/script/LICENSE_TEMPLATE
# TODO: GOBIN -> TOOLS_DIR
# Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181
## copyright.verify: Validate boilerplate headers for assign files
.PHONY: copyright.verify
copyright.verify: tools.verify.addlicense
@echo "===========> Validate boilerplate headers for assign files starting in the $(ROOT_DIR) directory"
@$(GOBIN)/addlicense -v -check -ignore **/test/** -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@echo "===========> End of boilerplate headers check..."
## copyright.add: Add the boilerplate headers for all files
.PHONY: copyright.add
copyright.add: tools.verify.addlicense
@echo "===========> Adding $(LICENSE_TEMPLATE) the boilerplate headers for all files"
@$(GOBIN)/addlicense -y $(shell date +"%Y") -v -c "Alibaba Group Holding Ltd." -f $(LICENSE_TEMPLATE) $(CODE_DIRS)
@echo "===========> End the copyright is added..."
# Addlicense Flags:
# -c string
# copyright holder (default "Google LLC")
# -check
# check only mode: verify presence of license headers and exit with non-zero code if missing
# -f string
# license file
# -ignore value
# file patterns to ignore, for example: -ignore **/*.go -ignore vendor/**
# -l string
# license type: apache, bsd, mit, mpl (default "apache")
# -s Include SPDX identifier in license header. Set -s=only to only include SPDX identifier.
# -skip value
# [deprecated: see -ignore] file extensions to skip, for example: -skip rb -skip go
# -v verbose mode: print the name of the files that are modified or were skipped
# -y string
# copyright year(s) (default "2023")
## copyright.help: Show copyright help
.PHONY: copyright.help
copyright.help: script/make-rules/copyright.mk
$(call smallhelp)

@ -0,0 +1,36 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Makefile helper functions for dependencies
#
.PHONY: dependencies.run
dependencies.run: dependencies.packages dependencies.tools
.PHONY: dependencies.packages
dependencies.packages:
@$(GO) mod tidy
.PHONY: dependencies.tools
dependencies.tools: dependencies.tools.blocker dependencies.tools.critical
.PHONY: dependencies.tools.blocker
dependencies.tools.blocker: go.build.verify $(addprefix tools.verify., $(BLOCKER_TOOLS))
.PHONY: dependencies.tools.critical
dependencies.tools.critical: $(addprefix tools.verify., $(CRITICAL_TOOLS))
.PHONY: dependencies.tools.trivial
dependencies.tools.trivial: $(addprefix tools.verify., $(TRIVIAL_TOOLS))

@ -0,0 +1,25 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Makefile helper functions for generate necessary files and docs
# https://cloud.redhat.com/blog/kubernetes-deep-dive-code-generation-customresources
# ! The stock of code generated by `make gen` should be idempotent
#
## gen.help: show help for gen
.PHONY: gen.help
gen.help: script/make-rules/gen.mk
$(call smallhelp)

@ -0,0 +1,22 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Build management helpers. These functions help to set, save and load the
#
## copyright.help: Show copyright help
.PHONY: go.help
go.help: script/make-rules/golang.mk
$(call smallhelp)

@ -0,0 +1,27 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Makefile helper functions for docker image
# TODO: For the time being only used for compilation, it can be arm or amd, please do not delete it, it can be extended with new functions
# ==============================================================================
# Path: script/make-rules/image.mk
# docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/<image-name>:<tag>
#
## image.help: Print help for image targets
.PHONY: image.help
image.help: script/make-rules/image.mk
$(call smallhelp)

@ -0,0 +1,202 @@
# Copyright © 2023 OpenIMSDK.
#
# Licensed 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.
# ==============================================================================
# Makefile helper functions for tools(https://github.com/avelino/awesome-go) -> DIR: {TOOT_DIR}/tools | (go >= 1.19)
# Why download to the tools directory, thinking we might often switch Go versions using gvm.
#
# sealer build use BUILD_TOOLS
BUILD_TOOLS ?= golangci-lint goimports addlicense deepcopy-gen conversion-gen ginkgo go-junit-report
# Code analysis tools
ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score
# Code generation tools
GENERATION_TOOLS = deepcopy-gen conversion-gen protoc-gen-go cfssl rts codegen
# Testing tools
TEST_TOOLS = ginkgo go-junit-report gotests
# Version control tools
VERSION_CONTROL_TOOLS = addlicense go-gitlint git-chglog github-release gsemver
# Utility tools
UTILITY_TOOLS = go-mod-outdated mockgen gothanks richgo kubeconform
# All tools
ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS)
## tools.install: Install a must tools
.PHONY: tools.install
tools.install: $(addprefix tools.install., $(BUILD_TOOLS))
## tools.install-all: Install all tools
.PHONY: tools.install-all
tools.install-all: $(addprefix tools.install-all., $(ALL_TOOLS))
## tools.install.%: Install a single tool in $GOBIN/
.PHONY: tools.install.%
tools.install.%:
@echo "===========> Installing $,The default installation path is $(GOBIN)/$*"
@$(MAKE) install.$*
## tools.install-all.%: Parallelism install a single tool in ./tools/*
.PHONY: tools.install-all.%
tools.install-all.%:
@echo "===========> Installing $,The default installation path is $(TOOLS_DIR)/$*"
@$(MAKE) -j $(nproc) install.$*
## tools.verify.%: Check if a tool is installed and install it
.PHONY: tools.verify.%
tools.verify.%:
@echo "===========> Verifying $* is installed"
@if [ ! -f $(TOOLS_DIR)/$* ]; then GOBIN=$(TOOLS_DIR) $(MAKE) tools.install.$*; fi
@echo "===========> $* is install in $(TOOLS_DIR)/$*"
.PHONY:
## install.golangci-lint: Install golangci-lint
install.golangci-lint:
@$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
## install.goimports: Install goimports, used to format go source files
.PHONY: install.goimports
install.goimports:
@$(GO) install golang.org/x/tools/cmd/goimports@latest
# Actions path: https://github.com/sealerio/sealer/tree/main/.github/workflows/go.yml#L37-L50
## install.addlicense: Install addlicense, used to add license header to source files
.PHONY: install.addlicense
install.addlicense:
@$(GO) install github.com/google/addlicense@latest
## install.deepcopy-gen: Install deepcopy-gen, used to generate deep copy functions
.PHONY: install.deepcopy-gen
install.deepcopy-gen:
@$(GO) install k8s.io/code-generator/cmd/deepcopy-gen@latest
## install.conversion-gen: Install conversion-gen, used to generate conversion functions
.PHONY: install.conversion-gen
install.conversion-gen:
@$(GO) install k8s.io/code-generator/cmd/conversion-gen@latest
## install.ginkgo: Install ginkgo to run a single test or set of tests
.PHONY: install.ginkgo
install.ginkgo:
@$(GO) install github.com/onsi/ginkgo/ginkgo@v1.16.2
## install.go-junit-report: Install go-junit-report, used to convert go test output to junit xml
.PHONY: install.go-junit-report
install.go-junit-report:
@$(GO) install github.com/jstemmer/go-junit-report@latest
# ==============================================================================
# Tools that might be used include go gvm
#
## install.kube-score: Install kube-score, used to check kubernetes yaml files
.PHONY: install.kube-score
install.kube-score:
@$(GO) install github.com/zegl/kube-score/cmd/kube-score@latest
## install.kubeconform: Install kubeconform, used to check kubernetes yaml files
.PHONY: install.kubeconform
install.kubeconform:
@$(GO) install github.com/yannh/kubeconform/cmd/kubeconform@latest
## Install go-gitlint: Install go-gitlint, used to check git commit message
.PHONY: install.go-gitlint
install.go-gitlint:
@$(GO) install github.com/marmotedu/go-gitlint/cmd/go-gitlint@latest
## install.gsemver: Install gsemver, used to generate semver
.PHONY: install.gsemver
install.gsemver:
@$(GO) install github.com/arnaud-deprez/gsemver@latest
## install.git-chglog: Install git-chglog, used to generate changelog
.PHONY: install.git-chglog
install.git-chglog:
@$(GO) install github.com/git-chglog/git-chglog/cmd/git-chglog@latest
## install.github-release: Install github-release, used to create github release
.PHONY: install.github-release
install.github-release:
@$(GO) install github.com/github-release/github-release@latest
## install.gvm: Install gvm, gvm is a Go version manager, built on top of the official go tool.
.PHONY: install.gvm
install.gvm:
@echo "===========> Installing gvm,The default installation path is ~/.gvm/script/gvm"
@bash < <(curl -s -S -L https://raw.gitee.com/moovweb/gvm/master/binscripts/gvm-installer)
@$(shell source /root/.gvm/script/gvm)
## install.golines: Install golines, used to format long lines
.PHONY: install.golines
install.golines:
@$(GO) install github.com/segmentio/golines@latest
## install.go-mod-outdated: Install go-mod-outdated, used to check outdated dependencies
.PHONY: install.go-mod-outdated
install.go-mod-outdated:
@$(GO) install github.com/psampaz/go-mod-outdated@latest
## install.mockgen: Install mockgen, used to generate mock functions
.PHONY: install.mockgen
install.mockgen:
@$(GO) install github.com/golang/mock/mockgen@latest
## install.gotests: Install gotests, used to generate test functions
.PHONY: install.gotests
install.gotests:
@$(GO) install github.com/cweill/gotests/gotests@latest
## install.protoc-gen-go: Install protoc-gen-go, used to generate go source files from protobuf files
.PHONY: install.protoc-gen-go
install.protoc-gen-go:
@$(GO) install github.com/golang/protobuf/protoc-gen-go@latest
## install.cfssl: Install cfssl, used to generate certificates
.PHONY: install.cfssl
install.cfssl:
@$(ROOT_DIR)/script/install/install.sh iam::install::install_cfssl
## install.depth: Install depth, used to check dependency tree
.PHONY: install.depth
install.depth:
@$(GO) install github.com/KyleBanks/depth/cmd/depth@latest
## install.go-callvis: Install go-callvis, used to visualize call graph
.PHONY: install.go-callvis
install.go-callvis:
@$(GO) install github.com/ofabry/go-callvis@latest
## install.gothanks: Install gothanks, used to thank go dependencies
.PHONY: install.gothanks
install.gothanks:
@$(GO) install github.com/psampaz/gothanks@latest
## install.richgo: Install richgo
.PHONY: install.richgo
install.richgo:
@$(GO) install github.com/kyoh86/richgo@latest
## install.rts: Install rts
.PHONY: install.rts
install.rts:
@$(GO) install github.com/galeone/rts/cmd/rts@latest
## install.codegen: Install code generator, used to generate code
.PHONY: install.codegen
install.codegen:
@$(GO) install ${ROOT_DIR}/tools/codegen/codegen.go
## tools.help: Display help information about the tools package
.PHONY: tools.help
tools.help: script/make-rules/tools.mk
$(call smallhelp)
Loading…
Cancel
Save