From 920c1f00eb6164b25f79b42c1c8aa9ec5ce9515e Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 10:01:39 +0800 Subject: [PATCH 01/10] feat: provide the function and design scheme of release Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/make-rules/golang.mk | 1 + script/make-rules/release.mk | 41 ++++++++++++++++++++++++++++++++++++ script/make-rules/tools.mk | 15 ++++++++++++- script/push_start.sh | 1 + script/release.sh | 22 +++++++++++++++++++ 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 script/make-rules/release.mk create mode 100644 script/release.sh diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index 0ba807342..50be587d2 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -18,6 +18,7 @@ + ## copyright.help: Show copyright help .PHONY: go.help go.help: script/make-rules/golang.mk diff --git a/script/make-rules/release.mk b/script/make-rules/release.mk new file mode 100644 index 000000000..55cb0f416 --- /dev/null +++ b/script/make-rules/release.mk @@ -0,0 +1,41 @@ +# Copyright © 2023 OpenIMSDK. +# +# 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. + +# ============================================================================== +# Makefile helper functions for release +# + +## release: release the project +.PHONY: release.run +release.run: 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 + +## 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 + +## release.help: Display help information about the release package +.PHONY: release.help +release.help: script/make-rules/release.mk + $(call smallhelp) \ No newline at end of file diff --git a/script/make-rules/tools.mk b/script/make-rules/tools.mk index 7bed9c178..2c6689668 100644 --- a/script/make-rules/tools.mk +++ b/script/make-rules/tools.mk @@ -25,12 +25,14 @@ ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score GENERATION_TOOLS = deepcopy-gen conversion-gen protoc-gen-go cfssl rts codegen # Testing tools TEST_TOOLS = ginkgo go-junit-report gotests +# cos tools +COS_TOOLS = coscli coscmd # Version control tools VERSION_CONTROL_TOOLS = addlicense go-gitlint git-chglog github-release gsemver # Utility tools UTILITY_TOOLS = go-mod-outdated mockgen gothanks richgo kubeconform # All tools -ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS) +ALL_TOOLS ?= $(ANALYSIS_TOOLS) $(GENERATION_TOOLS) $(TEST_TOOLS) $(VERSION_CONTROL_TOOLS) $(UTILITY_TOOLS) $(COS_TOOLS) ## tools.install: Install a must tools .PHONY: tools.install @@ -129,6 +131,17 @@ install.git-chglog: install.github-release: @$(GO) install github.com/github-release/github-release@latest +## install.coscli: Install coscli, used to upload files to cos +.PHONY: install.coscli +install.coscli: + @wget -q https://github.com/tencentyun/coscli/releases/download/v0.10.2-beta/coscli-linux -O ${HOME}/bin/coscli + @chmod +x ${HOME}/bin/coscli + +## install.coscmd: Install coscmd, used to upload files to cos +.PHONY: install.coscmd +install.coscmd: + @if which pip &>/dev/null; then pip install coscmd; else pip3 install coscmd; fi + ## install.gvm: Install gvm, gvm is a Go version manager, built on top of the official go tool. .PHONY: install.gvm install.gvm: diff --git a/script/push_start.sh b/script/push_start.sh index cbaffe7be..be34903ec 100755 --- a/script/push_start.sh +++ b/script/push_start.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + #Include shell font styles and some basic information source ./style_info.cfg source ./path_info.cfg diff --git a/script/release.sh b/script/release.sh new file mode 100644 index 000000000..bd6ef0ec4 --- /dev/null +++ b/script/release.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Copyright © 2023 OpenIMSDK. +# +# 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. + +# ============================================================================== +# Makefile helper functions for release +# +# Build a OpenIM release. This will build the binaries, create the Docker +# images and other build artifacts. + From cd2e5ad785732310f3643d64c5999d67c38883bd Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 10:10:13 +0800 Subject: [PATCH 02/10] fix: optimize codeql ananlysis workflows Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- script/githooks/pre-push | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f106438e3..38508b770 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -16,9 +16,9 @@ on: branches: [ main ] pull_request: # The branches below must be a subset of the branches above - branches: [ main ] - schedule: - - cron: '23 2 * * 2' + branches: "*" +# schedule: +# - cron: '23 2 * * 2' jobs: analyze: diff --git a/script/githooks/pre-push b/script/githooks/pre-push index 3402ac656..10c4a6d2c 100644 --- a/script/githooks/pre-push +++ b/script/githooks/pre-push @@ -22,7 +22,6 @@ printMessage "Running local OpenIM pre-push hook." if [[ `git status --porcelain` ]]; then printError "This script needs to run against committed code only. Please commit or stash you changes." exit 1 -fi # #printMessage "Running the Flutter analyzer" From 85bdc9c794580d0cbe11b114afbe239bbc73113e Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 12:09:35 +0800 Subject: [PATCH 03/10] feat(make): complete mk's build module Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- Makefile | 4 +- script/make-rules/gen.mk | 58 +++++++++++++ script/make-rules/golang.mk | 163 ++++++++++++++++++++++++++++++++++++ script/make-rules/image.mk | 112 +++++++++++++++++++++++++ 4 files changed, 335 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 496c9166d..a6badd827 100644 --- a/Makefile +++ b/Makefile @@ -42,11 +42,11 @@ Options: BINS Binaries to build. Default is all binaries under cmd. This option is available when using: make {build}(.multiarch) - Example: make build BINS="open_im_api open_im_cms_api" + Example: make build BINS="open_im_api open_im_cms_api". PLATFORMS Platform to build for. Default is linux_arm64 and linux_amd64. This option is available when using: make {build}.multiarch - Example: make build.multiarch PLATFORMS="linux_arm64 linux_amd64" + Example: make build.multiarch PLATFORMS="linux_arm64 linux_amd64". V Set to 1 enable verbose build. Default is 0. endef diff --git a/script/make-rules/gen.mk b/script/make-rules/gen.mk index 2955d344e..7dc5a5c28 100644 --- a/script/make-rules/gen.mk +++ b/script/make-rules/gen.mk @@ -21,6 +21,64 @@ # Questions about go mod instead of go path: https://github.com/kubernetes/kubernetes/issues/117181 +# ============================================================================== +# Makefile helper functions for generate necessary files +# + +.PHONY: gen.run +#gen.run: gen.errcode gen.docgo +gen.run: gen.clean gen.errcode gen.docgo.doc + +.PHONY: gen.errcode +gen.errcode: gen.errcode.code gen.errcode.doc + +.PHONY: gen.errcode.code +gen.errcode.code: tools.verify.codegen + @echo "===========> Generating iam error code go source files" + @codegen -type=int ${ROOT_DIR}/internal/pkg/code + +.PHONY: gen.errcode.doc +gen.errcode.doc: tools.verify.codegen + @echo "===========> Generating error code markdown documentation" + @codegen -type=int -doc \ + -output ${ROOT_DIR}/docs/guide/zh-CN/api/error_code_generated.md ${ROOT_DIR}/internal/pkg/code + +.PHONY: gen.ca.% +gen.ca.%: + $(eval CA := $(word 1,$(subst ., ,$*))) + @echo "===========> Generating CA files for $(CA)" + @${ROOT_DIR}/scripts/gencerts.sh generate-iam-cert $(OUTPUT_DIR)/cert $(CA) + +.PHONY: gen.ca +gen.ca: $(addprefix gen.ca., $(CERTIFICATES)) + +.PHONY: gen.docgo.doc +gen.docgo.doc: + @echo "===========> Generating missing doc.go for go packages" + @${ROOT_DIR}/scripts/gendoc.sh + +.PHONY: gen.docgo.check +gen.docgo.check: gen.docgo.doc + @n="$$(git ls-files --others '*/doc.go' | wc -l)"; \ + if test "$$n" -gt 0; then \ + git ls-files --others '*/doc.go' | sed -e 's/^/ /'; \ + echo "$@: untracked doc.go file(s) exist in working directory" >&2 ; \ + false ; \ + fi + +.PHONY: gen.docgo.add +gen.docgo.add: + @git ls-files --others '*/doc.go' | $(XARGS) -- git add + +.PHONY: gen.defaultconfigs +gen.defaultconfigs: + @${ROOT_DIR}/scripts/gen_default_config.sh + +.PHONY: gen.clean +gen.clean: + @rm -rf ./api/client/{clientset,informers,listers} + @$(FIND) -type f -name '*_generated.go' -delete + ## gen.help: show help for gen .PHONY: gen.help gen.help: script/make-rules/gen.mk diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index 50be587d2..e0ae4e399 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -16,8 +16,171 @@ # Build management helpers. These functions help to set, save and load the # +GO := go +GO_SUPPORTED_VERSIONS ?= |1.15|1.16|1.17|1.18|1.19|1.20| +GO_LDFLAGS += -X $(VERSION_PACKAGE).gitVersion=$(GIT_TAG) \ + -X $(VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) \ + -X $(VERSION_PACKAGE).gitTreeState=$(GIT_TREE_STATE) \ + -X $(VERSION_PACKAGE).buildDate=$(BUILD_DATE) \ + -s -w # -s -w deletes debugging information and symbol tables +ifeq ($(DEBUG), 1) + GO_BUILD_FLAGS += -gcflags "all=-N -l" + GO_LDFLAGS= +endif +GO_BUILD_FLAGS += -ldflags "$(GO_LDFLAGS)" + +ifeq ($(GOOS),windows) + GO_OUT_EXT := .exe +endif + +ifeq ($(ROOT_PACKAGE),) + $(error the variable ROOT_PACKAGE must be set prior to including golang.mk, ->/Makefile) +endif + +GOPATH ?= $(shell go env GOPATH) +ifeq ($(origin GOBIN), undefined) + GOBIN := $(GOPATH)/bin +endif + +# COMMANDS is Specify all files under ${ROOT_DIR}/cmd/ except those ending in.md +COMMANDS ?= $(filter-out %.md, $(wildcard ${ROOT_DIR}/cmd/*)) +ifeq (${COMMANDS},) + $(error Could not determine COMMANDS, set ROOT_DIR or run in source dir) +endif + +# BINS is the name of each file in ${COMMANDS}, excluding the directory path +# If there are no files in ${COMMANDS}, or if all files end in.md, ${BINS} will be empty +BINS ?= $(foreach cmd,${COMMANDS},$(notdir ${cmd})) +ifeq (${BINS},) + $(error Could not determine BINS, set ROOT_DIR or run in source dir) +endif + +ifeq (${COMMANDS},) + $(error Could not determine COMMANDS, set ROOT_DIR or run in source dir) +endif +ifeq (${BINS},) + $(error Could not determine BINS, set ROOT_DIR or run in source dir) +endif + +# TODO: EXCLUDE_TESTS variable, which contains the name of the package to be excluded from the test +EXCLUDE_TESTS=github.com/OpenIMSDK/Open-IM-Server/test github.com/OpenIMSDK/Open-IM-Server/pkg/log github.com/OpenIMSDK/Open-IM-Server/db github.com/OpenIMSDK/Open-IM-Server/script github.com/OpenIMSDK/Open-IM-Server/deploy_k8s github.com/OpenIMSDK/Open-IM-Server/deploy github.com/OpenIMSDK/Open-IM-Server/config + +# ============================================================================== +# ❯ tree -L 1 cmd +# cmd +# ├── Open-IM-SDK-Core/ - main.go +# ├── open_im_api +# ├── open_im_cms_api +# ├── open_im_cron_task +# ├── open_im_demo +# ├── open_im_msg_gateway +# ├── open_im_msg_transfer +# ├── open_im_push +# ├── rpc/open_im_admin_cms/ - main.go +# └── test/ - main.go +# COMMAND=openim +# PLATFORM=linux_amd64 +# OS=linux +# ARCH=amd64 +# BINS=open_im_api open_im_cms_api open_im_cron_task open_im_demo open_im_msg_gateway open_im_msg_transfer open_im_push +# BIN_DIR=/root/workspaces/OpenIM/_output/bin +# ============================================================================== + +## go.build.verify: Verify that a suitable version of Go exists +.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 + +.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 $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH) + @CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_PACKAGE)/cmd/$(COMMAND) + +## go.build: Build binaries +.PHONY: go.build +go.build: go.build.verify $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS))) + @echo "===========> Building binary $(BINS) $(VERSION) for $(PLATFORM)" + +## go.multiarch: Build multi-arch binaries +.PHONY: go.build.multiarch +go.build.multiarch: go.build.verify $(foreach p,$(PLATFORMS),$(addprefix go.build., $(addprefix $(p)., $(BINS)))) + +## go.lint: Run golangci to lint source codes +.PHONY: go.lint +go.lint: tools.verify.golangci-lint + @echo "===========> Run golangci to lint source codes" + @$(TOOLS_DIR)/golangci-lint run -c $(ROOT_DIR)/.golangci.yml $(ROOT_DIR)/... + +# # @$(GO) test $(GO_BUILD_FLAGS) ./... +# ## go.test: Run unit test +# .PHONY: go.test +# go.test: tools.verify.go-junit-report +# @echo "===========> Run unit test" +# @set -o pipefail;$(GO) test -race -cover -coverprofile=$(OUTPUT_DIR)/coverage.out \ +# -timeout=10m -shuffle=on -short -v `go list ./...|\ +# egrep -v $(subst $(SPACE),'|',$(sort $(EXCLUDE_TESTS)))` 2>&1 | \ +# tee >(go-junit-report --set-exit-code >$(OUTPUT_DIR)/report.xml) +# @sed -i '/mock_.*.go/d' $(OUTPUT_DIR)/coverage.out # remove mock_.*.go files from test coverage +# @$(GO) tool cover -html=$(OUTPUT_DIR)/coverage.out -o $(OUTPUT_DIR)/coverage.html + +## go.test: Run unit test +.PHONY: go.test +go.test: + @$(GO) test $(GO_BUILD_FLAGS) ./... + +## go.test.junit-report: Run unit test +.PHONY: go.test.junit-report +go.test.junit-report: tools.verify.go-junit-report + @echo "===========> Run unit test > $(TMP_DIR)/report.xml" + @$(GO) test -v -coverprofile=$(TMP_DIR)/coverage.out 2>&1 $(GO_BUILD_FLAGS) ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(TMP_DIR)/report.xml + @sed -i '/mock_.*.go/d' $(TMP_DIR)/coverage.out + @echo "===========> Test coverage of Go code is reported to $(TMP_DIR)/coverage.html by generating HTML" + @$(GO) tool cover -html=$(TMP_DIR)/coverage.out -o $(TMP_DIR)/coverage.html + +## go.test.cover: Run unit test with coverage +.PHONY: go.test.cover +go.test.cover: go.test.junit-report + @touch $(TMP_DIR)/coverage.out + @$(GO) tool cover -func=$(TMP_DIR)/coverage.out | \ + awk -v target=$(COVERAGE) -f $(ROOT_DIR)/scripts/coverage.awk + +## go.format: Run unit test and format codes +.PHONY: go.format +go.format: tools.verify.golines tools.verify.goimports + @echo "===========> Formating codes" + @$(FIND) -type f -name '*.go' | $(XARGS) gofmt -s -w + @$(FIND) -type f -name '*.go' | $(XARGS) $(TOOLS_DIR)/goimports -w -local $(ROOT_PACKAGE) + @$(FIND) -type f -name '*.go' | $(XARGS) $(TOOLS_DIR)/golines -w --max-len=120 --reformat-tags --shorten-comments --ignore-generated . + @$(GO) mod edit -fmt + +## imports: task to automatically handle import packages in Go files using goimports tool +.PHONY: go.imports +go.imports: tools.verify.goimports + @$(TOOLS_DIR)/goimports -l -w $(SRC) + +## go.updates: Check for updates to go.mod dependencies +.PHONY: go.updates +go.updates: tools.verify.go-mod-outdated + @$(GO) list -u -m -json all | go-mod-outdated -update -direct + +## go.clean: Clean all builds directories and files +.PHONY: go.clean +go.clean: + @echo "===========> Cleaning all builds OUTPUT_DIR($(OUTPUT_DIR)) AND BIN_DIR($(BIN_DIR))" + @-rm -vrf $(OUTPUT_DIR) $(BIN_DIR) + @echo "===========> End clean..." ## copyright.help: Show copyright help .PHONY: go.help diff --git a/script/make-rules/image.mk b/script/make-rules/image.mk index 25c2a9c07..c584e5220 100644 --- a/script/make-rules/image.mk +++ b/script/make-rules/image.mk @@ -21,6 +21,118 @@ # +DOCKER := docker +DOCKER_SUPPORTED_API_VERSION ?= 1.32 + +REGISTRY_PREFIX ?= marmotedu +BASE_IMAGE = centos:centos8 + +EXTRA_ARGS ?= --no-cache +_DOCKER_BUILD_EXTRA_ARGS := + +ifdef HTTP_PROXY +_DOCKER_BUILD_EXTRA_ARGS += --build-arg HTTP_PROXY=${HTTP_PROXY} +endif + +ifneq ($(EXTRA_ARGS), ) +_DOCKER_BUILD_EXTRA_ARGS += $(EXTRA_ARGS) +endif + +# Determine image files by looking into build/docker/*/Dockerfile +IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/docker/*) +# Determine images names by stripping out the dir names +IMAGES ?= $(filter-out tools,$(foreach image,${IMAGES_DIR},$(notdir ${image}))) + +ifeq (${IMAGES},) + $(error Could not determine IMAGES, set ROOT_DIR or run in source dir) +endif + +.PHONY: image.verify +image.verify: + $(eval API_VERSION := $(shell $(DOCKER) version | grep -E 'API version: {1,6}[0-9]' | head -n1 | awk '{print $$3} END { if (NR==0) print 0}' )) + $(eval PASS := $(shell echo "$(API_VERSION) > $(DOCKER_SUPPORTED_API_VERSION)" | bc)) + @if [ $(PASS) -ne 1 ]; then \ + $(DOCKER) -v ;\ + echo "Unsupported docker version. Docker API version should be greater than $(DOCKER_SUPPORTED_API_VERSION)"; \ + exit 1; \ + fi + +.PHONY: image.daemon.verify +image.daemon.verify: + $(eval PASS := $(shell $(DOCKER) version | grep -q -E 'Experimental: {1,5}true' && echo 1 || echo 0)) + @if [ $(PASS) -ne 1 ]; then \ + echo "Experimental features of Docker daemon is not enabled. Please add \"experimental\": true in '/etc/docker/daemon.json' and then restart Docker daemon."; \ + exit 1; \ + fi + +.PHONY: image.build +image.build: image.verify go.build.verify $(addprefix image.build., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) + +.PHONY: image.build.multiarch +image.build.multiarch: image.verify go.build.verify $(foreach p,$(PLATFORMS),$(addprefix image.build., $(addprefix $(p)., $(IMAGES)))) + +.PHONY: image.build.% +image.build.%: go.build.% + $(eval IMAGE := $(COMMAND)) + $(eval IMAGE_PLAT := $(subst _,/,$(PLATFORM))) + @echo "===========> Building docker image $(IMAGE) $(VERSION) for $(IMAGE_PLAT)" + @mkdir -p $(TMP_DIR)/$(IMAGE) + @cat $(ROOT_DIR)/build/docker/$(IMAGE)/Dockerfile\ + | sed "s#BASE_IMAGE#$(BASE_IMAGE)#g" >$(TMP_DIR)/$(IMAGE)/Dockerfile + @cp $(OUTPUT_DIR)/platforms/$(IMAGE_PLAT)/$(IMAGE) $(TMP_DIR)/$(IMAGE)/ + @DST_DIR=$(TMP_DIR)/$(IMAGE) $(ROOT_DIR)/build/docker/$(IMAGE)/build.sh 2>/dev/null || true + $(eval BUILD_SUFFIX := $(_DOCKER_BUILD_EXTRA_ARGS) --pull -t $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) $(TMP_DIR)/$(IMAGE)) + @if [ $(shell $(GO) env GOARCH) != $(ARCH) ] ; then \ + $(MAKE) image.daemon.verify ;\ + $(DOCKER) build --platform $(IMAGE_PLAT) $(BUILD_SUFFIX) ; \ + else \ + $(DOCKER) build $(BUILD_SUFFIX) ; \ + fi + @rm -rf $(TMP_DIR)/$(IMAGE) + +.PHONY: image.push +image.push: image.verify go.build.verify $(addprefix image.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) + +.PHONY: image.push.multiarch +image.push.multiarch: image.verify go.build.verify $(foreach p,$(PLATFORMS),$(addprefix image.push., $(addprefix $(p)., $(IMAGES)))) + +.PHONY: image.push.% +image.push.%: image.build.% + @echo "===========> Pushing image $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX)" + $(DOCKER) push $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) + +.PHONY: image.manifest.push +image.manifest.push: export DOCKER_CLI_EXPERIMENTAL := enabled +image.manifest.push: image.verify go.build.verify \ +$(addprefix image.manifest.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) + +.PHONY: image.manifest.push.% +image.manifest.push.%: image.push.% image.manifest.remove.% + @echo "===========> Pushing manifest $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list" + @$(DOCKER) manifest create $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) \ + $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) + @$(DOCKER) manifest annotate $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) \ + $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) \ + --os $(OS) --arch ${ARCH} + @$(DOCKER) manifest push --purge $(REGISTRY_PREFIX)/$(IMAGE):$(VERSION) + +# Docker cli has a bug: https://github.com/docker/cli/issues/954 +# If you find your manifests were not updated, +# Please manually delete them in $HOME/.docker/manifests/ +# and re-run. +.PHONY: image.manifest.remove.% +image.manifest.remove.%: + @rm -rf ${HOME}/.docker/manifests/docker.io_$(REGISTRY_PREFIX)_$(IMAGE)-$(VERSION) + +.PHONY: image.manifest.push.multiarch +image.manifest.push.multiarch: image.push.multiarch $(addprefix image.manifest.push.multiarch., $(IMAGES)) + +.PHONY: image.manifest.push.multiarch.% +image.manifest.push.multiarch.%: + @echo "===========> Pushing manifest $* $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list" + REGISTRY_PREFIX=$(REGISTRY_PREFIX) PLATFROMS="$(PLATFORMS)" IMAGE=$* VERSION=$(VERSION) DOCKER_CLI_EXPERIMENTAL=enabled \ + $(ROOT_DIR)/build/lib/create-manifest.sh + ## image.help: Print help for image targets .PHONY: image.help image.help: script/make-rules/image.mk From 04d3f3e6c5bc5dd386daf128742a1fe2a4459659 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 12:13:49 +0800 Subject: [PATCH 04/10] feat(make): complete mk's image module Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/make-rules/image.mk | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/script/make-rules/image.mk b/script/make-rules/image.mk index c584e5220..1949c9cde 100644 --- a/script/make-rules/image.mk +++ b/script/make-rules/image.mk @@ -20,11 +20,10 @@ # docker registry: registry.example.com/namespace/image:tag as: registry.hub.docker.com/cubxxw/: # - DOCKER := docker -DOCKER_SUPPORTED_API_VERSION ?= 1.32 +DOCKER_SUPPORTED_API_VERSION ?= 1.32|1.40 -REGISTRY_PREFIX ?= marmotedu +REGISTRY_PREFIX ?= cubxxw BASE_IMAGE = centos:centos8 EXTRA_ARGS ?= --no-cache @@ -43,10 +42,15 @@ IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/docker/*) # Determine images names by stripping out the dir names IMAGES ?= $(filter-out tools,$(foreach image,${IMAGES_DIR},$(notdir ${image}))) -ifeq (${IMAGES},) - $(error Could not determine IMAGES, set ROOT_DIR or run in source dir) -endif +# ifeq (${IMAGES},) +# $(error Could not determine IMAGES, set ROOT_DIR or run in source dir) +# endif + +# ============================================================================== +# Image targets +# ============================================================================== +## image.verify: Verify docker version .PHONY: image.verify image.verify: $(eval API_VERSION := $(shell $(DOCKER) version | grep -E 'API version: {1,6}[0-9]' | head -n1 | awk '{print $$3} END { if (NR==0) print 0}' )) @@ -57,6 +61,7 @@ image.verify: exit 1; \ fi +## image.daemon.verify: Verify docker daemon experimental features .PHONY: image.daemon.verify image.daemon.verify: $(eval PASS := $(shell $(DOCKER) version | grep -q -E 'Experimental: {1,5}true' && echo 1 || echo 0)) @@ -65,12 +70,15 @@ image.daemon.verify: exit 1; \ fi +## image.build: Build docker images .PHONY: image.build image.build: image.verify go.build.verify $(addprefix image.build., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) +## image.build.multiarch: Build docker images for all platforms .PHONY: image.build.multiarch image.build.multiarch: image.verify go.build.verify $(foreach p,$(PLATFORMS),$(addprefix image.build., $(addprefix $(p)., $(IMAGES)))) +## image.build.%: Build docker image for a specific platform .PHONY: image.build.% image.build.%: go.build.% $(eval IMAGE := $(COMMAND)) @@ -90,22 +98,27 @@ image.build.%: go.build.% fi @rm -rf $(TMP_DIR)/$(IMAGE) +## image.push: Push docker images .PHONY: image.push image.push: image.verify go.build.verify $(addprefix image.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) +## image.push.multiarch: Push docker images for all platforms .PHONY: image.push.multiarch image.push.multiarch: image.verify go.build.verify $(foreach p,$(PLATFORMS),$(addprefix image.push., $(addprefix $(p)., $(IMAGES)))) +## image.push.%: Push docker image for a specific platform .PHONY: image.push.% image.push.%: image.build.% @echo "===========> Pushing image $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX)" $(DOCKER) push $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) +## image.manifest.push: Push manifest list for multi-arch images .PHONY: image.manifest.push image.manifest.push: export DOCKER_CLI_EXPERIMENTAL := enabled image.manifest.push: image.verify go.build.verify \ $(addprefix image.manifest.push., $(addprefix $(IMAGE_PLAT)., $(IMAGES))) +## image.manifest.push.%: Push manifest list for multi-arch images for a specific platform .PHONY: image.manifest.push.% image.manifest.push.%: image.push.% image.manifest.remove.% @echo "===========> Pushing manifest $(IMAGE) $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list" @@ -120,13 +133,16 @@ image.manifest.push.%: image.push.% image.manifest.remove.% # If you find your manifests were not updated, # Please manually delete them in $HOME/.docker/manifests/ # and re-run. +## image.manifest.remove.%: Remove local manifest list .PHONY: image.manifest.remove.% image.manifest.remove.%: @rm -rf ${HOME}/.docker/manifests/docker.io_$(REGISTRY_PREFIX)_$(IMAGE)-$(VERSION) +## image.manifest.push.multiarch: Push manifest list for multi-arch images for all platforms .PHONY: image.manifest.push.multiarch image.manifest.push.multiarch: image.push.multiarch $(addprefix image.manifest.push.multiarch., $(IMAGES)) +## image.manifest.push.multiarch.%: Push manifest list for multi-arch images for all platforms for a specific image .PHONY: image.manifest.push.multiarch.% image.manifest.push.multiarch.%: @echo "===========> Pushing manifest $* $(VERSION) to $(REGISTRY_PREFIX) and then remove the local manifest list" @@ -135,5 +151,5 @@ image.manifest.push.multiarch.%: ## image.help: Print help for image targets .PHONY: image.help -image.help: script/make-rules/image.mk +image.help: scripts/make-rules/image.mk $(call smallhelp) \ No newline at end of file From 3aecfa1a1bbe5def89b087b9e11943066713f63d Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 12:39:56 +0800 Subject: [PATCH 05/10] feat(make): complete mk's build module Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- .gitignore | 2 +- cmd/Open-IM-SDK-Core | 1 - script/make-rules/common.mk | 2 ++ script/make-rules/golang.mk | 12 ++++++------ script/make-rules/tools.mk | 3 +-- 5 files changed, 10 insertions(+), 10 deletions(-) delete mode 160000 cmd/Open-IM-SDK-Core diff --git a/.gitignore b/.gitignore index ef2a69288..63a6a3901 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ out-test tools/ tmp/ bin/ -output/ +_output/ ### OpenIM deploy ### deploy/open_im_demo diff --git a/cmd/Open-IM-SDK-Core b/cmd/Open-IM-SDK-Core deleted file mode 160000 index e731cb86e..000000000 --- a/cmd/Open-IM-SDK-Core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e731cb86ec9314a0b30b4f8331d53854c2c9d858 diff --git a/script/make-rules/common.mk b/script/make-rules/common.mk index 904a97d75..bb900d8ae 100644 --- a/script/make-rules/common.mk +++ b/script/make-rules/common.mk @@ -87,6 +87,8 @@ PLATFORMS ?= linux_amd64 linux_arm64 # The OS can be linux/windows/darwin when building binaries # PLATFORMS ?= darwin_amd64 windows_amd64 linux_amd64 linux_arm64 +# only support linux +GOOS=linux # set a specific PLATFORM, defaults to the host platform ifeq ($(origin PLATFORM), undefined) diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index e0ae4e399..fe4757ee6 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -88,6 +88,11 @@ EXCLUDE_TESTS=github.com/OpenIMSDK/Open-IM-Server/test github.com/OpenIMSDK/Open # BIN_DIR=/root/workspaces/OpenIM/_output/bin # ============================================================================== +## go.build: Build binaries +.PHONY: go.build +go.build: go.build.verify $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS))) + @echo "===========> Building binary $(BINS) $(VERSION) for $(PLATFORM)" + ## go.build.verify: Verify that a suitable version of Go exists .PHONY: go.build.verify go.build.verify: @@ -106,12 +111,7 @@ go.build.%: @echo "=====> BIN_DIR=$(BIN_DIR)" @echo "===========> Building binary $(COMMAND) $(VERSION) for $(OS)_$(ARCH)" @mkdir -p $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH) - @CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_PACKAGE)/cmd/$(COMMAND) - -## go.build: Build binaries -.PHONY: go.build -go.build: go.build.verify $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS))) - @echo "===========> Building binary $(BINS) $(VERSION) for $(PLATFORM)" + @CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go ## go.multiarch: Build multi-arch binaries .PHONY: go.build.multiarch diff --git a/script/make-rules/tools.mk b/script/make-rules/tools.mk index 2c6689668..f4b3ddf08 100644 --- a/script/make-rules/tools.mk +++ b/script/make-rules/tools.mk @@ -17,7 +17,7 @@ # Why download to the tools directory, thinking we might often switch Go versions using gvm. # -# sealer build use BUILD_TOOLS +# openim build use BUILD_TOOLS BUILD_TOOLS ?= golangci-lint goimports addlicense deepcopy-gen conversion-gen ginkgo go-junit-report go-gitlint # Code analysis tools ANALYSIS_TOOLS = golangci-lint goimports golines go-callvis kube-score @@ -71,7 +71,6 @@ install.golangci-lint: install.goimports: @$(GO) install golang.org/x/tools/cmd/goimports@latest -# Actions path: https://github.com/sealerio/sealer/tree/main/.github/workflows/go.yml#L37-L50 ## install.addlicense: Install addlicense, used to add license header to source files .PHONY: install.addlicense install.addlicense: From 9a39c9256d1110efc81a6e7efe75d6a5c312a44f Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 13:08:12 +0800 Subject: [PATCH 06/10] feat:complete the compilation task, compile normally Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/make-rules/golang.mk | 8 ++++++-- script/make-rules/image.mk | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index fe4757ee6..517c60b23 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -111,7 +111,11 @@ go.build.%: @echo "=====> BIN_DIR=$(BIN_DIR)" @echo "===========> Building binary $(COMMAND) $(VERSION) for $(OS)_$(ARCH)" @mkdir -p $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH) - @CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go + @if [ "$(COMMAND)" == "rpc" ] || [ "$(COMMAND)" == "Open-IM-SDK-Core" ]; then \ + echo "===========> Compilation is not yet supported $(COMMAND)"; \ + else \ + CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) $(GO) build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/platforms/$(OS)/$(ARCH)/$(COMMAND)$(GO_OUT_EXT) $(ROOT_DIR)/cmd/$(COMMAND)/main.go; \ + fi ## go.multiarch: Build multi-arch binaries .PHONY: go.build.multiarch @@ -138,7 +142,7 @@ go.lint: tools.verify.golangci-lint ## go.test: Run unit test .PHONY: go.test go.test: - @$(GO) test $(GO_BUILD_FLAGS) ./... + @$(GO) test ./... ## go.test.junit-report: Run unit test .PHONY: go.test.junit-report diff --git a/script/make-rules/image.mk b/script/make-rules/image.mk index 1949c9cde..08bc9d7fc 100644 --- a/script/make-rules/image.mk +++ b/script/make-rules/image.mk @@ -151,5 +151,5 @@ image.manifest.push.multiarch.%: ## image.help: Print help for image targets .PHONY: image.help -image.help: scripts/make-rules/image.mk +image.help: script/make-rules/image.mk $(call smallhelp) \ No newline at end of file From a97ad5ee70dff256ac65aa112edfdd88e34aaea7 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 13:10:45 +0800 Subject: [PATCH 07/10] fix: make up for small problems with pre-push D Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/githooks/pre-push | 1 + 1 file changed, 1 insertion(+) diff --git a/script/githooks/pre-push b/script/githooks/pre-push index 10c4a6d2c..3402ac656 100644 --- a/script/githooks/pre-push +++ b/script/githooks/pre-push @@ -22,6 +22,7 @@ printMessage "Running local OpenIM pre-push hook." if [[ `git status --porcelain` ]]; then printError "This script needs to run against committed code only. Please commit or stash you changes." exit 1 +fi # #printMessage "Running the Flutter analyzer" From b442e92e90981a048d60b50d0accb0a7d003f7c1 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 13:17:29 +0800 Subject: [PATCH 08/10] fix: golang mk Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- script/make-rules/golang.mk | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/script/make-rules/golang.mk b/script/make-rules/golang.mk index 517c60b23..5e3845451 100644 --- a/script/make-rules/golang.mk +++ b/script/make-rules/golang.mk @@ -127,31 +127,28 @@ go.lint: tools.verify.golangci-lint @echo "===========> Run golangci to lint source codes" @$(TOOLS_DIR)/golangci-lint run -c $(ROOT_DIR)/.golangci.yml $(ROOT_DIR)/... -# # @$(GO) test $(GO_BUILD_FLAGS) ./... -# ## go.test: Run unit test -# .PHONY: go.test -# go.test: tools.verify.go-junit-report -# @echo "===========> Run unit test" -# @set -o pipefail;$(GO) test -race -cover -coverprofile=$(OUTPUT_DIR)/coverage.out \ -# -timeout=10m -shuffle=on -short -v `go list ./...|\ -# egrep -v $(subst $(SPACE),'|',$(sort $(EXCLUDE_TESTS)))` 2>&1 | \ -# tee >(go-junit-report --set-exit-code >$(OUTPUT_DIR)/report.xml) -# @sed -i '/mock_.*.go/d' $(OUTPUT_DIR)/coverage.out # remove mock_.*.go files from test coverage -# @$(GO) tool cover -html=$(OUTPUT_DIR)/coverage.out -o $(OUTPUT_DIR)/coverage.html - ## go.test: Run unit test .PHONY: go.test go.test: @$(GO) test ./... +# ## go.test.junit-report: Run unit test +# .PHONY: go.test.junit-report +# go.test.junit-report: tools.verify.go-junit-report +# @echo "===========> Run unit test > $(TMP_DIR)/report.xml" +# @$(GO) test -v -coverprofile=$(TMP_DIR)/coverage.out 2>&1 $(GO_BUILD_FLAGS) ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(TMP_DIR)/report.xml +# @sed -i '/mock_.*.go/d' $(TMP_DIR)/coverage.out +# @echo "===========> Test coverage of Go code is reported to $(TMP_DIR)/coverage.html by generating HTML" +# @$(GO) tool cover -html=$(TMP_DIR)/coverage.out -o $(TMP_DIR)/coverage.html + ## go.test.junit-report: Run unit test .PHONY: go.test.junit-report go.test.junit-report: tools.verify.go-junit-report - @echo "===========> Run unit test > $(TMP_DIR)/report.xml" - @$(GO) test -v -coverprofile=$(TMP_DIR)/coverage.out 2>&1 $(GO_BUILD_FLAGS) ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(TMP_DIR)/report.xml - @sed -i '/mock_.*.go/d' $(TMP_DIR)/coverage.out - @echo "===========> Test coverage of Go code is reported to $(TMP_DIR)/coverage.html by generating HTML" - @$(GO) tool cover -html=$(TMP_DIR)/coverage.out -o $(TMP_DIR)/coverage.html + @echo "===========> Run unit test > $(OUTPUT_DIR)/report.xml" + @$(GO) test -v -coverprofile=$(OUTPUT_DIR)/coverage.out 2>&1 ./... | $(TOOLS_DIR)/go-junit-report -set-exit-code > $(OUTPUT_DIR)/report.xml + @sed -i '/mock_.*.go/d' $(OUTPUT_DIR)/coverage.out + @echo "===========> Test coverage of Go code is reported to $(OUTPUT_DIR)/coverage.html by generating HTML" + @$(GO) tool cover -html=$(OUTPUT_DIR)/coverage.out -o $(OUTPUT_DIR)/coverage.html ## go.test.cover: Run unit test with coverage .PHONY: go.test.cover From 8c11936200ad535b853d44899c2589d1623b7afd Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 13:29:15 +0800 Subject: [PATCH 09/10] feat: set the structure of the rebase Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- .github/labels.yml | 29 ++++++++++++++++++ .github/workflows/check-coverage.yml | 45 ++++++++++++++++++++++++++++ CHANGELOG/CHANGELOG.md | 3 ++ 3 files changed, 77 insertions(+) create mode 100644 .github/labels.yml create mode 100644 .github/workflows/check-coverage.yml create mode 100644 CHANGELOG/CHANGELOG.md diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 000000000..037790523 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,29 @@ +# Refer to Kubernetes for size/* Settings +# https://github.com/Kubernetes/Kubernetes +XS: + name: size/XS + lines: 0 + color: 3CBF00 +S: + name: size/S + lines: 10 + color: 5D9801 +M: + name: size/M + lines: 30 + color: 7F7203 +L: + name: size/L + lines: 100 + color: A14C05 +XL: + name: size/XL + lines: 500 + color: C32607 +XXL: + name: size/XXL + lines: 1000 + color: E50009 + comment: | + # Whoa! Easy there, Partner! + This PR is too big. Please break it up into smaller PRs. \ No newline at end of file diff --git a/.github/workflows/check-coverage.yml b/.github/workflows/check-coverage.yml new file mode 100644 index 000000000..fa92da48b --- /dev/null +++ b/.github/workflows/check-coverage.yml @@ -0,0 +1,45 @@ +name: Check-Coverage + + +on: + workflow_dispatch: + push: + branches: [ "main" ] + paths-ignore: + - "docs/**" + - "**/*.md" + - "**/*.yaml" + - "CONTRIBUTORS" + - "CHANGELOG/**" + pull_request: + branches: [ "*" ] + paths-ignore: + - "docs/**" + - "**/*.md" + - "**/*.yaml" + - "CONTRIBUTORS" + - "CHANGELOG/**" +env: + # Common versions + GO_VERSION: "1.20" + +jobs: + coverage: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Golang with cache + uses: magnetikonline/action-golang-cache@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install Dependencies + run: sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev + + - name: Run Coverage + run: make coverage + + - name: Upload Coverage to Codecov + uses: codecov/codecov-action@v3 diff --git a/CHANGELOG/CHANGELOG.md b/CHANGELOG/CHANGELOG.md new file mode 100644 index 000000000..0f9b12831 --- /dev/null +++ b/CHANGELOG/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +All notable changes to this project will be documented in this file. \ No newline at end of file From 1486001c474b3bb6865b6d698f6ead04dace7f59 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 16 May 2023 13:37:38 +0800 Subject: [PATCH 10/10] fix: cover adjustment in some actions Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- .github/workflows/check-coverage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-coverage.yml b/.github/workflows/check-coverage.yml index fa92da48b..c881bf44b 100644 --- a/.github/workflows/check-coverage.yml +++ b/.github/workflows/check-coverage.yml @@ -38,8 +38,8 @@ jobs: - name: Install Dependencies run: sudo apt update && sudo apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev - - name: Run Coverage - run: make coverage + - name: Run Cover + run: make cover - name: Upload Coverage to Codecov uses: codecov/codecov-action@v3