Skip to content

Commit

Permalink
Enable nilaway on CI and remove build tags from linters (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
fridrik01 authored Dec 20, 2024
1 parent b0cc796 commit f9e2640
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
- "lint"
- "slither"
- "gosec"
- "nilaway"
- "markdownlint"
- "generate-check"
- "tidy-sync-check"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/supranational/blst v0.3.13
github.com/umbracle/fastrlp v0.1.0
go.uber.org/automaxprocs v1.6.0
go.uber.org/nilaway v0.0.0-20241010202415-ba14292918d8
Expand Down Expand Up @@ -418,6 +417,7 @@ require (
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions scripts/build/linting.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ lint: ## run all configured linters
# TODO: Remove GODEBUG override once: https://github.com/golang/go/issues/68877 is resolved.
golangci:
@echo "--> Running linter on all modules"
(GODEBUG=gotypesalias=0 go run github.com/golangci/golangci-lint/cmd/golangci-lint --build-tags bls12381 run --config $(ROOT_DIR)/.golangci.yaml --timeout=10m --concurrency 8) || exit 1;
(GODEBUG=gotypesalias=0 go run github.com/golangci/golangci-lint/cmd/golangci-lint run --config $(ROOT_DIR)/.golangci.yaml --timeout=10m --concurrency 8) || exit 1;
@printf "All modules complete\n"


# TODO: Remove GODEBUG override once: https://github.com/golang/go/issues/68877 is resolved.
golangci-fix:
@echo "--> Running linter with fixes on all modules"
(GODEBUG=gotypesalias=0 go run github.com/golangci/golangci-lint/cmd/golangci-lint --build-tags bls12381 run --config $(ROOT_DIR)/.golangci.yaml --timeout=10m --fix --concurrency 8) || exit 1;
(GODEBUG=gotypesalias=0 go run github.com/golangci/golangci-lint/cmd/golangci-lint run --config $(ROOT_DIR)/.golangci.yaml --timeout=10m --fix --concurrency 8) || exit 1;
@printf "All modules complete\n"

#################
Expand Down Expand Up @@ -53,7 +53,7 @@ license-fix:

nilaway:
@echo "--> Running nilaway"
(go run go.uber.org/nilaway/cmd/nilaway --tags bls12381 -exclude-errors-in-files "geth-primitives/deposit/" -v ./...) || exit 1;
(go run go.uber.org/nilaway/cmd/nilaway -exclude-errors-in-files "geth-primitives/deposit/" -v ./...) || exit 1;
@printf "Nilaway check complete\n"

#################
Expand All @@ -62,7 +62,7 @@ nilaway:

gosec:
@echo "--> Running gosec"
@go run github.com/cosmos/gosec/v2/cmd/gosec -tags bls12381 -exclude-dir node-core/components/signer -exclude G702 ./...
@go run github.com/cosmos/gosec/v2/cmd/gosec -exclude G702 ./...

#################
# slither #
Expand Down
14 changes: 7 additions & 7 deletions scripts/build/testing.mk
Original file line number Diff line number Diff line change
Expand Up @@ -258,26 +258,26 @@ test:
test-unit: ## run golang unit tests
@echo "Running unit tests..."
@go list -f '{{.Dir}}/...' -m | xargs \
go test --tags bls12381 -race
go test -race

test-unit-cover: ## run golang unit tests with coverage
@echo "Running unit tests with coverage..."
@go list -f '{{.Dir}}/...' -m | xargs \
go test --tags bls12381 -race -coverprofile=test-unit-cover.txt
go test -race -coverprofile=test-unit-cover.txt

test-unit-bench: ## run golang unit benchmarks
@echo "Running unit tests with benchmarks..."
@go list -f '{{.Dir}}/...' -m | xargs \
go test --tags bls12381 -bench=. -run=^$ -benchmem
go test -bench=. -run=^$ -benchmem

# On MacOS, if there is a linking issue on the fuzz tests,
# use the old linker with flags -ldflags=-extldflags=-Wl,-ld_classic
test-unit-fuzz: ## run fuzz tests
@echo "Running fuzz tests with coverage..."
go test --tags bls12381 -run ^FuzzPayloadIDCacheBasic -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test --tags bls12381 -run ^FuzzPayloadIDInvalidInput -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test --tags bls12381 -run ^FuzzPayloadIDCacheConcurrency -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test --tags bls12381 -run ^FuzzHashTreeRoot -fuzztime=${MEDIUM_FUZZ_TIME} github.com/berachain/beacon-kit/primitives/merkle
go test -run ^FuzzPayloadIDCacheBasic -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test -run ^FuzzPayloadIDInvalidInput -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test -run ^FuzzPayloadIDCacheConcurrency -fuzztime=${SHORT_FUZZ_TIME} github.com/berachain/beacon-kit/payload/cache
go test -run ^FuzzHashTreeRoot -fuzztime=${MEDIUM_FUZZ_TIME} github.com/berachain/beacon-kit/primitives/merkle

test-e2e: ## run e2e tests
@$(MAKE) build-docker VERSION=kurtosis-local test-e2e-no-build
Expand Down

0 comments on commit f9e2640

Please sign in to comment.