2021-02-13 00:54:06 +03:00
|
|
|
SHELL := /bin/bash
|
|
|
|
all: fmt tidy lint test
|
2020-12-23 00:43:24 +03:00
|
|
|
build:
|
2021-02-14 22:54:44 +03:00
|
|
|
CGO_ENABLED=0 go build -a -tags netgo -ldflags '-w -extldflags "-static"'
|
2020-12-23 00:43:24 +03:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
go fmt ./...
|
|
|
|
|
2021-01-01 23:36:31 +03:00
|
|
|
# ignoring e2e tests
|
2020-12-23 00:43:24 +03:00
|
|
|
test:
|
2021-01-27 01:17:31 +03:00
|
|
|
go test -covermode atomic `go list ./... | grep -v e2e`
|
2020-12-23 00:43:24 +03:00
|
|
|
|
|
|
|
tidy:
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
|
|
|
|
golangci-lint:
|
|
|
|
@[ -f $(GOLANGCI_LINT) ] || { \
|
|
|
|
set -e ;\
|
|
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) v1.29.0 ;\
|
|
|
|
}
|
|
|
|
|
|
|
|
lint: golangci-lint ## Run golangci-lint linter
|
|
|
|
$(GOLANGCI_LINT) run
|
|
|
|
|
2021-02-13 00:54:06 +03:00
|
|
|
check-env:
|
|
|
|
ifndef GITHUB_AUTH_TOKEN
|
|
|
|
$(error GITHUB_AUTH_TOKEN is undefined)
|
|
|
|
endif
|
|
|
|
|
2021-01-01 23:36:31 +03:00
|
|
|
.PHONY: e2e
|
2021-02-14 20:43:21 +03:00
|
|
|
# export GITHUB_AUTH_TOKEN with personal access token to run the e2e
|
|
|
|
e2e: build check-env
|
|
|
|
ginkgo --skip="E2E TEST:executable" -p -v -cover ./...
|
2021-01-01 23:36:31 +03:00
|
|
|
|
2021-02-13 00:54:06 +03:00
|
|
|
|
|
|
|
.PHONY: ci-e2e
|
2021-02-14 20:43:21 +03:00
|
|
|
# export GITHUB_AUTH_TOKEN with personal access token to run the e2e
|
2021-02-13 00:54:06 +03:00
|
|
|
ci-e2e: build check-env
|
|
|
|
$(call ndef, GITHUB_AUTH_TOKEN)
|
|
|
|
mkdir -p bin
|
|
|
|
./scorecard --repo=https://github.com/ossf/scorecard --format json > ./bin/results.json
|
2021-02-14 20:43:21 +03:00
|
|
|
ginkgo -p -v -cover ./...
|
|
|
|
|