Skip to content

Commit

Permalink
🌱 Move tool dependencies into go.mod
Browse files Browse the repository at this point in the history
Moved the tool dependencies into go.mod
  • Loading branch information
naveensrinivasan committed May 17, 2021
1 parent ba3b5c5 commit 349d3c3
Show file tree
Hide file tree
Showing 4 changed files with 516 additions and 23 deletions.
27 changes: 12 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHELL := /bin/bash
GOBIN ?= $(GOPATH)/bin
GOPATH := $(go env GOPATH)
GINKGO := $(GOBIN)/ginkgo
GOLANGGCI_LINT := $(GOBIN)/golangci-lint
PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go
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 Down Expand Up @@ -75,6 +68,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 Down Expand Up @@ -133,14 +128,16 @@ 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 @@ -156,13 +153,13 @@ test-disk-cache: build-scorecard | $(GINKGO)
./scorecard \
--repo=https://github.com/ossf/scorecard \
--show-details --metadata=openssf --format json > ./$(OUTPUT)/results.json
USE_DISK_CACHE=1 DISK_CACHE_PATH="./cache" ginkgo -p -v -cover --focus=$(FOCUS_DISK_TEST) ./e2e/...
USE_DISK_CACHE=1 DISK_CACHE_PATH="./cache" $(GINKGO) -p -v -cover --focus=$(FOCUS_DISK_TEST) ./e2e/...
# Rerun the same test with the disk cache filled to make sure the cache is working.
USE_DISK_CACHE=1 DISK_CACHE_PATH="./cache" \
./scorecard \
--repo=https://github.com/ossf/scorecard --show-details \
--metadata=openssf --format json > ./$(OUTPUT)/results.json
USE_DISK_CACHE=1 DISK_CACHE_PATH="./cache" ginkgo -p -v -cover --focus=$(FOCUS_DISK_TEST) ./e2e/...
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
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 349d3c3

Please sign in to comment.