| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- .PHONY: test test-cover build release-builds
- VERSION := `git fetch --tags && git tag | sort -V | tail -1`
- PKG=github.com/zricethezav/gitleaks
- LDFLAGS=-ldflags "-X=github.com/zricethezav/gitleaks/version.Version=$(VERSION)"
- COVER=--cover --coverprofile=cover.out
- test-cover:
- go test ./... --race $(COVER) $(PKG) -v
- go tool cover -html=cover.out
- test:
- go get golang.org/x/lint/golint
- go fmt ./...
- golint ./...
- go test ./... --race $(PKG) -v
- test-integration:
- go test github.com/zricethezav/gitleaks/hosts -v -integration
- build:
- go fmt ./...
- golint ./...
- go mod tidy
- go build $(LDFLAGS)
- release-builds:
- rm -rf build
- mkdir build
- env GOOS="windows" GOARCH="amd64" go build -o "build/gitleaks-windows-amd64.exe" $(LDFLAGS)
- env GOOS="windows" GOARCH="386" go build -o "build/gitleaks-windows-386.exe" $(LDFLAGS)
- env GOOS="linux" GOARCH="amd64" go build -o "build/gitleaks-linux-amd64" $(LDFLAGS)
- env GOOS="linux" GOARCH="arm" go build -o "build/gitleaks-linux-arm" $(LDFLAGS)
- env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips" $(LDFLAGS)
- env GOOS="linux" GOARCH="mips" go build -o "build/gitleaks-linux-mips" $(LDFLAGS)
- env GOOS="darwin" GOARCH="amd64" go build -o "build/gitleaks-darwin-amd64" $(LDFLAGS)
- deploy:
- @echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
- docker build -f Dockerfile -t $(REPO):$(TAG) .
- echo "Pushing $(REPO):$(COMMIT) $(REPO):$(TAG)"
- docker push $(REPO)
|