Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. .PHONY: test test-cover build release-builds
  2. VERSION := `git fetch --tags && git tag | sort -V | tail -1`
  3. PKG=github.com/zricethezav/gitleaks
  4. LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/version.Version=$(VERSION)"
  5. COVER=--cover --coverprofile=cover.out
  6. test-cover:
  7. go test ./... --race $(COVER) $(PKG) -v
  8. go tool cover -html=cover.out
  9. test:
  10. go get golang.org/x/lint/golint
  11. go fmt ./...
  12. golint ./...
  13. go test ./... --race $(PKG) -v
  14. test-integration:
  15. go test github.com/zricethezav/gitleaks/hosts -v -integration
  16. build:
  17. go fmt ./...
  18. golint ./...
  19. go mod tidy
  20. go build $(LDFLAGS)
  21. release-builds:
  22. rm -rf build
  23. mkdir build
  24. env GOOS="windows" GOARCH="amd64" go build -o "build/gitleaks-windows-amd64.exe"
  25. env GOOS="windows" GOARCH="386" go build -o "build/gitleaks-windows-386.exe"
  26. env GOOS="linux" GOARCH="amd64" go build -o "build/gitleaks-linux-amd64"
  27. env GOOS="linux" GOARCH="arm" go build -o "build/gitleaks-linux-arm"
  28. env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
  29. env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
  30. env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64"
  31. deploy:
  32. @echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
  33. docker build -f Dockerfile -t $(REPO):$(TAG) .
  34. echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
  35. docker push $(REPO)