-
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
24 changed files
with
562 additions
and
99 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
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,98 @@ | ||
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 | ||
|
||
build: dep host-apps bin | ||
|
||
clean: | ||
rm -rf ./apps | ||
rm -f ./skywire-node ./skywire-cli ./manager-node ./thereallssh-cli | ||
|
||
install: | ||
${OPTS} go install ./cmd/skywire-node ./cmd/skywire-cli ./cmd/manager-node ./cmd/therealssh-cli | ||
|
||
lint: ## Run linters. Use make install-linters first. | ||
# GO111MODULE=on vendorcheck ./... # TODO: fix vendor check | ||
GO111MODULE=on golangci-lint run -c .golangci.yml ./... | ||
# ${OPTS} vendorcheck ./... # TODO: fix vendor check | ||
${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 ./... | ||
|
||
install-linters: ## Install linters | ||
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 | ||
${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/... | ||
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./internal/... | ||
${OPTS} go test -race -tags no_ci -cover -timeout=5m ./pkg/... | ||
|
||
|
||
# Apps | ||
host-apps: | ||
${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: | ||
${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 | ||
|
||
# Node | ||
|
||
docker-image: | ||
docker image build --tag=skywire-runner --rm - < skywire-runner.Dockerfile | ||
|
||
docker-clean: | ||
-docker network rm ${DOCKER_NETWORK} | ||
-docker container rm --force ${DOCKER_NODE} | ||
|
||
docker-network: | ||
-docker network create ${DOCKER_NETWORK} | ||
|
||
docker-apps: | ||
-${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: | ||
${DOCKER_OPTS} go build -o ./node/skywire-node ./cmd/skywire-node | ||
|
||
|
||
docker-volume: docker-apps docker-bin bin | ||
./skywire-cli config ./node/skywire.json | ||
cat ./node/skywire.json|grep static_public_key |cut -d ':' -f2 |tr -d '"'','' ' > ./node/PK | ||
cat ./node/PK | ||
|
||
node: docker-clean docker-image docker-network docker-volume | ||
docker run -d -v $(shell pwd)/node:/sky --network=${DOCKER_NETWORK} --name=${DOCKER_NODE} ${DOCKER_IMAGE} bash -c "cd /sky && ./skywire-node" | ||
|
||
run: | ||
./skywire-node | ||
|
||
node-stop: | ||
-docker container stop ${DOCKER_NODE} | ||
|
||
refresh-node: node-stop docker-bin | ||
# cp ./skywire-node ./node | ||
docker container start ${DOCKER_NODE} |
Oops, something went wrong.