mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 03:55:54 +00:00
e809226800
* Add a semantic version to the usage text * Add a comment to the version function * Inject the version, git tag and build date as build variables * Update README * Fix lint warnings * Update README * Manage dependencies with dep tool instead of godep * Add a Makefile for common build tasks * Update the build file to use the make tool * Update Dockerfile * Add docker entry point in to make the passing of arguments easy * Update README * Add missing tools to the build * Drop 1.7 support and add 1.10 * Fix Go 1.10 according with the travis guidelines https://docs.travis-ci.com/user/languages/go/ * Update the tls-observatory package * Fix lint warnings * Change the output of the tests to be more verbose * Check if the are build errors before executing the rule test
48 lines
1.3 KiB
Makefile
48 lines
1.3 KiB
Makefile
GIT_TAG?= $(shell git describe --always --tags)
|
|
BUILD_DATE = $(shell date +%Y-%m-%d)
|
|
BIN = gas
|
|
BUILD_CMD = go build -ldflags "-X main.Version=${VERSION} -X main.GitTag=${GIT_TAG} -X main.BuildDate=${BUILD_DATE}" -o build/$(BIN)-$(VERSION)-$${GOOS}-$${GOARCH} ./cmd/gas/ &
|
|
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
|
IMAGE_REPO = docker.io
|
|
|
|
default:
|
|
$(MAKE) bootstrap
|
|
$(MAKE) build
|
|
|
|
test: bootstrap
|
|
test -z '$(FMT_CMD)'
|
|
go vet $(go list ./... | grep -v /vendor/)
|
|
golint -set_exit_status $(shell go list ./... | grep -v vendor)
|
|
gas ./...
|
|
ginkgo -r -v
|
|
bootstrap:
|
|
dep ensure
|
|
build:
|
|
go build -o $(BIN) ./cmd/gas/
|
|
clean:
|
|
rm -rf build vendor
|
|
rm -f release image bootstrap $(BIN)
|
|
release: bootstrap
|
|
ifndef VERSION
|
|
$(error VERSION flag is not set. Run 'make release VERSION=<YOUR VERSION>'.)
|
|
endif
|
|
@echo "Running build command..."
|
|
bash -c '\
|
|
export GOOS=linux; export GOARCH=amd64; export CGO_ENABLED=0; $(BUILD_CMD) \
|
|
wait \
|
|
'
|
|
touch release
|
|
|
|
image: release
|
|
@echo "Building the Docker image..."
|
|
docker build -t $(IMAGE_REPO)/$(BIN):$(VERSION) .
|
|
docker tag $(IMAGE_REPO)/$(BIN):$(VERSION) $(IMAGE_REPO)/$(BIN):latest
|
|
touch image
|
|
|
|
image-push: image
|
|
@echo "Pushing the Docker image..."
|
|
docker push $(IMAGE_REPO)/$(BIN):$(VERSION)
|
|
docker push $(IMAGE_REPO)/$(BIN):latest
|
|
|
|
.PHONY: test build clean image-push
|
|
|