This repository has been archived by the owner on Sep 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rehauled build system and integration testing
- USE_CONTAINER allow to seamlessly run targets inside or outside containers - all build calls have been harmonized, honoring the same env variables - contributing doc has been streamlined according to that - kill the distinction between remote and local docker builds - got rid of some of the byzantine calls in various asorted scripts - support for static build, debug builds, verbose Signed-off-by: Olivier Gambier <olivier@docker.com>
- Loading branch information
Olivier Gambier
authored and
Olivier Gambier
committed
Sep 18, 2015
1 parent
0aca429
commit 5fbfbe1
Showing
35 changed files
with
754 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
docker-machine* | ||
.git | ||
*.log | ||
bin | ||
cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ docker-machine* | |
*.log | ||
*.iml | ||
.idea/ | ||
bin | ||
cover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
language: go | ||
sudo: false | ||
go: | ||
- 1.4.2 | ||
- 1.5 | ||
install: | ||
- export GOPATH=${TRAVIS_BUILD_DIR}/Godeps/_workspace:$GOPATH | ||
- export PATH=${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH | ||
- go get -t -v ./... | ||
- go get golang.org/x/tools/cmd/cover | ||
- go get github.com/mattn/goveralls | ||
script: | ||
- script/validate-dco | ||
- script/validate-gofmt | ||
- go test -v -short ./... | ||
- script/generate-coverage report | ||
- make dco | ||
- make fmt | ||
# - make lint | ||
# - make vet | ||
- make test-short | ||
- make test-long | ||
- make coverage-send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
FROM golang:1.5 | ||
|
||
# TODO: Vendor these `go get` commands using Godep. | ||
RUN go get github.com/mitchellh/gox | ||
RUN go get github.com/aktau/github-release | ||
RUN go get github.com/tools/godep | ||
RUN go get golang.org/x/tools/cmd/cover | ||
|
||
ENV GOPATH /go/src/github.com/docker/machine/Godeps/_workspace:/go | ||
ENV MACHINE_BINARY /go/src/github.com/docker/machine/docker-machine | ||
ENV USER root | ||
RUN go get github.com/mitchellh/gox \ | ||
github.com/golang/lint/golint \ | ||
github.com/mattn/goveralls \ | ||
golang.org/x/tools/cover \ | ||
github.com/aktau/github-release | ||
|
||
WORKDIR /go/src/github.com/docker/machine | ||
|
||
ADD . /go/src/github.com/docker/machine | ||
ADD . /go/src/github.com/docker/machine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
.PHONY: test validate-dco validate-gofmt | ||
|
||
default: build | ||
|
||
remote: build-remote | ||
|
||
test: | ||
script/test | ||
|
||
validate-dco: | ||
script/validate-dco | ||
|
||
validate-gofmt: | ||
script/validate-gofmt | ||
|
||
validate: validate-dco validate-gofmt test | ||
|
||
build: clean | ||
script/build | ||
|
||
build-remote: clean | ||
script/build-remote | ||
|
||
clean: | ||
rm -f docker-machine_* | ||
rm -rf Godeps/_workspace/pkg | ||
# Plain make targets if not requested inside a container | ||
ifeq ($(USE_CONTAINER),) | ||
include Makefile.inc | ||
include mk/main.mk | ||
else | ||
# Otherwise, with docker, swallow all targets and forward into a container | ||
DOCKER_IMAGE_NAME := "docker-machine-build" | ||
DOCKER_CONTAINER_NAME := "docker-machine-build-container" | ||
|
||
%: | ||
@docker build -t $(DOCKER_IMAGE_NAME) . | ||
|
||
@test -z '$(shell docker ps -a | grep $(DOCKER_CONTAINER_NAME))' || docker rm -f $(DOCKER_CONTAINER_NAME) | ||
|
||
@docker run --name $(DOCKER_CONTAINER_NAME) \ | ||
-e DEBUG \ | ||
-e STATIC \ | ||
-e VERBOSE \ | ||
-e BUILDTAGS \ | ||
-e PARALLEL \ | ||
-e COVERAGE_DIR \ | ||
-e TARGET_OS \ | ||
-e TARGET_ARCH \ | ||
-e PREFIX \ | ||
$(DOCKER_IMAGE_NAME) \ | ||
make $@ | ||
|
||
@test ! -d bin || rm -Rf bin | ||
@test -z "$(findstring build,$@)" || docker cp $(DOCKER_CONTAINER_NAME):/go/src/github.com/docker/machine/bin bin | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Project name, used to name the binaries | ||
PKG_NAME := docker-machine | ||
GH_USER ?= docker | ||
GH_REPO ?= machine | ||
|
||
# If true, disable optimizations and does NOT strip the binary | ||
DEBUG ?= | ||
# If true, "build" will produce a static binary (cross compile always produce static build regardless) | ||
STATIC ?= | ||
# If true, turn on verbose output for build | ||
VERBOSE ?= | ||
# Build tags | ||
BUILDTAGS ?= | ||
# Adjust parallelism for gox | ||
PARALLEL ?= -1 | ||
# Coverage default directory | ||
COVERAGE_DIR ?= cover | ||
# Whether to perform targets inside a docker container, or natively on the host | ||
USE_CONTAINER ?= | ||
|
||
# List of cross compilation targets | ||
ifeq ($(TARGET_OS),) | ||
TARGET_OS := darwin freebsd linux windows | ||
endif | ||
|
||
ifeq ($(TARGET_ARCH),) | ||
TARGET_ARCH := amd64 arm 386 | ||
endif | ||
|
||
# Output prefix, defaults to local directory if not specified | ||
ifeq ($(PREFIX),) | ||
PREFIX := $(shell pwd) | ||
endif | ||
|
||
default: build | ||
clean: coverage-clean build-clean | ||
build: build-simple | ||
test: dco fmt test-short | ||
validate: dco fmt vet lint test-short test-long |
Oops, something went wrong.
5fbfbe1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason the
make remote
was left out? I use that as my primary build since i'm developing on my mac and don't want to garbage it up with packages.TIA
5fbfbe1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no longer a difference between building remote or local.
You should be able to just
USE_CONTAINER=1 make build
and it will build against your docker engine, no matter "where" it is.