Skip to content

Commit e8aac89

Browse files
ismael_serranoisserrano
authored andcommitted
Add build in container option to Makefile
Travis will build without container
1 parent 2c10cbe commit e8aac89

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ services:
44
- docker
55
go:
66
- "1.10"
7+
script:
8+
- echo "Nginx ASG sync - commit:${TRAVIS_COMMIT}"
9+
- make BUILD_IN_CONTAINER=0 all
710
before_install:
811
- echo "PR Slug:${TRAVIS_PULL_REQUEST_SLUG}"
912
- if [[ "${TRAVIS_PULL_REQUEST_SLUG}" == "nginxinc/nginx-asg-sync" || "${TRAVIS_PULL_REQUEST}" == "false" ]]; then

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
GO_DOCKER_RUN = docker run --rm -v $(shell pwd):/go/src/github.com/nginxinc/nginx-asg-sync -v $(shell pwd)/build_output:/build_output -w /go/src/github.com/nginxinc/nginx-asg-sync/cmd/sync
22
GOLANG_CONTAINER = golang:1.10
3+
BUILD_IN_CONTAINER = 1
34

45
all: amazon centos7 ubuntu-trusty ubuntu-xenial
56

67
test:
8+
ifeq ($(BUILD_IN_CONTAINER),1)
79
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go test
10+
else
11+
go test ./...
12+
endif
813

914
compile: test
15+
ifeq ($(BUILD_IN_CONTAINER),1)
1016
$(GO_DOCKER_RUN) $(GOLANG_CONTAINER) go build -o /build_output/nginx-asg-sync
17+
else
18+
go build -o ./build_output/nginx-asg-sync github.com/nginxinc/nginx-asg-sync/cmd/sync
19+
endif
1120

1221
amazon: compile
1322
make -C build/package/builders/amazon/

0 commit comments

Comments
 (0)