Skip to content

Commit

Permalink
merge upstream/main to main
Browse files Browse the repository at this point in the history
  • Loading branch information
lin.huang committed Nov 11, 2023
2 parents a544351 + d1af343 commit c7b6b0f
Show file tree
Hide file tree
Showing 165 changed files with 4,884 additions and 973 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)
12 changes: 12 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern=v{{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
Expand Down Expand Up @@ -87,6 +88,16 @@ jobs:
uses: docker/[email protected]
with:
images: registry.cn-hangzhou.aliyuncs.com/openimsdk/openim-server
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern=v{{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Log in to AliYun Docker Hub
uses: docker/login-action@v3
Expand Down Expand Up @@ -126,6 +137,7 @@ jobs:
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern=v{{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
Expand Down
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
Loading

0 comments on commit c7b6b0f

Please sign in to comment.