1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Migration from CircleCI1.0 to CircleCI2.0

This commit will allow us to use newer version of CircleCI.

Signed-off-by: selansen <elango.siva@docker.com>
This commit is contained in:
selansen 2018-05-29 16:53:19 -04:00 committed by Flavio Crisciani
parent c19cc28bd8
commit fbf02c3794
6 changed files with 115 additions and 66 deletions

View file

@ -0,0 +1,73 @@
version: 2
defaults: &defaults
working_directory: ~/go/src/github.com/docker/libnetwork
docker:
- image: 'circleci/golang:1.10'
environment:
Dockerfile: Dockerfile.ci
dockerargs: --privileged -e CIRCLECI
jobs:
builder:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run: make builder
build:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run: make build
lint:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run: make check-lint
cross:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run: make cross
unit-tests:
<<: *defaults
steps:
- checkout
- setup_remote_docker:
reusable: true
exclusive: false
- run: make unit-tests
workflows:
version: 2
ci:
jobs:
- builder
- build:
requires:
- builder
- lint:
requires:
- builder
- cross:
requires:
- builder
- unit-tests:
requires:
- builder

View file

@ -1 +0,0 @@
*

View file

@ -1,10 +1,11 @@
FROM golang:1.10
RUN apt-get update && apt-get -y install iptables
RUN go get github.com/tools/godep \
github.com/golang/lint/golint \
RUN go get github.com/golang/lint/golint \
golang.org/x/tools/cmd/cover \
github.com/mattn/goveralls \
github.com/gordonklaus/ineffassign \
github.com/client9/misspell/cmd/misspell \
honnef.co/go/tools/cmd/gosimple
WORKDIR /go/src/github.com/docker/libnetwork

13
libnetwork/Dockerfile.ci Normal file
View file

@ -0,0 +1,13 @@
FROM golang:1.10
RUN apt-get update && apt-get -y install iptables
RUN go get github.com/golang/lint/golint \
golang.org/x/tools/cmd/cover \
github.com/mattn/goveralls \
github.com/gordonklaus/ineffassign \
github.com/client9/misspell/cmd/misspell \
honnef.co/go/tools/cmd/gosimple
WORKDIR /go/src/github.com/docker/libnetwork
COPY . .

View file

@ -1,27 +1,24 @@
.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-code check-format run-tests integration-tests check-local coveralls circle-ci-cross circle-ci-build circle-ci-check circle-ci
.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-code check-format unit-tests check-local
SHELL=/bin/bash
Dockerfile ?= Dockerfile.build
dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
build_image=libnetworkbuild
dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork
container_env = -e "INSIDECONTAINER=-incontainer=true"
docker = docker run --rm -it ${dockerargs} $$EXTRA_ARGS ${container_env} ${build_image}
ciargs = -e CIRCLECI -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN" -e "INSIDECONTAINER=-incontainer=true"
cidocker = docker run ${dockerargs} ${ciargs} $$EXTRA_ARGS ${container_env} ${build_image}
CROSS_PLATFORMS = linux/amd64 linux/386 linux/arm windows/amd64
PACKAGES=$(shell go list ./... | grep -v /vendor/)
export PATH := $(CURDIR)/bin:$(PATH)
all: ${build_image}.created build check integration-tests clean
all: ${build_image}.created build check clean
all-local: build-local check-local integration-tests-local clean
all-local: build-local check-local clean
${build_image}.created:
builder:
docker build -f ${Dockerfile} -t ${build_image} .
build: builder
@echo "🐳 $@"
docker build -f Dockerfile.build -t ${build_image} .
touch ${build_image}.created
build: ${build_image}.created
@echo "🐳 $@"
@${docker} ./wrapmake.sh build-local
@${docker} make build-local
build-local:
@echo "🐳 $@"
@ -55,7 +52,7 @@ force-clean: clean
@echo "🐳 $@"
@rm -rf ${build_image}.created
cross: ${build_image}.created
cross: builder
@mkdir -p "bin"
@for platform in ${CROSS_PLATFORMS}; do \
EXTRA_ARGS="-e GOOS=$${platform%/*} -e GOARCH=$${platform##*/}" ; \
@ -68,21 +65,32 @@ cross-local:
go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
check: ${build_image}.created
@${docker} ./wrapmake.sh check-local
check: builder
@${docker} make check-local
check-lint: builder
@${docker} make check-local-lint
check-local-lint: check-format check-code
check-local: check-format check-code unit-tests-local
check-code: lint gosimple vet ineffassign
check-format: fmt misspell
run-tests:
unit-tests: builder
${docker} make unit-tests-local
unit-tests-local:
@echo "🐳 Running tests... "
@echo "mode: count" > coverage.coverprofile
@go build -o "bin/docker-proxy" ./cmd/proxy
@for dir in $$( find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -not -path './vendor/*' -type d); do \
if ls $$dir/*.go &> /dev/null; then \
pushd . &> /dev/null ; \
cd $$dir ; \
go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
go test ${INSIDECONTAINER} -test.v -test.parallel 5 -covermode=count -coverprofile=./profile.tmp ; \
ret=$$? ;\
if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
popd &> /dev/null; \
@ -94,17 +102,6 @@ run-tests:
done
@echo "Done running tests"
check-local: check-format check-code run-tests
integration-tests: ./bin/dnet
@./test/integration/dnet/run-integration-tests.sh
./bin/dnet:
make build
coveralls:
-@goveralls -service circleci -coverprofile=coverage.coverprofile -repotoken $$COVERALLS_TOKEN
# Depends on binaries because vet will silently fail if it can not load compiled imports
vet: ## run go vet
@echo "🐳 $@"
@ -131,23 +128,5 @@ gosimple: ## run gosimple
@echo "🐳 $@"
@test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
# CircleCI's Docker fails when cleaning up using the --rm flag
# The following targets are a workaround for this
circle-ci-cross: ${build_image}.created
@mkdir -p "bin"
@for platform in ${CROSS_PLATFORMS}; do \
EXTRA_ARGS="-e GOOS=$${platform%/*} -e GOARCH=$${platform##*/}" ; \
echo "$${platform}..." ; \
${cidocker} make cross-local ; \
done
circle-ci-check: ${build_image}.created
@${cidocker} make check-local coveralls
circle-ci-build: ${build_image}.created
@${cidocker} make build-local
circle-ci: circle-ci-build circle-ci-check circle-ci-cross integration-tests
shell: ${build_image}.created
@${docker} ${SHELL}

View file

@ -1,16 +0,0 @@
machine:
environment:
GODIST: "go1.7.1.linux-amd64.tar.gz"
services:
- docker
dependencies:
override:
- sudo apt-get update; sudo apt-get install -y iptables zookeeperd
- go get golang.org/x/tools/cmd/goimports
test:
override:
- make circle-ci
post:
- bash <(curl -s https://codecov.io/bash) -C "$(git log --format="%H" -n 1)"