Skip to content

Commit

Permalink
☀️ feat: Enhancing OpenIM with Integrated E2E Testing and CI/CD Enhan…
Browse files Browse the repository at this point in the history
…cements (#1359)

* cicd: robot automated Change

* feat: add api test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add api test make file

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add openim e2e test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add openim e2e test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* fix: Fixed some unused scripts and some names

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* docs: optimize openim docs

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add prom address

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add openim info test

* feat: add openim images config path

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* fix: fix tim file rename

* fix: fix tim file rename

* fix: fix tim file rename

* fix: fix tim file rename

* fix: add openim test e2e

* feat: add openim test .keep

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: add openim test .keep

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: openim test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: openim test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

* feat: openim test

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>

---------

Signed-off-by: Xinwei Xiong(cubxxw) <[email protected]>
Co-authored-by: cubxxw <[email protected]>
  • Loading branch information
cubxxw and cubxxw authored Nov 10, 2023
1 parent 686fa80 commit e2004c1
Show file tree
Hide file tree
Showing 154 changed files with 3,992 additions and 900 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ PASSWORD=openIM123
MINIO_ENDPOINT=http://172.28.0.1:10005

# Base URL for the application programming interface (API).
# Default: API_URL=http://172.28.0.1:10002
API_URL=http://172.28.0.1:10002
# Default: API_URL=http://172.0.0.1:10002
API_URL=http://172.0.0.1:10002

# Directory path for storing data files or related information.
# Default: DATA_DIR=./
Expand Down
18 changes: 17 additions & 1 deletion .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@ coverage:
paths:
- pkg/* # only include coverage in "pkg/" folder
informational: true # Always pass check
patch: off # disable the commit only checks
tools: # declare a new status context "tools"
paths:
- tools/* # only include coverage in "tools/" folder
informational: true # Always pass check
test: # declare a new status context "test"
paths:
- test/* # only include coverage in "test/" folder
informational: true # Always pass check
# internal: # declare a new status context "internal"
# paths:
# - internal/* # only include coverage in "internal/" folder
# informational: true # Always pass check
# cmd: # declare a new status context "cmd"
# paths:
# - cmd/* # only include coverage in "cmd/" folder
# informational: true # Always pass check
patch: off # disable the commit only checks
90 changes: 90 additions & 0 deletions .github/workflows/api-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright © 2023 OpenIM. 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: OpenIM API TEST

on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
pull_request:
branches:
- main
paths-ignore:
- "README.md"
- "README_zh-CN.md"
- "CONTRIBUTING.md"
- "docs/**"

env:
GO_VERSION: "1.19"
GOLANGCI_VERSION: "v1.50.1"

jobs:
execute-linux-systemd-scripts:
name: Execute OpenIM script on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment:
name: openim
strategy:
matrix:
go_version: ["1.20"]
os: ["ubuntu-latest"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Install Task
uses: arduino/setup-task@v1
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Operations
run: |
curl -o docker-compose.yml https://raw.githubusercontent.com/OpenIMSDK/openim-docker/main/example/basic-openim-server-dependency.yml
sudo docker compose up -d
sudo sleep 60
- name: Module Operations
run: |
sudo make tidy
sudo make tools.verify.go-gitlint
- name: Build, Start, Check Services and Print Logs
run: |
sudo ./scripts/install/install.sh -i && \
sudo ./scripts/install/install.sh -s && \
(echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
- name: Run Test
run: |
sudo make test-api && \
(echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
- name: Stop Services
run: |
sudo ./scripts/install/install.sh -u && \
(echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
14 changes: 14 additions & 0 deletions .github/workflows/create_branch_on_tag.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright © 2023 OpenIM. 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: Create Branch on Tag

on:
Expand Down
60 changes: 58 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: OpenIM E2E Test
name: OpenIM Linux System E2E Test

on:
workflow_dispatch:
Expand Down Expand Up @@ -41,4 +41,60 @@ jobs:

- name: Create e2e test
run: |
echo "...test e2e"
echo "...test e2e"
execute-linux-systemd-scripts:
name: Execute OpenIM script on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
environment:
name: openim
strategy:
matrix:
go_version: ["1.20"]
os: ["ubuntu-latest"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Install Task
uses: arduino/setup-task@v1
with:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Operations
run: |
curl -o docker-compose.yml https://raw.githubusercontent.com/OpenIMSDK/openim-docker/main/example/basic-openim-server-dependency.yml
sudo docker compose up -d
sudo sleep 60
- name: Module Operations
run: |
sudo make tidy
sudo make tools.verify.go-gitlint
- name: Build, Start
run: |
sudo ./scripts/install/install.sh -i
- name: Exec OpenIM System Status Chack
run: |
sudo ./scripts/install/install.sh -s
- name: Exec OpenIM API test
run: |
sudo make test-api
- name: Exec OpenIM E2E test
run: |
sudo make test-e2e
- name: Exec OpenIM System uninstall
run: |
sudo ./scripts/install/install.sh -u
33 changes: 19 additions & 14 deletions .github/workflows/openimci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ jobs:
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 2.x
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Module Operations
run: |
Expand Down Expand Up @@ -122,7 +123,8 @@ jobs:
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 2.x
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run OpenIM make install start
run: |
sudo make install
Expand All @@ -145,10 +147,13 @@ jobs:
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 2.x
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Operations
run: |
curl -o docker-compose.yml https://raw.githubusercontent.com/OpenIMSDK/openim-docker/main/example/basic-openim-server-dependency.yml
Expand All @@ -160,18 +165,15 @@ jobs:
sudo make tidy
sudo make tools.verify.go-gitlint
- name: Build, Start and Check Services
- name: Build, Start, Check Services and Print Logs
run: |
sudo make init
sudo make build
sudo make start
sudo make check
- name: Print OpenIM Logs
run: sudo cat ./_output/logs/* 2>/dev/null
continue-on-error: true
sudo make init && \
sudo make build && \
sudo make start && \
sudo make check || \
(echo "An error occurred, printing logs:" && sudo cat ./_output/logs/* 2>/dev/null)
openim-build-image:
openim-test-build-image:
name: Build OpenIM Docker Image
runs-on: ubuntu-latest
environment:
Expand All @@ -184,10 +186,13 @@ jobs:
with:
go-version: ${{ matrix.go_version }}
id: go

- name: Install Task
uses: arduino/setup-task@v1
with:
version: 2.x
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Test Docker Build
run: |
sudo make image
2 changes: 1 addition & 1 deletion CHANGELOG/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ All notable changes to this project will be documented in this file.

## OpenIM versioning policy

+ [OpenIM Version](../docs/conversions/version.md)
+ [OpenIM Version](../docs/contrib/version.md)

## command

Expand Down
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ If you are familiar with [Makefile](./Makefile) , you can easily see the clever

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.

In accordance with the naming conventions adopted by OpenIM and drawing reference from the Google Naming Conventions as per the guidelines available at https://google.github.io/styleguide/go/, the following expectations for naming practices within the project are set forth:

+ https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/code-conventions.md
+ https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/go-code.md


## Code of ConductCode of Conduct

#### Code and doc contribution
Expand Down Expand Up @@ -270,7 +276,7 @@ You can find some very formal PR in [RFC](https://github.com/openimsdk/open-im-s
**🈴 Reviewing PRs:**

+ Be respectful and constructive
+ Assign yourself to the PR
+ Assign yourself to the PR (comment `/assign`)
+ Check if all checks are passing
+ Suggest changes instead of simply commenting on found issues
+ If you are unsure about something, ask the author
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## all: Run tidy, gen, add-copyright, format, lint, cover, build ✨
.PHONY: all
all: tidy gen add-copyright verify lint cover restart
all: tidy gen add-copyright verify test-api lint cover restart

# ==============================================================================
# Build set
Expand Down Expand Up @@ -166,6 +166,15 @@ test:
cover:
@$(MAKE) go.test.cover

## test-api: Run api test. ✨
.PHONY: test-api
test-api:
@$(MAKE) go.test.api

## test-e2e: Run e2e test
test-e2e:
@$(MAKE) go.test.e2e

## updates: Check for updates to go.mod dependencies. ✨
.PHONY: updates
@$(MAKE) go.updates
Expand Down
14 changes: 7 additions & 7 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ OpenIM 我们的目标是建立一个顶级的开源社区。我们有一套标

在开始之前,请确保你的更改是有需求的。最好的方法是创建一个[新的讨论](https://github.com/openimsdk/open-im-server/discussions/new/choose)[Slack 通信](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q),或者如果你发现一个问题,首先[报告它](https://github.com/openimsdk/open-im-server/issues/new/choose)

+ [代码标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/go_code.md)
+ [代码标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/go-code.md)

+ [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md)
+ [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md)

+ [目录标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/directory.md)
+ [目录标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/directory.md)

+ [提交标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/commit.md)
+ [提交标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/commit.md)

+ [版本控制标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/version.md)
+ [版本控制标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/version.md)

+ [接口标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/interface.md)
+ [接口标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/interface.md)

+ [OpenIM配置和环境变量设置](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/environment.md)

> **Note**
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
> 针对中国的用户,阅读我们的 [Docker 镜像标准](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/images.md) 以便使用国内 aliyun 的镜像地址。OpenIM 也有针对中国的 gitee 同步仓库,你可以在 [gitee.com](https://gitee.com/openimsdk) 上找到它。
## :link: 链接

Expand Down
Loading

0 comments on commit e2004c1

Please sign in to comment.