Skip to content

Commit 5880469

Browse files
committed
Merge pull request #253 from moul/fix-travis
Fix Travis builds
2 parents d01bf53 + 35b0d07 commit 5880469

File tree

1,106 files changed

+233345
-54236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,106 files changed

+233345
-54236
lines changed

.travis.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,36 @@ env:
1111

1212
matrix:
1313
include:
14-
- go: 1.5 TEST_WITH_REAL_API=1
15-
- go: tip
14+
- go: 1.5
15+
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
16+
- go: 1.5.1
17+
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
18+
- go: 1.5.2
19+
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=1
20+
- go: tip
21+
env: GO15VENDOREXPERIMENT=1 TEST_WITH_REAL_API=0
1622
allow_failures:
17-
- go: tip
23+
- go: tip
1824

1925

2026
before_install:
2127
- go get golang.org/x/tools/cmd/vet
2228
- go get -u github.com/axw/gocov/gocov
2329
- go get -u github.com/mattn/goveralls
2430
- go get golang.org/x/tools/cmd/cover
25-
- go get github.com/moul/anonuuid/cmd/anonuuid
31+
- GO15VENDOREXPERIMENT=1 go get github.com/moul/anonuuid/cmd/anonuuid
2632

2733

2834
script:
2935
- env | anonuuid
36+
- rm -rf Godeps/_workspace # Remove automatic 'godep restore' from travis...
3037
- make build show_version
31-
- if [ -z "${TEST_WITH_REAL_API}" -o -z "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make test; fi
32-
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_login; fi
33-
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup || true; fi
34-
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make cover; fi
35-
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_coveralls; fi
36-
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi
38+
- if [ "${TEST_WITH_REAL_API}" != "1" -o -z "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make test; fi
39+
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_login; fi
40+
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup || true; fi
41+
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make cover; fi
42+
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_coveralls; fi
43+
- if [ "${TEST_WITH_REAL_API}" = "1" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi
3744

3845
after_success:
3946
- if [ "${TEST_WITH_REAL_API}" -a "${TRAVIS_SCALEWAY_ORGANIZATION}" ]; then make travis_cleanup; fi

Godeps/Godeps.json

Lines changed: 152 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Godeps/Readme

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Go parameters
2-
GOCMD ?= go
3-
GOBUILD ?= $(GOCMD) build
4-
GOCLEAN ?= $(GOCMD) clean
5-
GOINSTALL ?= $(GOCMD) install
6-
GOTEST ?= $(GOCMD) test
2+
GOENV ?= GO15VENDOREXPERIMENT=1
3+
GO ?= $(GOENV) go
4+
GODEP ?= $(GOENV) godep
5+
GOBUILD ?= $(GO) build
6+
GOCLEAN ?= $(GO) clean
7+
GOINSTALL ?= $(GO) install
8+
GOTEST ?= $(GO) test
79
GOFMT ?= gofmt -w
10+
GODIR ?= github.com/scaleway/scaleway-cli
811
GOCOVER ?= $(GOTEST) -covermode=count -v
9-
1012
FPM_VERSION ?= $(shell ./dist/scw-Darwin-i386 --version | sed 's/.*v\([0-9.]*\),.*/\1/g')
1113
FPM_DOCKER ?= \
1214
-it --rm \
@@ -23,16 +25,19 @@ FPM_ARGS ?= \
2325
-m "Scaleway <[email protected]>"
2426

2527

26-
NAME = scw
27-
SRC = cmd/scw
28-
PACKAGES = pkg/api pkg/commands pkg/utils pkg/cli pkg/sshcommand pkg/config pkg/scwversion pkg/pricing
29-
VERSION = $(shell cat .goxc.json | grep "PackageVersion" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
30-
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")
31-
TAG = $(shell git describe --tags --always || echo $(VERSION) || echo "nogit")
28+
NAME = scw
29+
30+
SOURCES := $(shell find . -type f -name "*.go")
31+
COMMANDS := $(shell go list ./... | grep -v /vendor/ | grep /cmd/)
32+
PACKAGES := $(shell go list ./... | grep -v /vendor/ | grep -v /cmd/)
33+
REL_COMMANDS := $(subst $(GODIR),./,$(COMMANDS))
34+
REL_PACKAGES := $(subst $(GODIR),./,$(PACKAGES))
35+
VERSION = $(shell cat .goxc.json | grep "PackageVersion" | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
36+
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")
37+
TAG = $(shell git describe --tags --always || echo $(VERSION) || echo "nogit")
3238
LDFLAGS = "-X github.com/scaleway/scaleway-cli/pkg/scwversion.GITCOMMIT=$(REV) \
3339
-X github.com/scaleway/scaleway-cli/pkg/scwversion.VERSION=$(TAG)"
34-
BUILDER = scaleway-cli-builder
35-
ALL_GO_FILES = $(shell find . -type f -name "*.go")
40+
BUILDER = scaleway-cli-builder
3641

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

45-
BUILD_LIST = $(foreach int, $(SRC), $(int)_build)
46-
CLEAN_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_clean)
47-
INSTALL_LIST = $(foreach int, $(SRC), $(int)_install)
48-
IREF_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_iref)
49-
TEST_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_test)
50-
FMT_LIST = $(foreach int, $(SRC) $(PACKAGES), $(int)_fmt)
51-
COVERPROFILE_LIST = $(foreach int, $(PACKAGES), $(int)/profile.out)
50+
BUILD_LIST = $(foreach int, $(COMMANDS), $(int)_build)
51+
CLEAN_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_clean)
52+
INSTALL_LIST = $(foreach int, $(COMMANDS), $(int)_install)
53+
IREF_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_iref)
54+
TEST_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_test)
55+
FMT_LIST = $(foreach int, $(COMMANDS) $(PACKAGES), $(int)_fmt)
56+
COVERPROFILE_LIST = $(foreach int, $(PACKAGES), $(int)/profile.out)
5257

5358

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

6974

7075
$(BUILD_LIST): %_build: %_fmt %_iref
71-
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) ./$*
72-
go tool vet -all=true $(PACKAGES) $(SRC)
76+
$(GOBUILD) -ldflags $(LDFLAGS) -o $(NAME) $(subst $(GODIR),./,$*)
77+
for file in $(shell find $(REL_COMMANDS) $(REL_PACKAGES) -depth 1 -name "*.go"); do $(GO) tool vet -all=true $$file; done
7378
$(CLEAN_LIST): %_clean:
74-
$(GOCLEAN) ./$*
79+
$(GOCLEAN) $(subst $(GODIR),./,$*)
7580
$(INSTALL_LIST): %_install:
76-
$(GOINSTALL) ./$*
81+
$(GOINSTALL) $(subst $(GODIR),./,$*)
7782
$(IREF_LIST): %_iref:
78-
$(GOTEST) -ldflags $(LDFLAGS) -i ./$*
83+
$(GOTEST) -ldflags $(LDFLAGS) -i $(subst $(GODIR),./,$*)
7984
$(TEST_LIST): %_test:
80-
$(GOTEST) -ldflags $(LDFLAGS) -v ./$*
85+
$(GOTEST) -ldflags $(LDFLAGS) -v $(subst $(GODIR),./,$*)
8186
$(FMT_LIST): %_fmt:
82-
$(GOFMT) ./$*
87+
$(GOFMT) $(subst $(GODIR),./,$*)
8388

8489

8590

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

138+
139+
.PHONY: golint
133140
golint:
134-
@go get github.com/golang/lint/golint
135-
@for dir in $(shell go list ./... | grep -v /vendor/); do golint $$dir; done
141+
@$(GO) get github.com/golang/lint/golint
142+
@for dir in $(shell $(GO) list ./... | grep -v /vendor/); do golint $$dir; done
136143

137144

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

142150

143-
party:
144-
party -c -d=vendor
151+
.PHONY: godep-save
152+
godep-save:
153+
$(GODEP) save $(PACKAGES) $(COMMANDS)
145154

146155

147156
.PHONY: convey
@@ -163,7 +172,7 @@ travis_login:
163172
.PHONY: cover
164173
cover: profile.out
165174

166-
$(COVERPROFILE_LIST): $(ALL_GO_FILES)
175+
$(COVERPROFILE_LIST): $(SOURCES)
167176
rm -f $@
168177
$(GOCOVER) -ldflags $(LDFLAGS) -coverpkg=./pkg/... -coverprofile=$@ ./$(dir $@)
169178

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address'
11531153
### master (unreleased)
11541154

11551155
* Use rfc4716 (openSSH) to generate the fingerprints ([#151](https://github.com/scaleway/scaleway-cli/issues/151))
1156+
* Switch from `Party` to `Godep`
11561157
* create-image-from-http.sh: Support HTTP proxy ([#249](https://github.com/scaleway/scaleway-cli/issues/249))
11571158
* Support of `scw run --userdata=...` ([#202](https://github.com/scaleway/scaleway-cli/issues/202))
11581159
* Refactor of `scw _security-groups` ([#197](https://github.com/scaleway/scaleway-cli/issues/197))

cmd/scw/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ package main
1111
import (
1212
"os"
1313

14+
"github.com/Sirupsen/logrus"
1415
"github.com/scaleway/scaleway-cli/pkg/cli"
15-
"github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
1616
)
1717

1818
func main() {

pkg/api/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
"text/template"
2525
"time"
2626

27-
log "github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
28-
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/anonuuid"
29-
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/http2curl"
27+
log "github.com/Sirupsen/logrus"
28+
"github.com/moul/anonuuid"
29+
"github.com/moul/http2curl"
3030
)
3131

3232
// Default values

pkg/api/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package api
33
import (
44
"testing"
55

6-
. "github.com/scaleway/scaleway-cli/vendor/github.com/smartystreets/goconvey/convey"
6+
. "github.com/smartystreets/goconvey/convey"
77
)
88

99
func TestNewScalewayAPI(t *testing.T) {

pkg/api/cache.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"strings"
1515
"sync"
1616

17-
"github.com/scaleway/scaleway-cli/vendor/github.com/Sirupsen/logrus"
18-
"github.com/scaleway/scaleway-cli/vendor/github.com/moul/anonuuid"
19-
"github.com/scaleway/scaleway-cli/vendor/github.com/renstrom/fuzzysearch/fuzzy"
17+
"github.com/Sirupsen/logrus"
18+
"github.com/moul/anonuuid"
19+
"github.com/renstrom/fuzzysearch/fuzzy"
2020
)
2121

2222
// ScalewayCache is used not to query the API to resolve full identifiers

0 commit comments

Comments
 (0)