From 3742973e3d215727b79b34e02d5d9ee155a66eea Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Mon, 3 Jul 2023 22:48:52 +0800 Subject: [PATCH] feat: add feature Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .github/workflows/golangci-link.yml | 51 ++++++++++++++++++ .github/workflows/image.yml | 81 +++++++++++++++++++++++++++++ CONTRIBUTING.md | 36 ++++++++----- README-zh_CN.md | 2 +- 4 files changed, 156 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/golangci-link.yml create mode 100644 .github/workflows/image.yml diff --git a/.github/workflows/golangci-link.yml b/.github/workflows/golangci-link.yml new file mode 100644 index 000000000..057dcff74 --- /dev/null +++ b/.github/workflows/golangci-link.yml @@ -0,0 +1,51 @@ +# Copyright © 2023 OpenIM open source community. All rights reserved. +# +# 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. + + +name: OpenKF golangci-lint +on: + push: + branches: [main] + pull_request: + branches: [main] +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: '1.20' + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Require: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: v1.53 + + # Optional: working directory, useful for monorepos + working-directory: server + + # Optional: golangci-lint command line arguments. + # + # Note: by default the `.golangci.yml` file should be at the root of the repository. + # The location of the configuration file can be changed by using `--config=` + # args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + only-new-issues: true + + # Optional:The mode to install golangci-lint. It can be 'binary' or 'goinstall'. + install-mode: "goinstall" \ No newline at end of file diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 000000000..f6d02cf63 --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,81 @@ +name: Build Image + +on: + push: + branches: + - main + paths: + - "**.go" + - "!**_test.go" + - "build/**" + tags: + - v* + +jobs: + release: + strategy: + matrix: + components: [core, swagger] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 20 + - uses: dorny/paths-filter@v2 + if: ${{ !startsWith(github.ref_name, 'v') }} + id: changes + with: + filters: | + go: + - '**.go' + - 'build/core/Dockerfile' + api: + - 'openapi/**' + - 'build/swagger/build.sh' + - 'build/swagger/Dockerfile' + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + flavor: | + latest=false + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/openimsdk-${{ matrix.components }} + registry.cn-hangzhou.aliyuncs.com/${{ secrets.ALIREGISTRY_NAMESPACE }}/openimsdk-${{ matrix.components }} + tags: | + type=ref,event=branch + type=sha,prefix={{branch}}-,enable=${{ github.ref_type == 'branch' }} + type=ref,event=tag + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to Ali Container Registry + uses: docker/login-action@v2 + with: + registry: registry.cn-hangzhou.aliyuncs.com + username: ${{ secrets.ALIREGISTRY_USERNAME }} + password: ${{ secrets.ALIREGISTRY_TOKEN }} + + - name: Condition + id: condition + run: | + echo "run=${{ startsWith(github.ref_name, 'v') || ((steps.changes.outputs.go == 'true' && (matrix.components == 'core' || matrix.components == 'job')) || (steps.changes.outputs.api == 'true' && matrix.components == 'swagger')) }}" >> $GITHUB_OUTPUT + + - name: Set up QEMU + if: ${{ steps.condition.outputs.run == 'true' }} + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + if: ${{ steps.condition.outputs.run == 'true' }} + uses: docker/setup-buildx-action@v2 + - name: Build and push + if: ${{ steps.condition.outputs.run == 'true' }} + uses: docker/build-push-action@v3 + with: + context: . + file: ./build/${{ matrix.components }}/Dockerfile + platforms: linux/amd64 + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 215721b19..21359aff6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,13 +8,23 @@ This document provides guidelines and best practices to help you contribute effe ## 📇Topics -- [What we expect of you](#What-we-expect-of-you) -- [Code of Conduct](#Code-of-Conduct) -- [Getting Started](#Getting-Started) -- [Style and Specification](#Style-and-Specification) -- [Engage to help anything](#Engage-to-help-anything) -- [Release version](#Release-version) -- [Contact Us](#Contact-Us) +- [Contributing to Open-IM-Server](#contributing-to-open-im-server) + - [📇Topics](#topics) + - [What we expect of you](#what-we-expect-of-you) + - [Code of ConductCode of Conduct](#code-of-conductcode-of-conduct) + - [Code and doc contribution](#code-and-doc-contribution) + - [Where should I start?](#where-should-i-start) + - [Design documents](#design-documents) + - [Getting Started](#getting-started) + - [Style and Specification](#style-and-specification) + - [Reporting security issues](#reporting-security-issues) + - [Reporting general issues](#reporting-general-issues) + - [Commit Rules](#commit-rules) + - [PR Description](#pr-description) + - [Docs Contribution](#docs-contribution) + - [Engage to help anything](#engage-to-help-anything) + - [Release version](#release-version) + - [Contact Us](#contact-us) ## What we expect of you @@ -32,7 +42,7 @@ The [Makefile](./Makefile) is for every developer, even if you don't know how to #### Code and doc contribution -Every action to make project Open-IM-Server better is encouraged. On GitHub, every improvement for Open-IM-Server could be via a [PR](https://github.com/Open-IM-Server/pulls) (short for pull request). +Every action to make project Open-IM-Server better is encouraged. On GitHub, every improvement for Open-IM-Server could be via a [PR](https://github.com/OpenIMSDK/Open-IM-Server/pulls) (short for pull request). + If you find a typo, try to fix it! + If you find a bug, try to fix it! @@ -48,7 +58,7 @@ Every action to make project Open-IM-Server better is encouraged. On GitHub, eve #### Where should I start? + If you are new to the project, don't know how to contribute Open-IM-Server, please check out the [good first issue](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aopen+label%3A"good+first+issue"+sort%3Aupdated-desc) label. -+ You should be good at filtering the Open-IM-Server issue tags and finding the ones you like, such as [RFC](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+label%3Afeature) proposals, and [bug](https://github.com/{github/issues?q=is%3Aissue+label%3Abug+) fixes. ++ You should be good at filtering the Open-IM-Server issue tags and finding the ones you like, such as [RFC](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+RFC+label%3ARFC) for big initiatives, features for [feature](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+label%3Afeature) proposals, and [bug](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+label%3Abug+) fixes. + If you are looking for something to work on, check out our [open issues](https://github.com/OpenIMSDK/Open-IM-Server/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc). + If you have an idea for a new feature, please [open an issue](https://github.com/OpenIMSDK/Open-IM-Server/issues/new/choose), and we can discuss it. @@ -180,7 +190,7 @@ To be honest, we regard every user of Open-IM-Serveras a very kind contributor. Since we collaborate project Open-IM-Server in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](https://github.com/OpenIMSDK/Open-IM-Server/tree/main/.github/ISSUE_TEMPLATE) for issue reporters. You can find three kinds of issue templates there: question, bug report and feature request. Please **BE SURE** to follow the instructions to fill fields in template. +To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](https://github.com/OpenIMSDK/.github/tree/main/.github/ISSUE_TEMPLATE) for issue reporters. You can find three kinds of issue templates there: question, bug report and feature request. Please **BE SURE** to follow the instructions to fill fields in template. **There are a lot of cases when you could open an issue:** @@ -242,7 +252,7 @@ An example for this could be: #### 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/.github/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. @@ -295,7 +305,7 @@ 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. + [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/.github/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. Please obey the following rules to better format the docs, which would greatly improve the reading experience. @@ -315,7 +325,7 @@ We choose GitHub as the primary place for Open-IM-Server to collaborate. So the + help solve other user's problems; + help review other's [PR](https://github.com/OpenIMSDK/Open-IM-Server/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) design; + discuss about Open-IM-Server to make things clearer; -+ advocate [Open-IM-Server](google.com/search?q=Open-IM-Server) technology beyond GitHub; ++ advocate [Open-IM-Server](https://google.com/search?q=Open-IM-Server) technology beyond GitHub; + write blogs on Open-IM-Server and so on. In a word, **ANY HELP IS CONTRIBUTION.** diff --git a/README-zh_CN.md b/README-zh_CN.md index 1308ef28b..87d675c88 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -19,7 +19,7 @@

English • - 中文 + 中文