Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 mod tidy
  18. go build $(LDFLAGS)
  19. release-builds:
  20. rm -rf build
  21. mkdir build
  22. env GOOS="windows" GOARCH="amd64" go build -o "build/gitleaks-windows-amd64.exe"
  23. env GOOS="windows" GOARCH="386" go build -o "build/gitleaks-windows-386.exe"
  24. env GOOS="linux" GOARCH="amd64" go build -o "build/gitleaks-linux-amd64"
  25. env GOOS="linux" GOARCH="arm" go build -o "build/gitleaks-linux-arm"
  26. env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
  27. env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips"
  28. env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64"
  29. deploy:
  30. @echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
  31. docker build -f Dockerfile -t $(REPO):$(TAG) .
  32. echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
  33. docker push $(REPO)