Skip to content

Commit

Permalink
🌱 Move tool dependencies into go.mod (#460)
Browse files Browse the repository at this point in the history
Moved the tool dependencies into go.mod
  • Loading branch information
naveensrinivasan authored May 17, 2021
1 parent 37519d9 commit 9281d1d
Show file tree
Hide file tree
Showing 4 changed files with 523 additions and 26 deletions.
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SHELL := /bin/bash
GOBIN ?= $(GOPATH)/bin
GINKGO := $(GOBIN)/ginkgo
GOLANGGCI_LINT := $(GOBIN)/golangci-lint
PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go
GOPATH := $(go env GOPATH)
GINKGO := ginkgo
GOLANGGCI_LINT := golangci-lint
PROTOC_GEN_GO := protoc-gen-go
PROTOC := $(shell which protoc)
IMAGE_NAME = scorecard
OUTPUT = output
Expand Down Expand Up @@ -31,16 +31,9 @@ help: ## Display this help
################################ make install #################################
.PHONY: install
install: ## Installs all dependencies needed to compile Scorecard
install: | $(GINKGO) $(GOLANGGCI_LINT) $(PROTOC_GEN_GO) $(PROTOC)

$(GINKGO):
go get -u github.com/onsi/ginkgo/ginkgo@v1.16.2

$(GOLANGGCI_LINT):
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.40.0

$(PROTOC_GEN_GO):
go install google.golang.org/protobuf/cmd/protoc-gen-go
install: | $(PROTOC)
@echo Installing tools from tools.go
@cat tools.go | grep _ | awk -F'"' '{print $$2}' | xargs -tI % go install %

$(PROTOC):
ifeq (,$(PROTOC))
Expand All @@ -62,8 +55,10 @@ update-dependencies: ## Update go dependencies for all modules
# Update ./scripts/update go modules
cd ./scripts/update && go mod tidy && go mod verify

$(GOLANGGCI_LINT): install

check-linter: ## Install and run golang linter
check-linter: | $(GOLANGGCI_LINT)
check-linter: $(GOLANGGCI_LINT)
# Run golangci-lint linter
golangci-lint run -n

Expand All @@ -75,6 +70,8 @@ validate-projects: build-scripts
tree-status: ## Verify tree is clean and all changes are committed
# Verify the tree is clean and all changes are commited
./scripts/tree-status


###############################################################################

############################### make build ################################
Expand All @@ -85,7 +82,7 @@ build: $(build-targets)

build-proto: ## Compiles and generates all required protobufs
build-proto: cron/data/request.pb.go
cron/data/request.pb.go: cron/data/request.proto | $(PROTOC_GEN_GO) $(PROTOC)
cron/data/request.pb.go: cron/data/request.proto | $(PROTOC)
protoc --go_out=../../../ cron/data/request.proto

generate-docs: ## Generates docs
Expand Down Expand Up @@ -133,14 +130,17 @@ unit-test: ## Runs unit test without e2e
e2e: ## Runs e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
e2e: build-scorecard check-env | $(GINKGO)
# Run e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
ginkgo --skip="E2E TEST:executable" -p -v -cover ./...
$(GINKGO) --skip="E2E TEST:executable" -p -v -cover ./...

$(GINKGO): install


ci-e2e: ## Runs CI e2e tests. Requires GITHUB_AUTH_TOKEN env var to be set to GitHub personal access token
ci-e2e: build-scorecard check-env e2e-cron | $(GINKGO)
# Run CI e2e tests. GITHUB_AUTH_TOKEN with personal access token must be exported to run this
$(call ndef, GITHUB_AUTH_TOKEN)
@echo Ignoring these test for ci-e2e $(IGNORED_CI_TEST)
ginkgo -p -v -cover --skip=$(IGNORED_CI_TEST) ./e2e/...
$(GINKGO) -p -v -cover --skip=$(IGNORED_CI_TEST) ./e2e/...

test-disk-cache: ## Runs disk cache tests
test-disk-cache: build-scorecard | $(GINKGO)
Expand All @@ -164,6 +164,7 @@ test-disk-cache: build-scorecard | $(GINKGO)
--metadata=openssf --format json > ./$(OUTPUT)/results.json
USE_DISK_CACHE=1 DISK_CACHE_PATH="./cache" ginkgo -p -v -cover --focus=$(FOCUS_DISK_TEST) ./e2e/...


e2e-cron: ## Runs a e2e test cron job and validates its functionality
# Validate cron
GCS_BUCKET=ossf-scorecards-dev go run ./cron/main.go ./e2e/cron-projects.txt
Expand Down
7 changes: 1 addition & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ module github.com/ossf/scorecard
go 1.16

require (
github.com/aws/aws-sdk-go v1.36.30 // indirect
github.com/bradleyfalzon/ghinstallation v1.1.1
github.com/golangci/golangci-lint v1.40.1
github.com/google/go-github/v32 v32.1.0
github.com/jszwec/csvutil v1.5.0
github.com/kr/text v0.2.0 // indirect
github.com/naveensrinivasan/httpcache v1.2.2
github.com/onsi/ginkgo v1.16.2
github.com/onsi/gomega v1.12.0
Expand All @@ -16,16 +15,12 @@ require (
github.com/shurcooL/githubv4 v0.0.0-20200928013246-d292edc3691b
github.com/shurcooL/graphql v0.0.0-20200928012149-18c5c3165e3a // indirect
github.com/spf13/cobra v1.1.3
github.com/stretchr/testify v1.7.0 // indirect
go.uber.org/zap v1.16.0
gocloud.dev v0.22.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/oauth2 v0.0.0-20201203001011-0b49973bad19
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
golang.org/x/tools v0.1.1 // indirect
google.golang.org/protobuf v1.26.0
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
honnef.co/go/tools v0.1.4 // indirect
)
Loading

0 comments on commit 9281d1d

Please sign in to comment.