Merge pull request #43 from dlorenc/make
Add a Makefile to replace build.sh and test.sh.pull/45/head
commit
f0ad262636
|
@ -7,4 +7,4 @@ install:
|
||||||
- echo "Don't run anything."
|
- echo "Don't run anything."
|
||||||
|
|
||||||
# Run unit tests and linters.
|
# Run unit tests and linters.
|
||||||
script: ./test.sh
|
script: make test
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
GOOS ?= $(shell go env GOOS)
|
||||||
|
GOARCH ?= $(shell go env GOARCH)
|
||||||
|
BUILD_DIR ?= ./out
|
||||||
|
GOPATH := $(shell pwd)/.gopath
|
||||||
|
REPOPATH ?= k8s.io/minikube
|
||||||
|
GO15VENDOREXPERIMENT := 1
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(GOPATH)
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
gopath: clean
|
||||||
|
rm -rf $(GOPATH)
|
||||||
|
mkdir -p $(shell dirname $(GOPATH)/src/$(REPOPATH))
|
||||||
|
ln -s $(shell pwd) $(GOPATH)/src/$(REPOPATH)
|
||||||
|
|
||||||
|
.PHONY: minikube
|
||||||
|
minikube: minikube-$(GOOS)-$(GOARCH)
|
||||||
|
cp $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/minikube
|
||||||
|
|
||||||
|
.PHONY: localkube
|
||||||
|
localkube: localkube-$(GOOS)-$(GOARCH)
|
||||||
|
cp $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) $(BUILD_DIR)/localkube
|
||||||
|
|
||||||
|
minikube-$(GOOS)-$(GOARCH): gopath
|
||||||
|
GOPATH=$(GOPATH) CGO_ENABLED=0 GOARCH=$(GOARCH) GOOS=$(GOOS) go build --installsuffix cgo -a -o $(BUILD_DIR)/minikube-$(GOOS)-$(GOARCH) ./cmd/minikube
|
||||||
|
|
||||||
|
localkube-$(GOOS)-$(GOARCH): gopath
|
||||||
|
GOARCH=$(GOARCH) GOOS=$(GOOS) CGO_ENABLED=1 go build -o $(BUILD_DIR)/localkube-$(GOOS)-$(GOARCH) -i ./cmd/localkube
|
||||||
|
|
||||||
|
.PHONY: integration
|
||||||
|
integration: minikube
|
||||||
|
go test -v ./integration --tags=integration
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: gopath
|
||||||
|
./test.sh
|
|
@ -35,7 +35,7 @@ For more information about minikube, see the [proposal](https://github.com/kuber
|
||||||
## Build Instructions
|
## Build Instructions
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
./build.sh
|
make minikube
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run Instructions
|
## Run Instructions
|
||||||
|
@ -72,7 +72,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for an overview of how to send pull reque
|
||||||
Unit tests are run on Travis before code is merged. To run as part of a development cycle:
|
Unit tests are run on Travis before code is merged. To run as part of a development cycle:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
./test.sh
|
make test
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Integration Tests
|
#### Integration Tests
|
||||||
|
@ -81,6 +81,5 @@ Integration tests are currently run manually.
|
||||||
To run them, build the binary and run the tests:
|
To run them, build the binary and run the tests:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
./build.sh
|
make integration
|
||||||
go test ./integration --tags=integration
|
|
||||||
```
|
```
|
||||||
|
|
33
build.sh
33
build.sh
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
cd "$( dirname "${BASH_SOURCE[0]}" )"
|
|
||||||
|
|
||||||
REPO_PATH="k8s.io/minikube"
|
|
||||||
BUILD_DIR="${PWD}/out"
|
|
||||||
|
|
||||||
export GOPATH=${PWD}/.gopath
|
|
||||||
export GO15VENDOREXPERIMENT=1
|
|
||||||
export OS=${OS:-$(go env GOOS)}
|
|
||||||
export ARCH=${ARCH:-$(go env GOARCH)}
|
|
||||||
|
|
||||||
rm -f ${GOPATH}/src/${REPO_PATH}
|
|
||||||
mkdir -p $(dirname ${GOPATH}/src/${REPO_PATH})
|
|
||||||
ln -s ${PWD} $GOPATH/src/${REPO_PATH}
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOARCH=${ARCH} GOOS=${OS} go build --installsuffix cgo -a -o ${BUILD_DIR}/minikube k8s.io/minikube/cmd/minikube
|
|
||||||
|
|
||||||
# Build minimal localkube binary
|
|
||||||
GOARCH=${ARCH} GOOS=${OS} go build -o ${BUILD_DIR}/localkube -i --ldflags '-extldflags "-static" --s -w' k8s.io/minikube/cmd/localkube
|
|
9
test.sh
9
test.sh
|
@ -13,13 +13,12 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# First, build the binary
|
REPO_PATH="k8s.io/minikube"
|
||||||
source ./build.sh
|
|
||||||
|
|
||||||
# Then run all test files
|
# Run all test files.
|
||||||
for TEST in $(find -name "*.go" | grep -v vendor | grep -v integration | grep _test.go | cut -d/ -f2- | sed 's|/\w*.go||g' | uniq); do
|
for TEST in $(find -name "*.go" | grep -v vendor | grep -v integration | grep _test.go | cut -d/ -f2- | sed 's|/\w*.go||g' | uniq); do
|
||||||
echo $TEST
|
echo $TEST
|
||||||
go test -v ${REPO_PATH}/${TEST}
|
go test -v ${REPO_PATH}/${TEST}
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check gofmt
|
# Check gofmt
|
||||||
|
|
Loading…
Reference in New Issue