2018-03-12 22:57:10 +00:00
|
|
|
GIT_TAG?= $(shell git describe --always --tags)
|
2018-07-19 17:42:25 +01:00
|
|
|
BIN = gosec
|
2018-03-12 22:57:10 +00:00
|
|
|
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
2018-08-19 01:28:17 +01:00
|
|
|
IMAGE_REPO = securego
|
2019-04-25 11:48:22 +01:00
|
|
|
BUILDFLAGS := '-w -s'
|
2018-08-15 08:53:33 +01:00
|
|
|
CGO_ENABLED = 0
|
2018-03-12 22:57:10 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
$(MAKE) build
|
|
|
|
|
2019-04-25 13:22:49 +01:00
|
|
|
test: build
|
2018-03-12 22:57:10 +00:00
|
|
|
test -z '$(FMT_CMD)'
|
|
|
|
go vet $(go list ./... | grep -v /vendor/)
|
|
|
|
golint -set_exit_status $(shell go list ./... | grep -v vendor)
|
2019-04-25 13:22:49 +01:00
|
|
|
./$(BIN) ./...
|
2018-03-12 22:57:10 +00:00
|
|
|
ginkgo -r -v
|
2018-07-27 13:41:45 +01:00
|
|
|
|
2018-12-11 16:08:31 +00:00
|
|
|
test-coverage:
|
|
|
|
go test -race -coverprofile=coverage.txt -covermode=atomic
|
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
build:
|
2018-07-19 17:42:25 +01:00
|
|
|
go build -o $(BIN) ./cmd/gosec/
|
2018-07-27 13:41:45 +01:00
|
|
|
|
2018-03-12 22:57:10 +00:00
|
|
|
clean:
|
2018-07-27 13:41:45 +01:00
|
|
|
rm -rf build vendor dist
|
2019-04-25 08:31:00 +01:00
|
|
|
rm -f release image $(BIN)
|
2018-07-27 13:41:45 +01:00
|
|
|
|
2019-04-25 08:31:00 +01:00
|
|
|
release:
|
2018-07-27 13:41:45 +01:00
|
|
|
@echo "Releasing the gosec binary..."
|
|
|
|
goreleaser release
|
2018-08-15 08:53:33 +01:00
|
|
|
|
|
|
|
build-linux:
|
|
|
|
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o $(BIN) ./cmd/gosec/
|
2018-03-12 22:57:10 +00:00
|
|
|
|
2018-09-26 06:09:20 +01:00
|
|
|
image:
|
2018-03-12 22:57:10 +00:00
|
|
|
@echo "Building the Docker image..."
|
2018-07-27 13:41:45 +01:00
|
|
|
docker build -t $(IMAGE_REPO)/$(BIN):$(GIT_TAG) .
|
|
|
|
docker tag $(IMAGE_REPO)/$(BIN):$(GIT_TAG) $(IMAGE_REPO)/$(BIN):latest
|
2018-03-12 22:57:10 +00:00
|
|
|
touch image
|
|
|
|
|
|
|
|
image-push: image
|
|
|
|
@echo "Pushing the Docker image..."
|
2018-08-19 01:28:17 +01:00
|
|
|
docker push $(IMAGE_REPO)/$(BIN):$(GIT_TAG)
|
2018-03-12 22:57:10 +00:00
|
|
|
docker push $(IMAGE_REPO)/$(BIN):latest
|
|
|
|
|
2018-07-27 13:41:45 +01:00
|
|
|
.PHONY: test build clean release image image-push
|
2018-03-12 22:57:10 +00:00
|
|
|
|