Skip to content

Commit f8fed80

Browse files
committed
feat(.travis.yml,Makefile): use go & glide from dev image
1 parent 5f192e1 commit f8fed80

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

.travis.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
language: go
2-
go:
3-
- 1.5.1
4-
env:
5-
- GO15VENDOREXPERIMENT=1
1+
language: generic
62
branches:
73
only:
84
- master
95
cache:
106
directories:
11-
- $GOPATH/src/github.com/deis/builder/vendor
7+
- vendor
128
services:
139
- docker
1410
sudo: required
15-
before_install:
16-
- wget "https://github.com/Masterminds/glide/releases/download/0.7.2/glide-0.7.2-linux-amd64.tar.gz"
17-
- sudo tar -vxz -C /usr/local/bin --strip=1 -f glide-0.7.2-linux-amd64.tar.gz
1811
install:
19-
- GLIDE_HOME=/home/travis/.glide make bootstrap
12+
- make bootstrap
2013
script:
2114
- make test
2215
deploy:

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ SHORT_NAME ?= builder
33
# Enable vendor/ directory support.
44
export GO15VENDOREXPERIMENT=1
55

6+
# dockerized development environment variables
7+
REPO_PATH := github.com/deis/${SHORT_NAME}
8+
DEV_ENV_IMAGE := quay.io/deis/go-dev:0.2.0
9+
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
10+
DEV_ENV_PREFIX := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
11+
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE}
12+
613
# SemVer with build information is defined in the SemVer 2 spec, but Docker
714
# doesn't allow +, so we use -.
815
VERSION ?= git-$(shell git rev-parse --short HEAD)
@@ -27,25 +34,25 @@ all:
2734
@echo "Use a Makefile to control top-level building of the project."
2835

2936
bootstrap:
30-
glide up
37+
${DEV_ENV_CMD} glide up
3138

3239
# This illustrates a two-stage Docker build. docker-compile runs inside of
3340
# the Docker environment. Other alternatives are cross-compiling, doing
3441
# the build as a `docker build`.
3542
build:
36-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/builder boot.go || exit 1
37-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/fetcher fetcher/fetcher.go || exit 1
43+
${DEV_ENV_PREFIX} -e CGO_ENABLED=0 ${DEV_ENV_IMAGE} go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/builder boot.go || exit 1
44+
${DEV_ENV_PREFIX} -e CGO_ENABLED=0 ${DEV_ENV_IMAGE} go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/fetcher fetcher/fetcher.go || exit 1
3845
@$(call check-static-binary,$(BINARY_DEST_DIR)/builder)
3946
@$(call check-static-binary,$(BINARY_DEST_DIR)/fetcher)
4047
for i in $(BINARIES); do \
41-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/$$i pkg/src/$$i.go || exit 1; \
48+
${DEV_ENV_PREFIX} -e CGO_ENABLED=0 ${DEV_ENV_IMAGE} go build -a -installsuffix cgo -ldflags '-s' -o $(BINARY_DEST_DIR)/$$i pkg/src/$$i.go || exit 1; \
4249
done
4350
@for i in $(BINARIES); do \
4451
$(call check-static-binary,$(BINARY_DEST_DIR)/$$i); \
4552
done
4653

4754
test:
48-
go test ./pkg && go test ./pkg/confd && go test ./pkg/env && go test ./pkg/etcd && go test ./pkg/git && go test ./pkg/sshd
55+
${DEV_ENV_CMD} go test ./pkg && go test ./pkg/confd && go test ./pkg/env && go test ./pkg/etcd && go test ./pkg/git && go test ./pkg/sshd
4956

5057
docker-build:
5158
docker build --rm -t ${IMAGE} rootfs

0 commit comments

Comments
 (0)