Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
27 changes: 17 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,36 @@ env:

matrix:
include:
- go: 1.5 TEST_WITH_REAL_API=1
- go: tip
- go: 1.5
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
- go: 1.5.1
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
- go: 1.5.2
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=1
- go: tip
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
allow_failures:
- go: tip
- go: tip


before_install:
- go get golang.org/x/tools/cmd/vet
- go get -u github.com/axw/gocov/gocov
- go get -u github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get github.com/moul/anonuuid/cmd/anonuuid
- GO15VENDOREXPERIMENT=1 go get github.com/moul/anonuuid/cmd/anonuuid


script:
- env | anonuuid
- rm -rf Godeps/_workspace # Remove automatic 'godep restore' from travis...
- make build show_version
- if [ -z "${TEST_WITH_REAL_API}" -o -z "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make test; fi
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_login; fi
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup || true; fi
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make cover; fi
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_coveralls; fi
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi
- if [ "${TEST_WITH_REAL_API}" != "1" -o -z "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make test; fi
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_login; fi
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup || true; fi
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make cover; fi
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_coveralls; fi
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi

after_success:
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi
Expand Down
152 changes: 152 additions & 0 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Godeps/Readme

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 42 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Go parameters
GOCMD ?= go
GOBUILD ?= $(GOCMD) build
GOCLEAN ?= $(GOCMD) clean
GOINSTALL ?= $(GOCMD) install
GOTEST ?= $(GOCMD) test
GOENV ?= GO15VENDOREXPERIMENT=1
GO ?= $(GOENV) go
GODEP ?= $(GOENV) godep
GOBUILD ?= $(GO) build
GOCLEAN ?= $(GO) clean
GOINSTALL ?= $(GO) install
GOTEST ?= $(GO) test
GOFMT ?= gofmt -w
GODIR ?= github.com/scaleway/scaleway-cli
GOCOVER ?= $(GOTEST) -covermode=count -v

FPM_VERSION ?= $(shell ./dist/scw-Darwin-i386 --version | sed 's/.*v\([0-9.]*\),.*/\1/g')
FPM_DOCKER ?= \
-it --rm \
Expand All @@ -23,16 +25,19 @@ FPM_ARGS ?= \
-m "Scaleway <opensource@scaleway.com>"


NAME = scw
SRC = cmd/scw
PACKAGES = pkg/api pkg/commands pkg/utils pkg/cli pkg/sshcommand pkg/config pkg/scwversion pkg/pricing
VERSION = $(shell cat .goxc.json | grep "PackageVersion" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
REV = $(shell git rev-parse HEAD || git ls-remote https://github.com/scaleway/scaleway-cli | grep -F $(VERSION) | head -n1 | awk '{print $$1}' || echo "nogit")
TAG = $(shell git describe --tags --always || echo $(VERSION) || echo "nogit")
NAME = scw

SOURCES := $(shell find . -type f -name "*.go")
COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/)
PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/)
REL_COMMANDS := $(subst $(GODIR),./,$(COMMANDS))
REL_PACKAGES := $(subst $(GODIR),./,$(PACKAGES))
VERSION = $(shell cat .goxc.json | grep "PackageVersion" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
REV = $(shell git rev-parse HEAD || git ls-remote https://github.com/scaleway/scaleway-cli | grep -F $(VERSION) | head -n1 | awk '{print $$1}' || echo "nogit")
TAG = $(shell git describe --tags --always || echo $(VERSION) || echo "nogit")
LDFLAGS = "-X github.com/scaleway/scaleway-cli/pkg/scwversion.GITCOMMIT=$(REV) \
-X github.com/scaleway/scaleway-cli/pkg/scwversion.VERSION=$(TAG)"
BUILDER = scaleway-cli-builder
ALL_GO_FILES = $(shell find . -type f -name "*.go")
BUILDER = scaleway-cli-builder

# Check go version
GOVERSIONMAJOR = $(shell go version | grep -o '[1-9].[0-9]' | cut -d '.' -f1)
Expand All @@ -42,13 +47,13 @@ ifneq ($(VERSION_GE_1_5),true)
$(error Bad go version, please install a version greater than or equal to 1.5)
endif

BUILD_LIST = $(foreach int, $(SRC), $(int)_build)
CLEAN_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_clean)
INSTALL_LIST = $(foreach int, $(SRC), $(int)_install)
IREF_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_iref)
TEST_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_test)
FMT_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_fmt)
COVERPROFILE_LIST = $(foreach int, $(PACKAGES), $(int)/profile.out)
BUILD_LIST = $(foreach int, $(COMMANDS), $(int)_build)
CLEAN_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_clean)
INSTALL_LIST = $(foreach int, $(COMMANDS), $(int)_install)
IREF_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_iref)
TEST_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_test)
FMT_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_fmt)
COVERPROFILE_LIST = $(foreach int, $(PACKAGES), $(int)/profile.out)


.PHONY: $(CLEAN_LIST) $(TEST_LIST) $(FMT_LIST) $(INSTALL_LIST) $(BUILD_LIST) $(IREF_LIST)
Expand All @@ -68,18 +73,18 @@ fmt: $(FMT_LIST)


$(BUILD_LIST): %_build: %_fmt %_iref
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) ./$*
go tool vet -all=true $(PACKAGES) $(SRC)
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) $(subst $(GODIR),./,$*)
for file in $(shell find $(REL_COMMANDS) $(REL_PACKAGES) -depth 1 -name "*.go"); do $(GO) tool vet -all=true $$file; done
$(CLEAN_LIST): %_clean:
$(GOCLEAN) ./$*
$(GOCLEAN) $(subst $(GODIR),./,$*)
$(INSTALL_LIST): %_install:
$(GOINSTALL) ./$*
$(GOINSTALL) $(subst $(GODIR),./,$*)
$(IREF_LIST): %_iref:
$(GOTEST) -ldflags $(LDFLAGS) -i ./$*
$(GOTEST) -ldflags $(LDFLAGS) -i $(subst $(GODIR),./,$*)
$(TEST_LIST): %_test:
$(GOTEST) -ldflags $(LDFLAGS) -v ./$*
$(GOTEST) -ldflags $(LDFLAGS) -v $(subst $(GODIR),./,$*)
$(FMT_LIST): %_fmt:
$(GOFMT) ./$*
$(GOFMT) $(subst $(GODIR),./,$*)



Expand Down Expand Up @@ -130,18 +135,22 @@ packages:
#publish_packages:
# docker run -v $(PWD)/dist moul/dput ppa:moul/scw dist/scw_$(FPM_VERSION)_arm.changes


.PHONY: golint
golint:
@go get github.com/golang/lint/golint
@for dir in $(shell go list ./... | grep -v /vendor/); do golint $$dir; done
@$(GO) get github.com/golang/lint/golint
@for dir in $(shell $(GO) list ./... | grep -v /vendor/); do golint $$dir; done


.PHONY: gocyclo
gocyclo:
go get github.com/fzipp/gocyclo
gocyclo -over 15 $(shell find . -name "*.go" -not -name "*test.go" | grep -v /vendor/)


party:
party -c -d=vendor
.PHONY: godep-save
godep-save:
$(GODEP) save $(PACKAGES) $(COMMANDS)


.PHONY: convey
Expand All @@ -163,7 +172,7 @@ travis_login:
.PHONY: cover
cover: profile.out

$(COVERPROFILE_LIST): $(ALL_GO_FILES)
$(COVERPROFILE_LIST): $(SOURCES)
rm -f $@
$(GOCOVER) -ldflags $(LDFLAGS) -coverpkg=./pkg/... -coverprofile=$@ ./$(dir $@)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address'
### master (unreleased)

* Use rfc4716 (openSSH) to generate the fingerprints ([#151](https://github.com/scaleway/scaleway-cli/issues/151))
* Switch from `Party` to `Godep`
* create-image-from-http.sh: Support HTTP proxy ([#249](https://github.com/scaleway/scaleway-cli/issues/249))
* Support of `scw run --userdata=...` ([#202](https://github.com/scaleway/scaleway-cli/issues/202))
* Refactor of `scw _security-groups` ([#197](https://github.com/scaleway/scaleway-cli/issues/197))
Expand Down
2 changes: 1 addition & 1 deletion cmd/scw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ package main
import (
"os"

"github.com/Sirupsen/logrus"
"github.com/scaleway/scaleway-cli/pkg/cli"
"github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
)

func main() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"text/template"
"time"

log "github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/anonuuid"
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/http2curl"
log "github.com/Sirupsen/logrus"
"github.com/moul/anonuuid"
"github.com/moul/http2curl"
)

// Default values
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package api
import (
"testing"

. "github.com/scaleway/scaleway-cli/vendor/github.com/smartystreets/goconvey/convey"
. "github.com/smartystreets/goconvey/convey"
)

func TestNewScalewayAPI(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"strings"
"sync"

"github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/anonuuid"
"github.com/scaleway/scaleway-cli/vendor/github.com/renstrom/fuzzysearch/fuzzy"
"github.com/Sirupsen/logrus"
"github.com/moul/anonuuid"
"github.com/renstrom/fuzzysearch/fuzzy"
)

// ScalewayCache is used not to query the API to resolve full identifiers
Expand Down
Loading