Skip to content

Commit

Permalink
Merge pull request #177 from weaveworks/fix-coveralls
Browse files Browse the repository at this point in the history
Fix coveralls
  • Loading branch information
errordeveloper committed Aug 28, 2018
2 parents e002785 + 0734ff0 commit 8647f49
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 54 deletions.
16 changes: 0 additions & 16 deletions .circleci/config.yml
Expand Up @@ -11,27 +11,11 @@ jobs:
steps:
- checkout
- run: make release
coverage:
docker:
- image: circleci/golang:1.10
working_directory: /go/src/github.com/weaveworks/eksctl
steps:
- checkout
- restore_cache:
keys:
- v1-pkg-cache
- run: make setup-coverage
- run: make test-with-coverage
- save_cache:
key: v1-pkg-cache
paths:
- "/go/pkg"

workflows:
version: 2
any-commit:
jobs:
- coverage
- make-eksctl-image:
filters:
tags:
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Expand Up @@ -21,12 +21,13 @@ RUN apk add --no-cache --initdb --root /out \
python \
&& true

RUN go get github.com/jteeuwen/go-bindata/go-bindata

ENV EKSCTL $GOPATH/src/github.com/weaveworks/eksctl
RUN mkdir -p "$(dirname ${EKSCTL})"
COPY . $EKSCTL

ARG COVERALLS_TOKEN
ENV COVERALLS_TOKEN $COVERALLS_TOKEN

WORKDIR $EKSCTL
RUN make test && make \
&& cp ./eksctl /out/usr/local/bin/eksctl
Expand Down
47 changes: 17 additions & 30 deletions Makefile
Expand Up @@ -6,51 +6,38 @@ EKSCTL_IMAGE ?= weaveworks/eksctl:latest

.PHONY: build
build:
go build -ldflags "-X main.gitCommit=$(git_commit) -X main.builtAt=$(built_at)" ./cmd/eksctl
@go build -ldflags "-X main.gitCommit=$(git_commit) -X main.builtAt=$(built_at)" ./cmd/eksctl

.PHONY: install-build-deps
install-build-deps:
@cd build && dep ensure && ./install.sh

.PHONY: test
test:
go test -v ./pkg/... ./cmd/...

.PHONY: test-with-coverage
test-with-coverage:
go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
goveralls -coverprofile=coverage.out -service=circle-ci

.PHONY: setup-coverage
setup-coverage:
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
go get github.com/mattn/goveralls

.PHONY: update-bindata
update-bindata:
go generate ./pkg/eks
@go test -v -covermode=count -coverprofile=coverage.out ./pkg/... ./cmd/...
@test -z $(COVERALLS_TOKEN) || goveralls -coverprofile=coverage.out -service=circle-ci

.PHONY: install-bindata
install-bindata:
go get -u github.com/jteeuwen/go-bindata/...

.PHONY: update-mockery
update-mockery:
go generate ./pkg/eks/mocks

.PHONY: install-mockery
install-mockery:
go get -u github.com/vektra/mockery/cmd/mockery
.PHONY: generated
generate:
@go generate ./pkg/eks ./pkg/eks/mocks

.PHONY: eksctl-build-image
eksctl-build-image:
@-docker pull $(EKSCTL_BUILD_IMAGE)
@docker build --tag=$(EKSCTL_BUILD_IMAGE) --cache-from=$(EKSCTL_BUILD_IMAGE) ./build

EKSCTL_IMAGE_BUILD_ARGS := --build-arg=EKSCTL_BUILD_IMAGE=$(EKSCTL_BUILD_IMAGE)
ifneq ($(COVERALLS_TOKEN),)
EKSCTL_IMAGE_BUILD_ARGS += --build-arg=COVERALLS_TOKEN=$(COVERALLS_TOKEN)
endif

.PHONY: eksctl-image
eksctl-image: eksctl-build-image
@docker build --tag=$(EKSCTL_IMAGE) --build-arg=EKSCTL_BUILD_IMAGE=$(EKSCTL_BUILD_IMAGE) ./
@docker build --tag=$(EKSCTL_IMAGE) $(EKSCTL_IMAGE_BUILD_ARGS) ./

.PHONY: release
release: eksctl-build-image
docker run \
@docker run \
--env=GITHUB_TOKEN \
--env=CIRCLE_TAG \
--env=CIRCLE_PROJECT_USERNAME \
Expand Down
5 changes: 1 addition & 4 deletions build/Dockerfile
Expand Up @@ -22,12 +22,9 @@ RUN dep ensure

WORKDIR $EKSCTL_BUILD

RUN go install ./vendor/github.com/jteeuwen/go-bindata/go-bindata
RUN go install ./vendor/github.com/weaveworks/github-release
RUN go install ./vendor/golang.org/x/tools/cmd/stringer
RUN ./install.sh

WORKDIR $EKSCTL_BUILD/vendor/github.com/goreleaser/goreleaser
RUN make build && go install


WORKDIR $GOPATH
27 changes: 25 additions & 2 deletions build/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions build/Gopkg.toml
@@ -1,6 +1,8 @@
required = [
"github.com/goreleaser/goreleaser",
"github.com/jteeuwen/go-bindata/go-bindata",
"github.com/mattn/goveralls",
"github.com/vektra/mockery/cmd/mockery",
"github.com/weaveworks/github-release",
"golang.org/x/tools/cmd/stringer",
]
Expand Down
7 changes: 7 additions & 0 deletions build/install.sh
@@ -0,0 +1,7 @@
#!/bin/sh

go install ./vendor/github.com/jteeuwen/go-bindata/go-bindata
go install ./vendor/github.com/weaveworks/github-release
go install ./vendor/golang.org/x/tools/cmd/stringer
go install ./vendor/github.com/mattn/goveralls
go install ./vendor/github.com/vektra/mockery/cmd/mockery

0 comments on commit 8647f49

Please sign in to comment.