Skip to content

Commit

Permalink
feat: Remove Go Typecheck Tools Implement GitHub Actions Based Typech…
Browse files Browse the repository at this point in the history
…eck for OpenIM (#2140)

* feat: remove go typecheck tools

* feat: add actions go  typecheck tools

* Update verify-typecheck.sh
  • Loading branch information
cubxxw committed Mar 25, 2024
1 parent f6ab243 commit 71f6208
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 547 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/openimci.yml
Expand Up @@ -57,7 +57,7 @@ jobs:
steps:
- name: Setup
uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v5
with:
Expand All @@ -70,6 +70,9 @@ jobs:
version: '3.x' # If available, use the latest major version that's compatible
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Code Typecheck Detector
uses: kubecub/typecheck@main

- name: Module Operations
run: |
sudo make tidy
Expand Down
1 change: 0 additions & 1 deletion go.work
Expand Up @@ -2,7 +2,6 @@ go 1.19

use (
.
./test/typecheck
./tools/changelog
./tools/component
./tools/formitychecker
Expand Down
11 changes: 11 additions & 0 deletions scripts/make-rules/tools.mk
Expand Up @@ -237,6 +237,17 @@ install.richgo:
install.rts:
@$(GO) install github.com/galeone/rts/cmd/rts@latest

# ================= kubecub openim tools =========================================
## install.typecheck: install kubecub typecheck check for go code
.PHONY: install.typecheck
install.typecheck:
@$(GO) install github.com/kubecub/typecheck@latest

## install.comment-lang-detector: install kubecub comment-lang-detector check for go code comment language
.PHONY: install.comment-lang-detector
install.comment-lang-detector:
@$(GO) install github.com/kubecub/comment-lang-detector/cmd/cld@latest

## tools.help: Display help information about the tools package
.PHONY: tools.help
tools.help: scripts/make-rules/tools.mk
Expand Down
4 changes: 0 additions & 4 deletions scripts/run-in-gopath.sh
Expand Up @@ -20,10 +20,6 @@
# the project.
# Usage: `scripts/run-in-gopath.sh <command>`.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

Expand Down
6 changes: 1 addition & 5 deletions scripts/update-generated-docs.sh
Expand Up @@ -18,10 +18,6 @@
# immediately before exporting docs. We do not want to check these documents in
# by default.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

Expand All @@ -33,7 +29,7 @@ BINS=(
genman
genyaml
)
make -C "${OPENIM_ROOT}" WHAT="${BINS[*]}"
make -C "${OPENIM_ROOT}" BINS="${BINS[*]}"

openim::util::ensure-temp-dir

Expand Down
5 changes: 0 additions & 5 deletions scripts/update-yamlfmt.sh
Expand Up @@ -13,11 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.






OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

Expand Down
4 changes: 0 additions & 4 deletions scripts/verify-shellcheck.sh
Expand Up @@ -17,10 +17,6 @@
# This script lints each shell script by `shellcheck`.
# Usage: `scripts/verify-shellcheck.sh`.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

Expand Down
4 changes: 0 additions & 4 deletions scripts/verify-spelling.sh
Expand Up @@ -17,10 +17,6 @@
# working directory by client9/misspell package.
# Usage: `scripts/verify-spelling.sh`.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
export OPENIM_ROOT
source "${OPENIM_ROOT}/scripts/lib/init.sh"
Expand Down
13 changes: 3 additions & 10 deletions scripts/verify-typecheck.sh
Expand Up @@ -16,26 +16,19 @@
# This script does a fast type check of script srnetes code for all platforms.
# Usage: `scripts/verify-typecheck.sh`.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

openim::golang::verify_go_version

cd "${OPENIM_ROOT}"

# As of June, 2020 the typecheck tool is written in terms of go/packages, but
# that library doesn't work well with multiple modules. Until that is done,
# force this tooling to run in a fake GOPATH.
ret=0
TYPECHECK_SERIAL="${TYPECHECK_SERIAL:-false}"
scripts/run-in-gopath.sh \
go run test/typecheck/typecheck.go "$@" "--serial=$TYPECHECK_SERIAL" || ret=$?
make tools.verify.typecheck
${OPENIM_ROOT}/_output/tools/typecheck "$@" "--serial=$TYPECHECK_SERIAL" || ret=$?
if [[ $ret -ne 0 ]]; then
openim::log::error "Type Check has failed. This may cause cross platform build failures." >&2
openim::log::error "Please see https://github.com/openimsdk/open-im-server/tree/main/test/typecheck for more information." >&2
openim::log::error "Please see https://github.com/kubecub/typecheck for more information." >&2
exit 1
fi
4 changes: 0 additions & 4 deletions scripts/verify-yamlfmt.sh
Expand Up @@ -19,10 +19,6 @@
#
# Usage: `scripts/verify-yamlfmt.sh`.





OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${OPENIM_ROOT}/scripts/lib/init.sh"

Expand Down
52 changes: 0 additions & 52 deletions test/typecheck/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions test/typecheck/go.mod

This file was deleted.

7 changes: 0 additions & 7 deletions test/typecheck/go.sum

This file was deleted.

0 comments on commit 71f6208

Please sign in to comment.