From 562c4f0cf1113dbeef6f41bf5cc98a8931e2972c Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Wed, 5 Jul 2023 09:54:55 +0800 Subject: [PATCH] fix(main): fix cicd actions Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- .github/weekly-digest.yml | 14 +++++++++ .github/workflows/issue-robot.yml | 14 +++++++++ .github/workflows/issue-translator-robot.yml | 31 ------------------- .github/workflows/project-progress.yml | 2 +- Makefile | 23 ++++++++++++-- scripts/release.mk | 23 ++++++++++++++ .../internal/middleware/frequency_control.go | 14 +++++++++ web/.eslintrc.js | 16 ++++++++++ web/.prettierrc.js | 16 ++++++++++ 9 files changed, 119 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/issue-translator-robot.yml create mode 100644 scripts/release.mk diff --git a/.github/weekly-digest.yml b/.github/weekly-digest.yml index 07c5603..d1159c4 100644 --- a/.github/weekly-digest.yml +++ b/.github/weekly-digest.yml @@ -1,3 +1,17 @@ +# 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. + publishDay: sun canPublishIssues: true canPublishPullRequests: true diff --git a/.github/workflows/issue-robot.yml b/.github/workflows/issue-robot.yml index 74927a0..b421a53 100644 --- a/.github/workflows/issue-robot.yml +++ b/.github/workflows/issue-robot.yml @@ -1,3 +1,17 @@ +# 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: 'issue translator' on: issue_comment: diff --git a/.github/workflows/issue-translator-robot.yml b/.github/workflows/issue-translator-robot.yml deleted file mode 100644 index 8bbb631..0000000 --- a/.github/workflows/issue-translator-robot.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright © 2023 OpenIMSDK 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: 'issue translator' -on: - issue_comment: - types: [created] - issues: - types: [opened] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: usthe/issues-translate-action@v2.7 - with: - # it is not necessary to decide whether you need to modify the issue header content - IS_MODIFY_TITLE: true - BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} - # Required, input your bot github token \ No newline at end of file diff --git a/.github/workflows/project-progress.yml b/.github/workflows/project-progress.yml index 12e8615..235bc90 100644 --- a/.github/workflows/project-progress.yml +++ b/.github/workflows/project-progress.yml @@ -31,6 +31,6 @@ jobs: steps: - uses: alex-page/github-project-automation-plus@v0.8.3 with: - project: OpenIM 2023 Sprint 🔥 + project: OpenKF column: In Progress repo-token: ${{ secrets.BOT_GITHUB_TOKEN }} \ No newline at end of file diff --git a/Makefile b/Makefile index 0fb4f05..d40282b 100644 --- a/Makefile +++ b/Makefile @@ -158,7 +158,7 @@ EXCLUDE_TESTS=github.com/OpenIMSDK/OpenKF/test ## all: Build all the necessary targets. .PHONY: all -all: copyright-verify build # tidy lint cover +all: copyright-verify tidy lint cover build ## build: Build binaries by default. .PHONY: build @@ -247,7 +247,7 @@ test: ## cover: Run unit test with coverage. .PHONY: cover cover: test.junit-report - @$(GO) tool cover -func=$(TMP_DIR)/coverage.out | \ + @cd $(SERVER_DIR) && $(GO) tool cover -func=$(TMP_DIR)/coverage.out | \ awk -v target=$(COVERAGE) -f $(ROOT_DIR)/scripts/coverage.awk ## docker-build: Build docker image with the manager. @@ -290,6 +290,25 @@ swagger: tools.verify.swagger serve-swagger: tools.verify.swagger @$(TOOLS_DIR)/swagger serve -F=redoc --no-open --port 36666 $(ROOT_DIR)/server/docs/swagger.yaml +## release: release the project +.PHONY: release +release: release.verify release.ensure-tag + @scripts/release.sh + +## release.verify: Check if a tool is installed and install it +.PHONY: release.verify +release.verify: tools.verify.git-chglog tools.verify.github-release tools.verify.coscmd tools.verify.coscli + +## release.tag: release the project +.PHONY: release.tag +release.tag: tools.verify.gsemver release.ensure-tag + @git push origin `git describe --tags --abbrev=0` + +## release.ensure-tag: ensure tag +.PHONY: release.ensure-tag +release.ensure-tag: tools.verify.gsemver + @scripts/ensure_tag.sh + ## clean: Clean all builds. .PHONY: clean clean: diff --git a/scripts/release.mk b/scripts/release.mk new file mode 100644 index 0000000..8640282 --- /dev/null +++ b/scripts/release.mk @@ -0,0 +1,23 @@ +# Build a OpenIM release. This will build the binaries, create the Docker +# images and other build artifacts. + +set -o errexit +set -o nounset +set -o pipefail + +OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +source "${OPENIM_ROOT}/scripts/common.sh" +source "${OPENIM_ROOT}/scripts/lib/release.sh" + +OPENIM_RELEASE_RUN_TESTS=${OPENIM_RELEASE_RUN_TESTS-y} + +openim::golang::setup_env +openim::build::verify_prereqs +openim::release::verify_prereqs +#openim::build::build_image +openim::build::build_command +openim::release::package_tarballs +openim::release::updload_tarballs +git push origin ${VERSION} +#openim::release::github_release +#openim::release::generate_changelog diff --git a/server/internal/middleware/frequency_control.go b/server/internal/middleware/frequency_control.go index 7369e01..01d1074 100644 --- a/server/internal/middleware/frequency_control.go +++ b/server/internal/middleware/frequency_control.go @@ -1,3 +1,17 @@ +// 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. + package middleware import ( diff --git a/web/.eslintrc.js b/web/.eslintrc.js index e1771ce..c88322f 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -1,3 +1,19 @@ +/** + * 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. + */ + module.exports = { env: { browser: true, diff --git a/web/.prettierrc.js b/web/.prettierrc.js index 48a426b..f2c1f5f 100644 --- a/web/.prettierrc.js +++ b/web/.prettierrc.js @@ -1,3 +1,19 @@ +/** + * 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. + */ + module.exports = { printWidth: 80, tabWidth: 4,