-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mainnet' into feature/config-directory
- Loading branch information
Showing
63 changed files
with
3,180 additions
and
1,065 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,10 @@ | |
pkg/node/apps/ | ||
pkg/node/bar/ | ||
pkg/node/foo/ | ||
|
||
/manager-node | ||
/skywire-node | ||
/skywire-cli | ||
/therealssh-cli | ||
/node | ||
PK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,123 @@ | ||
lint: ## Run linters. Use make install-linters first. | ||
# GO111MODULE=on vendorcheck ./... # TODO: fix vendor check | ||
GO111MODULE=on golangci-lint run -c .golangci.yml ./... | ||
.DEFAULT_GOAL := help | ||
.PHONY : check lint install-linters dep test | ||
.PHONY : build clean install format | ||
.PHONY : host-apps bin | ||
.PHONY : run stop | ||
.PHONY : docker-image docker-clean docker-network | ||
.PHONY : docker-apps docker-bin docker-volume | ||
.PHONY : docker-run docker-stop | ||
|
||
OPTS?=GO111MODULE=on | ||
DOCKER_IMAGE?=skywire-runner # docker image to use for running skywire-node.`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 | ||
|
||
check: lint test ## Run linters and tests | ||
|
||
build: dep host-apps bin ## Install dependencies, build apps and binaries. `go build` with ${OPTS} | ||
|
||
run: stop build ## Run skywire-node on host | ||
./skywire-node | ||
|
||
stop: ## Stop running skywire-node on host | ||
-bash -c "kill $$(ps aux |grep '[s]kywire-node' |awk '{print $$2}')" | ||
|
||
|
||
clean: ## Clean project: remove created binaries and apps | ||
-rm -rf ./apps | ||
-rm -f ./skywire-node ./skywire-cli ./manager-node ./thereallssh-cli | ||
|
||
install: ## Install `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli` | ||
${OPTS} go install ./cmd/skywire-node ./cmd/skywire-cli ./cmd/manager-node ./cmd/therealssh-cli | ||
|
||
|
||
lint: ## Run linters. Use make install-linters first | ||
${OPTS} golangci-lint run -c .golangci.yml ./... | ||
# The govet version in golangci-lint is out of date and has spurious warnings, run it separately | ||
GO111MODULE=on go vet -all ./... | ||
${OPTS} go vet -all ./... | ||
|
||
vendorcheck: ## Run vendorcheck | ||
GO111MODULE=off vendorcheck ./internal/... | ||
GO111MODULE=off vendorcheck ./pkg/... | ||
GO111MODULE=off vendorcheck ./cmd/apps/... | ||
GO111MODULE=off vendorcheck ./cmd/manager-node/... | ||
GO111MODULE=off vendorcheck ./cmd/skywire-cli/... | ||
GO111MODULE=off vendorcheck ./cmd/skywire-node/... | ||
# vendorcheck fails on ./cmd/therealssh-cli | ||
# the problem is indirect dependency to github.com/sirupsen/logrus | ||
#GO111MODULE=off vendorcheck ./cmd/therealssh-cli/... | ||
|
||
test: ## Run tests for net | ||
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./internal/... | ||
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/... | ||
|
||
install-linters: ## Install linters | ||
GO111MODULE=off go get -u github.com/FiloSottile/vendorcheck | ||
- VERSION=1.13.2 ./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 | ||
GO111MODULE=on go get -u github.com/golangci/golangci-lint/cmd/golangci-lint | ||
GO111MODULE=on go get -u golang.org/x/tools/cmd/goimports | ||
# ${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). | ||
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./pkg | ||
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./cmd | ||
GO111MODULE=on goimports -w -local github.com/skycoin/skywire ./internal | ||
${OPTS} goimports -w -local github.com/skycoin/skywire ./pkg | ||
${OPTS} goimports -w -local github.com/skycoin/skywire ./cmd | ||
${OPTS} goimports -w -local github.com/skycoin/skywire ./internal | ||
|
||
dep: ## sorts dependencies | ||
GO111MODULE=on go mod vendor -v | ||
dep: ## Sorts dependencies | ||
${OPTS} go mod vendor -v | ||
|
||
test: ## Run tests for net | ||
GO111MODULE=on go test -race -tags no_ci -cover -timeout=5m ./internal/... | ||
GO111MODULE=on go test -race -tags no_ci -cover -timeout=5m ./pkg/... | ||
|
||
# Apps | ||
host-apps: ## Build app | ||
${OPTS} go build -o ./apps/chat.v1.0 ./cmd/apps/chat | ||
${OPTS} go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld | ||
${OPTS} go build -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy | ||
${OPTS} go build -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client | ||
${OPTS} go build -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh | ||
${OPTS} go build -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client | ||
|
||
# Bin | ||
bin: ## Build `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli` | ||
${OPTS} go build -o ./skywire-node ./cmd/skywire-node | ||
${OPTS} go build -o ./skywire-cli ./cmd/skywire-cli | ||
${OPTS} go build -o ./manager-node ./cmd/manager-node | ||
${OPTS} go build -o ./therealssh-cli ./cmd/therealssh-cli | ||
|
||
# Dockerized skywire-node | ||
docker-image: ## Build docker image `skywire-runner` | ||
docker image build --tag=skywire-runner --rm - < skywire-runner.Dockerfile | ||
|
||
docker-clean: ## Clean docker system: remove container ${DOCKER_NODE} and network ${DOCKER_NETWORK} | ||
-docker network rm ${DOCKER_NETWORK} | ||
-docker container rm --force ${DOCKER_NODE} | ||
|
||
docker-network: ## Create docker network ${DOCKER_NETWORK} | ||
-docker network create ${DOCKER_NETWORK} | ||
|
||
docker-apps: ## Build apps binaries for dockerized skywire-node. `go build` with ${DOCKER_OPTS} | ||
-${DOCKER_OPTS} go build -o ./node/apps/chat.v1.0 ./cmd/apps/chat | ||
-${DOCKER_OPTS} go build -o ./node/apps/helloworld.v1.0 ./cmd/apps/helloworld | ||
-${DOCKER_OPTS} go build -o ./node/apps/therealproxy.v1.0 ./cmd/apps/therealproxy | ||
-${DOCKER_OPTS} go build -o ./node/apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client | ||
-${DOCKER_OPTS} go build -o ./node/apps/therealssh.v1.0 ./cmd/apps/therealssh | ||
-${DOCKER_OPTS} go build -o ./node/apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client | ||
|
||
docker-bin: ## Build `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli`. `go build` with ${DOCKER_OPTS} | ||
${DOCKER_OPTS} go build -o ./node/skywire-node ./cmd/skywire-node | ||
|
||
docker-volume: docker-apps docker-bin bin ## Prepare docker volume for dockerized skywire-node | ||
./skywire-cli config ./node/skywire.json | ||
|
||
docker-run: docker-clean docker-image docker-network docker-volume ## Run dockerized skywire-node ${DOCKER_NODE} in image ${DOCKER_IMAGE} with network ${DOCKER_NETWORK} | ||
docker run -it -v $(shell pwd)/node:/sky --network=${DOCKER_NETWORK} \ | ||
--name=${DOCKER_NODE} ${DOCKER_IMAGE} bash -c "cd /sky && ./skywire-node" | ||
|
||
docker-stop: ## Stop running dockerized skywire-node ${DOCKER_NODE} | ||
-docker container stop ${DOCKER_NODE} | ||
|
||
|
||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
Oops, something went wrong.