github.com/robszumski/deis@v1.4.1/logger/Makefile (about)

     1  include ../includes.mk
     2  
     3  # the filepath to this repository, relative to $GOPATH/src
     4  repo_path = github.com/deis/deis/logger
     5  
     6  GO_FILES = main.go
     7  GO_PACKAGES = syslog syslogd tests
     8  GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
     9  GO_TESTABLE_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,syslog syslogd)
    10  
    11  COMPONENT = $(notdir $(repo_path))
    12  IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG)
    13  DEV_IMAGE = $(DEV_REGISTRY)/$(IMAGE)
    14  BINARY_DEST_DIR = image/bin
    15  
    16  build: check-docker
    17  	GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -v -ldflags '-s' -o $(BINARY_DEST_DIR)/logger github.com/deis/deis/logger || exit 1
    18  	docker build -t $(IMAGE) image
    19  
    20  clean: check-docker check-registry
    21  	rm -f image/bin/logger
    22  	docker rmi $(IMAGE)
    23  
    24  full-clean: check-docker check-registry
    25  	docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f
    26  
    27  install: check-deisctl
    28  	deisctl install $(COMPONENT)
    29  
    30  uninstall: check-deisctl
    31  	deisctl uninstall $(COMPONENT)
    32  
    33  start: check-deisctl
    34  	deisctl start $(COMPONENT)
    35  
    36  stop: check-deisctl
    37  	deisctl stop $(COMPONENT)
    38  
    39  restart: stop start
    40  
    41  run: install start
    42  
    43  dev-release: push set-image
    44  
    45  push: check-registry
    46  	docker tag -f $(IMAGE) $(DEV_IMAGE)
    47  	docker push $(DEV_IMAGE)
    48  
    49  set-image: check-deisctl
    50  	deisctl config $(COMPONENT) set image=$(DEV_IMAGE)
    51  
    52  release:
    53  	docker push $(IMAGE)
    54  
    55  deploy: build dev-release restart
    56  
    57  setup-root-gotools:
    58  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/cover
    59  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/vet
    60  	sudo rm -rf /tmp/tmpGOPATH
    61  
    62  setup-gotools:
    63  	go get -v github.com/golang/lint/golint
    64  
    65  test: test-style test-unit test-functional
    66  
    67  test-functional:
    68  	@docker history deis/test-etcd >/dev/null 2>&1 || docker pull deis/test-etcd:latest
    69  	GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/...
    70  
    71  test-style:
    72  # display output, then check
    73  	$(GOFMT) $(GO_PACKAGES) $(GO_FILES)
    74  	@$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
    75  	$(GOVET) $(repo_path) $(GO_PACKAGES_REPO_PATH)
    76  	$(GOLINT) ./...
    77  
    78  test-unit: test-style
    79  	$(GOTEST) $(GO_TESTABLE_PACKAGES_REPO_PATH)
    80  
    81  coverage:
    82  	go test -coverprofile coverage.out ./syslog
    83  	go tool cover -html=coverage.out