Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.

Commit 60b8cc5

Browse files
committed
Merge branch 'develop'
2 parents fc5709a + 78600a8 commit 60b8cc5

Some content is hidden

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

51 files changed

+1283
-5842
lines changed

.gitlab-ci.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@ stages:
55
- package
66

77
variables:
8+
GO111MODULE: 'on'
89
CONTAINER_NAME: thethingsnetwork/ttn
910
PLATFORMS: linux-386 linux-amd64 linux-arm darwin-amd64 windows-386 windows-amd64
1011

1112
cache:
1213
key: "$CI_PROJECT_PATH"
1314
paths:
14-
- .govendor
15-
16-
before_script:
17-
- mkdir -p $(pwd)/.govendor
18-
- rm -rf $GOPATH
19-
- mkdir -p $GOPATH/.cache && ln -s $(pwd)/.govendor $GOPATH/.cache/govendor
20-
- mkdir -p $GOPATH/src/github.com/TheThingsNetwork && ln -s $(pwd) $GOPATH/src/github.com/TheThingsNetwork/ttn
15+
- /go/pkg/mod
2116

2217
tests:
2318
stage: test
24-
image: golang:1.11
19+
image: golang:1.12
2520
services:
2621
- thethingsnetwork/rabbitmq
2722
- redis
@@ -30,23 +25,19 @@ tests:
3025
MQTT_ADDRESS: thethingsnetwork__rabbitmq:1883
3126
AMQP_ADDRESS: thethingsnetwork__rabbitmq:5672
3227
script:
33-
- pushd $GOPATH/src/github.com/TheThingsNetwork/ttn
3428
- make deps
3529
- make test
36-
- popd
3730

3831
binaries:
3932
stage: build
40-
image: golang:1.11
33+
image: golang:1.12
4134
script:
4235
- mkdir release
4336
- export CI_BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
4437
- echo "date $CI_BUILD_DATE" >> release/info
4538
- echo "commit $CI_BUILD_REF" >> release/info
46-
- pushd $GOPATH/src/github.com/TheThingsNetwork/ttn
4739
- make deps
4840
- for platform in $PLATFORMS; do $(echo $platform | awk -F '-' '{print "export GOOS=" $1 " GOARCH=" $2}') && make build; done
49-
- popd
5041
artifacts:
5142
paths:
5243
- release/
@@ -57,7 +48,7 @@ sign:
5748
- master@thethingsnetwork/ttn
5849
- develop@thethingsnetwork/ttn
5950
stage: sign
60-
image: golang:1.11
51+
image: golang:1.12
6152
script:
6253
- pushd release
6354
- shasum -a 256 $(ls) > checksums

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@ services:
88
- docker
99

1010
go:
11-
- "1.11"
11+
- "1.12.x"
12+
13+
env:
14+
global:
15+
- GOPROXY=https://proxy.golang.org
16+
- GO111MODULE=on
17+
18+
cache:
19+
directories:
20+
- $HOME/gopath/pkg/mod
1221

1322
install:
1423
- make deps

Makefile

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ all: deps build
1919
# Deps
2020

2121
build-deps:
22-
@command -v govendor > /dev/null || go get "github.com/kardianos/govendor"
2322

24-
deps: build-deps
25-
govendor sync -v
23+
deps:
24+
go mod download
2625

2726
dev-deps: deps
2827
@command -v protoc-gen-grpc-gateway > /dev/null || go get github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
@@ -32,36 +31,6 @@ dev-deps: deps
3231
@command -v golint > /dev/null || go get golang.org/x/lint/golint
3332
@command -v forego > /dev/null || go get github.com/ddollar/forego
3433

35-
# Protobuf
36-
37-
PROTO_FILES = $(shell find api -name "*.proto" -and -not -name ".git")
38-
COMPILED_PROTO_FILES = $(patsubst api%.proto, api%.pb.go, $(PROTO_FILES))
39-
PROTOC_IMPORTS= -I/usr/local/include -I$(GO_PATH)/src -I$(PWD)/vendor -I$(PARENT_DIRECTORY) \
40-
-I$(GO_PATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis
41-
PROTOC = protoc $(PROTOC_IMPORTS) \
42-
--gogottn_out=plugins=grpc:$(GO_SRC) \
43-
--grpc-gateway_out=:$(GO_SRC) `pwd`/
44-
45-
protos-clean:
46-
rm -f $(COMPILED_PROTO_FILES)
47-
48-
protos: $(COMPILED_PROTO_FILES)
49-
50-
api/%.pb.go: api/%.proto
51-
$(PROTOC)$<
52-
53-
protodoc: $(PROTO_FILES)
54-
protoc $(PROTOC_IMPORTS) --ttndoc_out=logtostderr=true,.lorawan.DevAddrManager=all:$(GO_SRC) `pwd`/api/protocol/lorawan/device_address.proto
55-
protoc $(PROTOC_IMPORTS) --ttndoc_out=logtostderr=true,.handler.ApplicationManager=all:$(GO_SRC) `pwd`/api/handler/handler.proto
56-
protoc $(PROTOC_IMPORTS) --ttndoc_out=logtostderr=true,.discovery.Discovery=all:$(GO_SRC) `pwd`/api/discovery/discovery.proto
57-
58-
# Mocks
59-
60-
mocks:
61-
mockgen -source=./api/protocol/lorawan/device.pb.go -package lorawan DeviceManagerClient > api/protocol/lorawan/device_mock.go
62-
mockgen -source=./api/networkserver/networkserver.pb.go -package networkserver NetworkServerClient > api/networkserver/networkserver_mock.go
63-
mockgen -source=./api/discovery/client.go -package discovery Client > api/discovery/client_mock.go
64-
6534
dev-certs:
6635
ttn discovery gen-cert localhost 127.0.0.1 ::1 discovery --config ./.env/discovery/dev.yml
6736
ttn router gen-cert localhost 127.0.0.1 ::1 router --config ./.env/router/dev.yml
@@ -72,44 +41,39 @@ dev-certs:
7241
# Go Test
7342

7443
GO_FILES = $(shell find . -name "*.go" | grep -vE ".git|.env|vendor|.pb.go|_mock.go")
75-
GO_PACKAGES = $(shell find . -name "*.go" | grep -vE ".git|.env|vendor" | sed 's:/[^/]*$$::' | sort | uniq)
76-
GO_TEST_PACKAGES = $(shell find . -name "*_test.go" | grep -vE ".git|.env|vendor" | sed 's:/[^/]*$$::' | sort | uniq)
77-
GO_COVER_PACKAGES = $(shell find . -name "*_test.go" | grep -vE ".git|.env|vendor|ttnctl|cmd|api" | sed 's:/[^/]*$$::' | sort | uniq)
7844

79-
GO_COVER_FILE ?= coverage.out
80-
GO_COVER_DIR ?= .cover
81-
GO_COVER_FILES = $(patsubst ./%, $(GO_COVER_DIR)/%.out, $(shell echo "$(GO_COVER_PACKAGES)"))
45+
GO_COVER_FILES = `find . -name "coverage.out"`
8246

8347
test: $(GO_FILES)
84-
go test $(GO_TEST_PACKAGES)
48+
go test ./...
49+
pushd api > /dev/null; go test ./...; popd > /dev/null
50+
pushd core/types > /dev/null; go test ./...; popd > /dev/null
51+
pushd mqtt > /dev/null; go test ./...; popd > /dev/null
52+
pushd utils/errors > /dev/null; go test ./...; popd > /dev/null
53+
pushd utils/random > /dev/null; go test ./...; popd > /dev/null
54+
pushd utils/security > /dev/null; go test ./...; popd > /dev/null
55+
pushd utils/testing > /dev/null; go test ./...; popd > /dev/null
8556

8657
cover-clean:
87-
rm -rf $(GO_COVER_DIR) $(GO_COVER_FILE)
58+
rm -f $(GO_COVER_FILES) coverage.out.merged
8859

8960
cover-deps:
9061
@command -v goveralls > /dev/null || go get github.com/mattn/goveralls
9162

92-
cover: $(GO_COVER_FILE)
93-
94-
$(GO_COVER_FILE): cover-clean $(GO_COVER_FILES)
95-
echo "mode: set" > $(GO_COVER_FILE)
96-
cat $(GO_COVER_FILES) | grep -vE "mode: set|/server.go|/manager_server.go" | sort >> $(GO_COVER_FILE)
97-
98-
$(GO_COVER_DIR)/%.out: %
99-
@mkdir -p "$(GO_COVER_DIR)/$<"
100-
go test -cover -coverprofile="$@" "./$<"
101-
102-
coveralls: cover-deps $(GO_COVER_FILE)
103-
goveralls -coverprofile=$(GO_COVER_FILE) -service=travis-ci -repotoken $$COVERALLS_TOKEN
104-
105-
fmt:
106-
[[ -z "`echo "$(GO_PACKAGES)" | xargs go fmt | tee -a /dev/stderr`" ]]
107-
108-
vet:
109-
echo $(GO_PACKAGES) | xargs go vet
110-
111-
lint:
112-
for pkg in `echo $(GO_PACKAGES)`; do golint $$pkg | grep -vE 'mock|.pb.go'; done
63+
cover: cover-clean $(GO_FILES)
64+
go test -coverprofile=coverage.out ./...
65+
pushd api > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
66+
pushd core/types > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
67+
pushd mqtt > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
68+
pushd utils/errors > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
69+
pushd utils/random > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
70+
pushd utils/security > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
71+
pushd utils/testing > /dev/null; go test -coverprofile=coverage.out ./...; popd > /dev/null
72+
echo "mode: set" > coverage.out.merged
73+
cat $(GO_COVER_FILES) | grep -vE "mode: set|/server.go|/manager_server.go" | sort > coverage.out.merged
74+
75+
coveralls: cover-deps cover
76+
goveralls -coverprofile=coverage.out.merged -service=travis-ci -repotoken $$COVERALLS_TOKEN
11377

11478
# Go Build
11579

api/go.mod

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
module github.com/TheThingsNetwork/ttn/api
2+
3+
go 1.11
4+
5+
require (
6+
github.com/StackExchange/wmi v0.0.0-20181212234831-e0a55b97c705 // indirect
7+
github.com/TheThingsNetwork/api v0.0.0-20190516085542-c732802571cf
8+
github.com/TheThingsNetwork/go-utils v0.0.0-20190516083235-bdd4967fab4e
9+
github.com/TheThingsNetwork/ttn/utils/errors v0.0.0-20190516081709-034d40b328bd
10+
github.com/apex/log v1.1.0
11+
github.com/go-ole/go-ole v1.2.4 // indirect
12+
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
13+
github.com/juju/ratelimit v1.0.1
14+
github.com/mwitkow/go-grpc-middleware v1.0.0
15+
github.com/shirou/gopsutil v2.18.12+incompatible
16+
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
17+
github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3
18+
golang.org/x/net v0.0.0-20190514140710-3ec191127204
19+
google.golang.org/grpc v1.20.1
20+
)

0 commit comments

Comments
 (0)