Skip to content

Commit

Permalink
enable gorules
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
kpango committed Mar 15, 2023
1 parent cf54f75 commit e309c0d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/test-hack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,31 @@ 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 src/github.com/vdaas/vald
working-directory: src/github.com/vdaas/vald
- name: dependencies
run: |
make proto/deps
working-directory: src/github.com/vdaas/vald
- name: Pre-Run tests for hack packages
run: |
make test/hack
working-directory: src/github.com/vdaas/vald
- name: Run tests for hack packages / gotestfmt
run: |
TEST_RESULT_DIR=${GITHUB_WORKSPACE} make test/hack/gotestfmt
TEST_RESULT_DIR=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 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

0 comments on commit e309c0d

Please sign in to comment.