Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from rebuy-de/update-build
Browse files Browse the repository at this point in the history
update build scripts
  • Loading branch information
svenwltr authored Apr 13, 2017
2 parents 5bb7cc2 + 5b37733 commit bfdc08b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Source: https://github.com/rebuy-de/golang-template
# Version: 1.0.0
# Version: 1.3.1

FROM golang:1.8-alpine

Expand All @@ -10,6 +10,9 @@ ENV GOPATH /go
ENV PATH /go/bin:$PATH
RUN mkdir -p ${GOPATH}/src ${GOPATH}/bin

# Install Go Tools
RUN go get -u github.com/golang/lint/golint

# Install Glide
RUN go get -u github.com/Masterminds/glide/...

Expand All @@ -20,6 +23,6 @@ RUN go install

COPY . /go/src/github.com/rebuy-de/aws-nuke
WORKDIR /go/src/github.com/rebuy-de/aws-nuke
RUN make install
RUN CGO_ENABLED=0 make install

ENTRYPOINT ["/go/bin/aws-nuke"]
30 changes: 22 additions & 8 deletions golang.mk
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Source: https://github.com/rebuy-de/golang-template
# Version: 1.0.0
# Version: 1.3.1
# Dependencies:
# * Glide
# * gocov (https://github.com/axw/gocov)
# * gocov-html (https://github.com/matm/gocov-html)

NAME=$(notdir $(PACKAGE))

BUILD_VERSION=$(shell git describe --always --dirty | tr '-' '.' )
BUILD_DATE=$(shell date -Iseconds)
BUILD_VERSION=$(shell git describe --always --dirty --tags | tr '-' '.' )
BUILD_DATE=$(shell date)
BUILD_HASH=$(shell git rev-parse HEAD)
BUILD_MACHINE=$(shell echo $$HOSTNAME)
BUILD_USER=$(shell whoami)
Expand All @@ -35,22 +35,36 @@ vendor: glide.lock glide.yaml
format:
gofmt -s -w $(GOFILES)

test: vendor
go test $(GOPKGS)

vet:
go vet $(GOPKGS)

lint:
$(foreach pkg,$(GOPKGS),golint $(pkg);)

test_gopath:
test $$(go list) = "$(PACKAGE)"

test_packages: vendor
go test $(GOPKGS)

test_format:
gofmt -l $(GOFILES)

test: test_gopath test_format vet lint test_packages

cov:
gocov test -v $(GOPKGS) \
| gocov-html > coverage.html

build: vendor
go build \
$(BUILD_FLAGS) \
-o $(NAME)-$(BUILD_VERSION)
ln -sf $(NAME)-$(BUILD_VERSION) $(NAME)
-o $(NAME)-$(BUILD_VERSION)-$(shell go env GOOS)-$(shell go env GOARCH)
ln -sf $(NAME)-$(BUILD_VERSION)-$(shell go env GOOS)-$(shell go env GOARCH) $(NAME)

xc:
GOOS=linux GOARCH=amd64 make build
GOOS=darwin GOARCH=amd64 make build

install: test
go install \
Expand Down

0 comments on commit bfdc08b

Please sign in to comment.