Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
FGadvancer committed Aug 18, 2023
2 parents 80c5959 + 5f0cfe0 commit 97b70fd
Show file tree
Hide file tree
Showing 18 changed files with 606 additions and 230 deletions.
49 changes: 0 additions & 49 deletions .github/workflows/build-docker-image.yml

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/openimci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

strategy:
matrix:
go_version: ["1.18","1.19","1.20"]
go_version: ["1.18","1.19","1.20","1.21"]
os: [ubuntu-latest]

steps:
Expand Down Expand Up @@ -92,7 +92,12 @@ jobs:
- name: Build source code for host platform
run: |
sudo make build
echo "Build source code for host platform successfully"
echo "Build source code for host platform successfully"
- name: Build wasm source code
run: |
sudo make build-wasm
echo "Build wasm source code successfully"
- name: OpenIM verify copyright
run: |
Expand Down
35 changes: 33 additions & 2 deletions .github/workflows/release.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 chat release
name: OpenIM OpenIM Core release

on:
push:
Expand All @@ -25,6 +25,7 @@ permissions:
packages: write
issues: write


jobs:
goreleaser:
runs-on: ubuntu-latest
Expand All @@ -43,9 +44,39 @@ jobs:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
workdir: .
args: release --clean --clean --release-footer-tmpl=scripts/template/footer.md.tmpl --release-header-tmpl=scripts/template/head.md.tmpl
env:
USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
# distribution:
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

goreleaser-check-pkgs:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
needs: [ goreleaser ]
if: github.ref == 'refs/heads/main'
strategy:
matrix:
format: [ deb, rpm, apk ]
steps:
- uses: actions/checkout@v3 # v3
with:
fetch-depth: 0
- uses: arduino/setup-task@e26d8975574116b0097a1161e0fe16ba75d84c1c # v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: |
./_output/dist/*.deb
./_output/dist/*.rpm
./_output/dist/*.apk
key: ${{ github.ref }}
- run: task goreleaser:test:${{ matrix.format }}
58 changes: 11 additions & 47 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,24 @@ report_sizes: true

builds:
- binary: openim-sdk-core
id: openim-api
id: openim-sdk-core
main: ./cmd/main.go
goos:
- darwin
- windows
- linux
goarch:
- s390x
- mips64
- mips64le
- amd64
- ppc64le
- arm64
goarm:
- 6
- 7
- id: openIM.wasm
main: wasm/cmd/main.go # 指定 wasm 主文件路径
binary: openIM.wasm
ldflags: "-s -w"
goos:
- js
goarch:
- wasm

archives:
- format: tar.gz
Expand All @@ -56,7 +58,6 @@ archives:
files:
- LICENSE
- README.md
- docs/*
# a more complete example, check the globbing deep dive below
- src: "*.md"
dst: docs
Expand Down Expand Up @@ -126,6 +127,7 @@ nfpms:
- id: packages
builds:
- openim-sdk-core
- openIM.wasm
# Your app's vendor.
vendor: OpenIMSDK
homepage: https://github.com/OpenIMSDK/openim-sdk-core
Expand Down Expand Up @@ -193,42 +195,4 @@ checksum:
algorithm: sha256

release:
footer: |
**Full Changelog**: https://github.com/OpenIMSDK/chat/compare/{{ .PreviousTag }}...{{ .Tag }}
## Helping out
This release is only possible thanks to **all** the support of some **awesome people**!
Want to be one of them?
Contributions to this project are welcome! Please see [CONTRIBUTING.md](https://github.com/OpenIMSDK/Open-IM-Server/blob/main/CONTRIBUTING.md) for details.
<p align="center">
<a href="https://github.com/openimbot/openimbot/blob/main/assets/icon/blue%E9%80%8F%E6%98%8E.png" style="float: left; margin-right: 10px;">
<img src="https://github.com/openimbot/openimbot/blob/main/assets/icon/blue%E9%80%8F%E6%98%8E.png" width="50" height="50" />
</a>
<a href="https://www.openim.online">
<img src="https://github.com/OpenIMSDK/Open-IM-Server/blob/main/assets/logo/openim-logo.png" />
</a>
<a href="https://github.com/openimbot/openimbot/blob/main/assets/icon/red%E9%80%8F%E6%98%8E.png" style="float: right; margin-left: 10px;">
<img src="https://github.com/openimbot/openimbot/blob/main/assets/icon/red%E9%80%8F%E6%98%8E.png" width="50" height="50" />
</a>
</p>
## Contact Us
We value close connections with our users, developers, and contributors here at OpenIMSDK. With a large community and maintainer team, we're always here to help and support you. Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
Our most recommended way to get in touch is through [Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-1tmoj26uf-_FDy3dowVHBiGvLk9e5Xkg). Even if you're in China, Slack is usually not blocked by firewalls, making it an easy way to connect with us. Our Slack community is the ideal place to discuss and share ideas and suggestions with other users and developers of OpenIMSDK. You can ask technical questions, seek help, or share your experiences with other users of OpenIMSDK.
In [OpenIM community is recruiting new members! discussion](https://github.com/orgs/OpenIMSDK/discussions/426) please leave your information, convenient we will better developers around the small gift to send to your hands.
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://mail.google.com/mail/u/0/?fs=1&tf=cm&[email protected]" target="_blank"><img src="https://img.shields.io/badge/gmail-%40OOpenIMSDKCore?style=social&logo=gmail"></a>: Get in touch with us on [Gmail]([email protected]). 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://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.
Whether you're looking to join our community or have any questions or suggestions, we welcome you to get in touch with us.
prerelease: auto
91 changes: 46 additions & 45 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ SPACE +=
# ==============================================================================
# Build definition

GO_SUPPORTED_VERSIONS ?= 1.18|1.19|1.20
GO_SUPPORTED_VERSIONS ?= 1.18|1.19|1.20|1.21
GO_LDFLAGS += -X $(VERSION_PACKAGE).GitVersion=$(VERSION) \
-X $(VERSION_PACKAGE).GitCommit=$(GIT_COMMIT) \
-X $(VERSION_PACKAGE).GitTreeState=$(GIT_TREE_STATE) \
Expand Down Expand Up @@ -156,7 +156,7 @@ ifeq (${BINS},)
$(error Could not determine BINS, set ROOT_DIR or run in source dir)
endif

EXCLUDE_TESTS=github.com/OpenIMSDK/chat/test
EXCLUDE_TESTS=github.com/OpenIMSDK/openim-sdk-core/test

# ==============================================================================
# Build
Expand All @@ -165,51 +165,41 @@ EXCLUDE_TESTS=github.com/OpenIMSDK/chat/test
.PHONY: all
all: copyright-verify build # tidy lint cover

## build: Build binaries by default.
# Define available OS and ARCH
OSES = linux
ARCHS = amd64 arm64

ifeq ($(ARCH),arm64)
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
endif

# Set default OS and ARCH (e.g., current platform)
OS ?= $(shell go env GOOS)
ARCH ?= $(shell go env GOARCH)
BIN_DIR ?= ./_output/bin
TARGET ?= ./cmd/main.go

## build: Build for current platform by default
.PHONY: build
build:
@CGO_ENABLED=1 GOOS=${OS} GOARCH=${ARCH} go build -o ${BIN_DIR} ./cmd/main.go
# build: go.build.verify $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS)))

.PHONY: build.%
build.%:
@echo "$(shell go version)"
@echo "===========> Building binary $(BUILDAPP) *[Git Info]: $(VERSION)-$(GIT_COMMIT)"
@export CGO_ENABLED=0 && GOOS=linux go build -o $(BUILDAPP)/$*/ -ldflags '-s -w' $*/example/$(BUILDFILE)

.PHONY: go.build.verify
go.build.verify:
ifneq ($(shell $(GO) version | grep -q -E '\bgo($(GO_SUPPORTED_VERSIONS))\b' && echo 0 || echo 1), 0)
$(error unsupported go version. Please make install one of the following supported version: '$(GO_SUPPORTED_VERSIONS)')
endif
@echo "===========> Building for $(OS)/$(ARCH)"
@CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(ARCH) go build -o $(BIN_DIR)/openim-sdk-core-$(OS)-$(ARCH) $(TARGET)

## go.build: Build the binary file of the specified platform.
.PHONY: go.build.%
go.build.%:
$(eval COMMAND := $(word 2,$(subst ., ,$*)))
$(eval PLATFORM := $(word 1,$(subst ., ,$*)))
$(eval OS := $(word 1,$(subst _, ,$(PLATFORM))))
$(eval ARCH := $(word 2,$(subst _, ,$(PLATFORM))))
@echo "=====> COMMAND=$(COMMAND)"
@echo "=====> PLATFORM=$(PLATFORM)"
@echo "=====> BIN_DIR=$(BIN_DIR)"
@echo "===========> Building binary $(COMMAND) $(VERSION) for $(OS)_$(ARCH)"
@mkdir -p $(BIN_DIR)/platforms/$(OS)/$(ARCH)
@if [ "$(COMMAND)" = "rpc" ] || [ "$(COMMAND)" = "api" ]; then \
for d in $(wildcard $(ROOT_DIR)/cmd/$(COMMAND)/*/); do \
cd $$d && CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o \
$(BIN_DIR)/platforms/$(OS)/$(ARCH)/$$(basename $$d)$(GO_OUT_EXT) .; \
done; \
else \
@CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o \
$(BIN_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_PACKAGE)/cmd/$(COMMAND)/main.go; \
fi

## build-multiarch: Build binaries for multiple platforms.
.PHONY: build-multiarch
build-multiarch: go.build.verify $(foreach p,$(PLATFORMS),$(addprefix go.build., $(addprefix $(p)., $(BINS))))
# ==============================================================================
# Targets
# sudo apt-get install gcc-aarch64-linux-gnu
## build-multiple: Build for all supported platforms
.PHONY: build-multiple
build-multiple:
@for os in $(OSES); do \
for arch in $(ARCHS); do \
$(MAKE) build OS=$$os ARCH=$$arch; \
done \
done


.PHONY: build-wasm
build-wasm:
GOOS=js GOARCH=wasm go build -trimpath -ldflags "-s -w" -o ${BIN_DIR}/openIM.wasm wasm/cmd/main.go

## install: Install the binary to the BIN_DIR
.PHONY: install
Expand Down Expand Up @@ -512,4 +502,15 @@ install.richgo:
## install.rts: Install rts
.PHONY: install.rts
install.rts:
@$(GO) install github.com/galeone/rts/cmd/rts@latest
@$(GO) install github.com/galeone/rts/cmd/rts@latest


## install.gomobile: Install gomobile
.PHONY: install.gomobile
install.gomobile:
@$(GO) install golang.org/x/mobile/cmd/gomobile@latest

## install.gobind: Install gobind
.PHONY: install.gobind
install.gobind:
@$(GO) install golang.org/x/mobile/cmd/gobind@latest
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.11.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 h1:estk1glOnSVeJ9tdEZZc5mAMDZk5lNJNyJ6DvrBkTEU=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g=
golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0=
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda h1:O+EUvnBNPwI4eLthn8W5K+cS8zQZfgTABPLNm6Bna34=
golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda/go.mod h1:aAjjkJNdrh3PMckS4B10TGS2nag27cbKR1y2BpUxsiY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down
16 changes: 8 additions & 8 deletions internal/user/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ func (u *User) UpdateMsgSenderInfo(ctx context.Context, nickname, faceURL string
return nil
}

func (u *User) SubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) ([]*userPb.OnlineStatus, error) {
return u.subscribeUsersStatus(ctx, userID, userIDs)
func (u *User) SubscribeUsersStatus(ctx context.Context, userIDs []string) ([]*userPb.OnlineStatus, error) {
return u.subscribeUsersStatus(ctx, userIDs)
}

func (u *User) UnsubscribeUsersStatus(ctx context.Context, userID string, userIDs []string) error {
return u.unsubscribeUsersStatus(ctx, userID, userIDs)
func (u *User) UnsubscribeUsersStatus(ctx context.Context, userIDs []string) error {
return u.unsubscribeUsersStatus(ctx, userIDs)
}

func (u *User) GetSubscribeUsersStatus(ctx context.Context, userID string) ([]*userPb.OnlineStatus, error) {
return u.getSubscribeUsersStatus(ctx, userID)
func (u *User) GetSubscribeUsersStatus(ctx context.Context) ([]*userPb.OnlineStatus, error) {
return u.getSubscribeUsersStatus(ctx)
}

func (u *User) GetUserStatus(ctx context.Context, userID string, userIDs []string) ([]*userPb.OnlineStatus, error) {
return u.getUserStatus(ctx, userID, userIDs)
func (u *User) GetUserStatus(ctx context.Context, userIDs []string) ([]*userPb.OnlineStatus, error) {
return u.getUserStatus(ctx, userIDs)
}
Loading

0 comments on commit 97b70fd

Please sign in to comment.