Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable gorules #1980

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/test-hack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,27 @@ jobs:
runs-on: ubuntu-latest
container:
image: ghcr.io/vdaas/vald/vald-ci-container:nightly
defaults:
run:
working-directory: src/github.com/vdaas/vald
steps:
- name: Check out code.
uses: actions/checkout@v3
with:
fetch-depth: 1
path: src/github.com/vdaas/vald
- name: set git config
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${GITHUB_WORKSPACE}/src/github.com/vdaas/vald
working-directory: src/github.com/vdaas/vald
- name: dependencies
run: |
make proto/deps
GOPATH=${GITHUB_WORKSPACE} make proto/deps
working-directory: src/github.com/vdaas/vald
- name: Run tests for hack packages / gotestfmt
run: |
TEST_RESULT_DIR=${GITHUB_WORKSPACE} make test/hack/gotestfmt
GOPATH=${GITHUB_WORKSPACE} TEST_RESULT_DIR=${GITHUB_WORKSPACE}/src/github.com/vdaas/vald make test/hack/gotestfmt
working-directory: src/github.com/vdaas/vald
- name: print tparse result
run: |
tparse -notests -smallscreen -sort cover -format markdown -file ${GITHUB_WORKSPACE}/test-hack-gotestfmt-result.json
tparse -notests -smallscreen -sort cover -format markdown -file ${GITHUB_WORKSPACE}/src/github.com/vdaas/vald/test-hack-gotestfmt-result.json
12 changes: 9 additions & 3 deletions Makefile.d/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ test/hack/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -short -shuffle=on -race -mod=readonly -json -cover \
go mod vendor -o $(ROOTDIR)/vendor
go test -short -shuffle=on -race -mod=vendor -json -cover \
$(ROOTDIR)/hack/gorules/... \
$(ROOTDIR)/hack/helm/... \
$(ROOTDIR)/hack/license/... \
$(ROOTDIR)/hack/tools/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests
rm -rf $(ROOTDIR)/vendor

.PHONY: test/all/tparse
## run tests for all Go codes and show table
Expand Down Expand Up @@ -154,13 +156,15 @@ test/hack/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -short -shuffle=on -race -mod=readonly -json -cover \
go mod vendor -o $(ROOTDIR)/vendor
go test -short -shuffle=on -race -mod=vendor -json -cover \
$(ROOTDIR)/hack/gorules/... \
$(ROOTDIR)/hack/helm/... \
$(ROOTDIR)/hack/license/... \
$(ROOTDIR)/hack/tools/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus
rm -rf $(ROOTDIR)/vendor

.PHONY: test/all/gotestfmt
## run tests for all Go codes and show table
Expand Down Expand Up @@ -190,11 +194,13 @@ test/cmd:
.PHONY: test/hack
## run tests for hack
test/hack:
go test -short -shuffle=on -race -mod=readonly -cover \
go mod vendor -o $(ROOTDIR)/vendor
go test -short -shuffle=on -race -mod=vendor -cover \
$(ROOTDIR)/hack/gorules... \
$(ROOTDIR)/hack/helm/... \
$(ROOTDIR)/hack/license/...\
$(ROOTDIR)/hack/tools/...
rm -rf $(ROOTDIR)/vendor

.PHONY: test/all
## run tests for all Go codes
Expand Down
10 changes: 5 additions & 5 deletions apis/grpc/v1/payload/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ type Payload interface {
ProtoMessage()
ProtoReflect() protoreflect.Message
Descriptor() ([]byte, []int)
// MarshalToSizedBufferVT(dAtA []byte) (int, error)
// MarshalToVT(dAtA []byte) (int, error)
// MarshalVT() (dAtA []byte, err error)
// SizeVT() (n int)
// UnmarshalVT(dAtA []byte) error
MarshalToSizedBufferVT(dAtA []byte) (int, error)
MarshalToVT(dAtA []byte) (int, error)
MarshalVT() (dAtA []byte, err error)
SizeVT() (n int)
UnmarshalVT(dAtA []byte) error
}
2 changes: 0 additions & 2 deletions hack/gorules/rules_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//go:build exclude

// Copyright (C) 2019-2023 vdaas.org vald team <vald@vdaas.org>
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion hack/gorules/testdata/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// 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 target
package testdata

import (
"fmt"
Expand Down