Skip to content

Commit

Permalink
Merge branch 'milestone2' into merge/m2-to-master
Browse files Browse the repository at this point in the history
# Conflicts:
#	Makefile
#	README.md
#	ci_scripts/run-internal-tests.sh
#	cmd/apps/therealproxy-client/therealproxy-client.go
#	cmd/skywire-cli/commands/visor/gen-config.go
#	docker/images/visor/Dockerfile
#	go.mod
#	integration/InteractiveEnvironments.md
#	integration/generic/nodeA.json
#	integration/generic/nodeC.json
#	integration/test-proxy.sh
#	internal/skyenv/const.go
#	internal/therealproxy/client.go
#	pkg/hypervisor/hypervisor.go
#	pkg/hypervisor/hypervisor_test.go
#	pkg/hypervisor/user_manager.go
#	pkg/transport-discovery/client/client.go
#	pkg/transport/manager.go
#	pkg/transport/manager_test.go
#	pkg/visor/config.go
#	pkg/visor/rpc_test.go
#	pkg/visor/visor.go
#	pkg/visor/visor_test.go
#	vendor/github.com/mitchellh/colorstring/LICENSE
#	vendor/modules.txt
  • Loading branch information
nkryuchkov committed Mar 9, 2020
2 parents ea3699b + 14af534 commit 0f8125b
Show file tree
Hide file tree
Showing 1,392 changed files with 398,347 additions and 102,155 deletions.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Did you run `make format && make check`?

Fixes #

Changes:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ dmsgpty

# Ignore backup go.mod after running '/ci_scripts/go_mod_replace.sh'.
go.mod-e

# goreleaser
dist
100 changes: 100 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
- go mod tidy
builds:
- id: skywire-visor
binary: skywire-visor
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/skywire-visor/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skywire-cli
binary: skywire-cli
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/skywire-cli/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skychat
binary: skychat
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/apps/skychat/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skysocks
binary: skysocks
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/apps/skysocks/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
- id: skysocks-client
binary: skysocks-client
goos:
- linux
- darwin
goarch:
- amd64
- 386
- arm64
- arm
goarm:
- 7
env:
- CGO_ENABLED=0
main: ./cmd/apps/skysocks-client/
ldflags: -s -w -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.version={{.Version}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.commit={{.ShortCommit}} -X github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo.date={{.Date}}
archives:
- format: tar.gz
wrap_in_directory: false
name_template: 'skywire-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
go:
# - "1.11.x" At minimum the code should run make check on the latest two go versions in the default linux environment provided by Travis.
- "1.12.x"
# - "1.13.x" At minimum the code should run make check on the latest two go versions in the default linux environment provided by Travis.
- "1.13.x"

dist: xenial

Expand All @@ -15,12 +15,12 @@ matrix:

install:
- go get -u github.com/FiloSottile/vendorcheck
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.17.1
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.22.2

before_script:
- ci_scripts/create-ip-aliases.sh

script:
- make lint
# - make lint TODO(evanlinjin): Temporary due to https://github.com/golangci/golangci-lint/issues/827
- make test
- make test-no-ci
File renamed without changes.
126 changes: 72 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,48 @@
.PHONY : docker-apps docker-bin docker-volume
.PHONY : docker-run docker-stop

VERSION := $(shell git describe)

RFC_3339 := "+%Y-%m-%dT%H:%M:%SZ"
DATE := $(shell date -u $(RFC_3339))
COMMIT := $(shell git rev-list -1 HEAD)

PROJECT_BASE := github.com/SkycoinProject/skywire-mainnet
OPTS?=GO111MODULE=on
DOCKER_IMAGE?=skywire-runner # docker image to use for running skywire-visor.`golang`, `buildpack-deps:stretch-scm` is OK too
DOCKER_NETWORK?=SKYNET
DOCKER_NODE?=SKY01
DOCKER_OPTS?=GO111MODULE=on GOOS=linux # go options for compiling for docker container
TEST_OPTS?=-race -tags no_ci -cover -timeout=5m
TEST_OPTS_NOCI?=-race -cover -timeout=5m -v
BUILD_OPTS?=

TEST_OPTS_BASE:=-cover -timeout=5m

RACE_FLAG:=-race
GOARCH:=$(shell go env GOARCH)

ifneq (,$(findstring 64,$(GOARCH)))
TEST_OPTS_BASE:=$(TEST_OPTS_BASE) $(RACE_FLAG)
endif

# TODO: Remove after https://github.com/etcd-io/bbolt/pull/201 is closed.
DISABLE_CHECKPTR_FLAG:=-gcflags=all=-d=checkptr=0
GO_VERSION:=$(shell go version)

ifneq (,$(findstring go1.14,$(GO_VERSION)))
TEST_OPTS_BASE:=$(TEST_OPTS_BASE) $(DISABLE_CHECKPTR_FLAG)
endif

TEST_OPTS_NOCI:=-$(TEST_OPTS_BASE) -v
TEST_OPTS:=$(TEST_OPTS_BASE) -tags no_ci

BUILDINFO_PATH := $(PROJECT_BASE)/pkg/util/buildinfo

BUILDINFO_VERSION := -X $(BUILDINFO_PATH).version=$(VERSION)
BUILDINFO_DATE := -X $(BUILDINFO_PATH).date=$(DATE)
BUILDINFO_COMMIT := -X $(BUILDINFO_PATH).commit=$(COMMIT)

BUILDINFO?=-ldflags="$(BUILDINFO_VERSION) $(BUILDINFO_DATE) $(BUILDINFO_COMMIT)"

BUILD_OPTS?=$(BUILDINFO)

check: lint test ## Run linters and tests

Expand All @@ -27,18 +61,18 @@ stop: ## Stop running skywire-visor on host
-bash -c "kill $$(ps aux |grep '[s]kywire-visor' |awk '{print $$2}')"

config: ## Generate skywire.json
-./skywire-cli node gen-config -o ./skywire.json -r
-./skywire-cli visor gen-config -o ./skywire.json -r

clean: ## Clean project: remove created binaries and apps
-rm -rf ./apps
-rm -f ./skywire-visor ./skywire-cli ./setup-node ./hypervisor

install: ## Install `skywire-visor`, `skywire-cli`, `hypervisor`, `dmsgpty`
${OPTS} go install ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node ./cmd/hypervisor ./cmd/dmsgpty
install: ## Install `skywire-visor`, `skywire-cli`, `setup-node`, `hypervisor`
${OPTS} go install ${BUILD_OPTS} ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node ./cmd/hypervisor

rerun: stop
${OPTS} go build -race -o ./skywire-visor ./cmd/skywire-visor
-./skywire-cli node gen-config -o ./skywire.json -r
-./skywire-cli visor gen-config -o ./skywire.json -r
perl -pi -e 's/localhost//g' ./skywire.json
./skywire-visor skywire.json

Expand All @@ -57,7 +91,6 @@ vendorcheck: ## Run vendorcheck
GO111MODULE=off vendorcheck ./cmd/skywire-cli/...
GO111MODULE=off vendorcheck ./cmd/skywire-visor/...


test: ## Run tests
-go clean -testcache &>/dev/null
${OPTS} go test ${TEST_OPTS} ./internal/...
Expand All @@ -68,46 +101,47 @@ test-no-ci: ## Run no_ci tests
${OPTS} go test ${TEST_OPTS_NOCI} ./pkg/transport/... -run "TCP|PubKeyTable"

install-linters: ## Install linters
- VERSION=1.21.0 ./ci_scripts/install-golangci-lint.sh
- VERSION=1.23.1 ./ci_scripts/install-golangci-lint.sh
# GO111MODULE=off go get -u github.com/FiloSottile/vendorcheck
# For some reason this install method is not recommended, see https://github.com/golangci/golangci-lint#install
# However, they suggest `curl ... | bash` which we should not do
# ${OPTS} go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
${OPTS} go get -u golang.org/x/tools/cmd/goimports

format: ## Formats the code. Must have goimports installed (use make install-linters).
${OPTS} goimports -w -local github.com/SkycoinProject/skywire ./pkg
${OPTS} goimports -w -local github.com/SkycoinProject/skywire ./cmd
${OPTS} goimports -w -local github.com/SkycoinProject/skywire ./internal
${OPTS} goimports -w -local ${PROJECT_BASE} ./pkg
${OPTS} goimports -w -local ${PROJECT_BASE} ./cmd
${OPTS} goimports -w -local ${PROJECT_BASE} ./internal

dep: ## Sorts dependencies
${OPTS} go mod vendor -v

# Apps
host-apps: ## Build app
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat.v1.0 ./cmd/apps/skychat
${OPTS} go build ${BUILD_OPTS} -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build ${BUILD_OPTS} -o ./apps/socksproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build ${BUILD_OPTS} -o ./apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat ./cmd/apps/skychat
${OPTS} go build ${BUILD_OPTS} -o ./apps/helloworld ./cmd/apps/helloworld
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client ./cmd/apps/skysocks-client

# Bin
bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`, `dmsgpty`
bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`
${OPTS} go build ${BUILD_OPTS} -o ./skywire-visor ./cmd/skywire-visor
${OPTS} go build ${BUILD_OPTS} -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build ${BUILD_OPTS} -o ./setup-node ./cmd/setup-node
${OPTS} go build ${BUILD_OPTS} -o ./messaging-server ./cmd/messaging-server
${OPTS} go build ${BUILD_OPTS} -o ./hypervisor ./cmd/hypervisor
${OPTS} go build ${BUILD_OPTS} -o ./dmsgpty ./cmd/dmsgpty

release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor` and apps without -race flag
${OPTS} go build -o ./skywire-visor ./cmd/skywire-visor
${OPTS} go build -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build -o ./setup-node ./cmd/setup-node
${OPTS} go build -o ./hypervisor ./cmd/hypervisor
${OPTS} go build -o ./apps/skychat.v1.0 ./cmd/apps/skychat
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
${OPTS} go build -o ./apps/socksproxy.v1.0 ./cmd/apps/therealproxy
${OPTS} go build -o ./apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
${OPTS} go build ${BUILD_OPTS} -o ./skywire-visor ./cmd/skywire-visor
${OPTS} go build ${BUILD_OPTS} -o ./skywire-cli ./cmd/skywire-cli
${OPTS} go build ${BUILD_OPTS} -o ./setup-node ./cmd/setup-node
${OPTS} go build ${BUILD_OPTS} -o ./hypervisor ./cmd/hypervisor
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat ./cmd/apps/skychat
${OPTS} go build ${BUILD_OPTS} -o ./apps/helloworld ./cmd/apps/helloworld
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client ./cmd/apps/skysocks-client

github-release: ## Create a GitHub release
goreleaser --rm-dist

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
Expand All @@ -121,21 +155,21 @@ docker-network: ## Create docker network ${DOCKER_NETWORK}
-docker network create ${DOCKER_NETWORK}

docker-apps: ## Build apps binaries for dockerized skywire-visor. `go build` with ${DOCKER_OPTS}
-${DOCKER_OPTS} go build -race -o ./node/apps/skychat.v1.0 ./cmd/apps/skychat
-${DOCKER_OPTS} go build -race -o ./node/apps/helloworld.v1.0 ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -race -o ./node/apps/socksproxy.v1.0 ./cmd/apps/therealproxy
-${DOCKER_OPTS} go build -race -o ./node/apps/socksproxy-client.v1.0 ./cmd/apps/therealproxy-client
-${DOCKER_OPTS} go build -race -o ./visor/apps/skychat ./cmd/apps/skychat
-${DOCKER_OPTS} go build -race -o ./visor/apps/helloworld ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -race -o ./visor/apps/skysocks ./cmd/apps/skysocks
-${DOCKER_OPTS} go build -race -o ./visor/apps/skysocks-client ./cmd/apps/skysocks-client

docker-bin: ## Build `skywire-visor`, `skywire-cli`, `hypervisor`. `go build` with ${DOCKER_OPTS}
${DOCKER_OPTS} go build -race -o ./node/skywire-visor ./cmd/skywire-visor
${DOCKER_OPTS} go build -race -o ./visor/skywire-visor ./cmd/skywire-visor

docker-volume: dep docker-apps docker-bin bin ## Prepare docker volume for dockerized skywire-visor
-${DOCKER_OPTS} go build -o ./docker/skywire-services/setup-node ./cmd/setup-node
-./skywire-cli node gen-config -o ./skywire-visor/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli
-./skywire-cli visor gen-config -o ./skywire-visor/skywire.json -r
perl -pi -e 's/localhost//g' ./visor/skywire.json # To make visor accessible from outside with skywire-cli

docker-run: docker-clean docker-image docker-network docker-volume ## Run dockerized skywire-visor ${DOCKER_NODE} in image ${DOCKER_IMAGE} with network ${DOCKER_NETWORK}
docker run -it -v $(shell pwd)/node:/sky --network=${DOCKER_NETWORK} \
docker run -it -v $(shell pwd)/visor:/sky --network=${DOCKER_NETWORK} \
--name=${DOCKER_NODE} ${DOCKER_IMAGE} bash -c "cd /sky && ./skywire-visor skywire.json"

docker-setup-node: ## Runs setup-node in detached state in ${DOCKER_NETWORK}
Expand All @@ -149,9 +183,9 @@ docker-stop: ## Stop running dockerized skywire-visor ${DOCKER_NODE}
-docker container stop ${DOCKER_NODE}

docker-rerun: docker-stop
-./skywire-cli gen-config -o ./node/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli
${DOCKER_OPTS} go build -race -o ./node/skywire-visor ./cmd/skywire-visor
-./skywire-cli gen-config -o ./visor/skywire.json -r
perl -pi -e 's/localhost//g' ./visor/skywire.json # To make visor accessible from outside with skywire-cli
${DOCKER_OPTS} go build -race -o ./visor/skywire-visor ./cmd/skywire-visor
docker container start -i ${DOCKER_NODE}

run-syslog: ## Run syslog-ng in docker. Logs are mounted under /tmp/syslog
Expand All @@ -160,22 +194,6 @@ run-syslog: ## Run syslog-ng in docker. Logs are mounted under /tmp/syslog
-docker container rm syslog-ng -f
docker run -d -p 514:514/udp -v /tmp/syslog:/var/log --name syslog-ng balabit/syslog-ng:latest


integration-startup: ## Starts up the required transports between `skywire-visor`s of interactive testing environment
./integration/startup.sh

integration-teardown: ## Tears down all saved configs and states of integration executables
./integration/tear-down.sh

integration-run-generic: ## Runs the generic interactive testing environment
./integration/run-generic-env.sh

integration-run-messaging: ## Runs the messaging interactive testing environment
./integration/run-messaging-env.sh

integration-run-proxy: ## Runs the proxy interactive testing environment
./integration/run-proxy-env.sh

mod-comm: ## Comments the 'replace' rule in go.mod
./ci_scripts/go_mod_replace.sh comment go.mod

Expand Down
Loading

0 comments on commit 0f8125b

Please sign in to comment.