feat: add cicd sacript feature

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/561/head
Xinwei Xiong(cubxxw-openim) 2 years ago
parent 3ad8c28022
commit 0738a560a7
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -1,4 +1,4 @@
name: 'OpenCommit Action' name: 'OpenIM Commit Action'
on: on:
push: push:

@ -111,24 +111,4 @@ jobs:
# - name: golangci-lint # - name: golangci-lint
# uses: golangci/golangci-lint-action@v3 # uses: golangci/golangci-lint-action@v3
# with: # with:
# version: ${{ env.GOLANGCI_VERSION }} # version: ${{ env.GOLANGCI_VERSION }}
# docker-image-tests:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Run tests
# run: make build
# - name: Test docker image
# run: |
# docker build -t openim:ci-build .

@ -48,7 +48,6 @@ jobs:
sudo ./scripts/build_all_service.sh sudo ./scripts/build_all_service.sh
sudo cat logs/openIM.log 2>/dev/null sudo cat logs/openIM.log 2>/dev/null
shell: bash shell: bash
continue-on-error: true
- name: Start all services - name: Start all services
run: | run: |

@ -40,9 +40,9 @@ type UserDatabase interface {
Page(ctx context.Context, pageNumber, showNumber int32) (users []*relation.UserModel, count int64, err error) Page(ctx context.Context, pageNumber, showNumber int32) (users []*relation.UserModel, count int64, err error)
// 只要有一个存在就为true // 只要有一个存在就为true
IsExist(ctx context.Context, userIDs []string) (exist bool, err error) IsExist(ctx context.Context, userIDs []string) (exist bool, err error)
//获取所有用户ID // 获取所有用户ID
GetAllUserID(ctx context.Context, pageNumber, showNumber int32) ([]string, error) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) ([]string, error)
//函数内部先查询db中是否存在存在则什么都不做不存在则插入 // 函数内部先查询db中是否存在存在则什么都不做不存在则插入
InitOnce(ctx context.Context, users []*relation.UserModel) (err error) InitOnce(ctx context.Context, users []*relation.UserModel) (err error)
// 获取用户总数 // 获取用户总数
CountTotal(ctx context.Context, before *time.Time) (int64, error) CountTotal(ctx context.Context, before *time.Time) (int64, error)

@ -83,7 +83,7 @@ func (u *UserGorm) Page(
return return
} }
// 获取所有用户ID // 获取所有用户ID.
func (u *UserGorm) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error) { func (u *UserGorm) GetAllUserID(ctx context.Context, pageNumber, showNumber int32) (userIDs []string, err error) {
return userIDs, errs.Wrap(u.db(ctx).Limit(int(showNumber)).Offset(int((pageNumber-1)*showNumber)).Pluck("user_id", &userIDs).Error) return userIDs, errs.Wrap(u.db(ctx).Limit(int(showNumber)).Offset(int((pageNumber-1)*showNumber)).Pluck("user_id", &userIDs).Error)
} }

@ -28,8 +28,10 @@
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail) # - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
# To properly provided solutions that supports more than one platform you should use this option. # To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
## Build and push docker image for the manager for cross-platform support
.PHONY: docker-buildx .PHONY: docker-buildx
docker-buildx: test ## Build and push docker image for the manager for cross-platform support docker-buildx:
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder - docker buildx create --name project-v3-builder

Loading…
Cancel
Save