Skip to content

Commit

Permalink
Fix merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
志宇 committed Mar 2, 2020
2 parents 40b7792 + c6e6c7c commit c769c60
Show file tree
Hide file tree
Showing 350 changed files with 306,168 additions and 313 deletions.
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:'
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ dep: ## Sorts dependencies

# 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/skysocks.v1.0 ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client.v1.0 ./cmd/apps/skysocks-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`
Expand All @@ -118,10 +118,13 @@ release: ## Build `skywire-visor`, `skywire-cli`, `hypervisor` and apps without
${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.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/skysocks.v1.0 ./cmd/apps/skysocks
${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client.v1.0 ./cmd/apps/skysocks-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

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

# Dockerized skywire-visor
docker-image: ## Build docker image `skywire-runner`
Expand All @@ -135,10 +138,10 @@ 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 ./visor/apps/skychat.v1.0 ./cmd/apps/skychat
-${DOCKER_OPTS} go build -race -o ./visor/apps/helloworld.v1.0 ./cmd/apps/helloworld
-${DOCKER_OPTS} go build -race -o ./visor/apps/skysocks.v1.0 ./cmd/apps/skysocks
-${DOCKER_OPTS} go build -race -o ./visor/apps/skysocks-client.v1.0 ./cmd/apps/skysocks-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 ./visor/skywire-visor ./cmd/skywire-visor
Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
- [4. Create new dockerized `skywire-visor`s](#4-create-new-dockerized-skywire-visors)
- [5. Env-vars for development-/testing- purposes](#5-env-vars-for-development-testing--purposes)
- [6. "Hello-Mike-Hello-Joe" test](#6-hello-mike-hello-joe-test)
- [Creating a GitHub release](#creating-a-github-release)
- [How to create a GitHub release](#how-to-create-a-github-release)

**NOTE:** The project is still under heavy development and should only be used for testing purposes right now. Miners should not switch over to this project if they want to receive testnet rewards.

Expand Down Expand Up @@ -210,7 +212,7 @@ communication API over the pipe.

```golang
// Config defines configuration parameters for App
&app.Config{AppName: "helloworld", AppVersion: "1.0", ProtocolVersion: "0.0.1"}
&app.Config{AppName: "helloworld", ProtocolVersion: "0.0.1"}
// Setup setups app using default pair of pipes
func Setup(config *Config) (*App, error) {}

Expand Down Expand Up @@ -473,3 +475,20 @@ $ curl --data {'"recipient":"'$SW_VISOR_A_PK'", "message":"System is working!"}
# Teardown
$ make stop && make docker-stop
```

## Creating a GitHub release

To maintain actual `skywire-visor` state on users' Skywire nodes we have a mechanism for updating `skywire-visor` binaries.
Binaries for each version are uploaded to [GitHub releases](https://github.com/SkycoinProject/skywire-mainnet/releases/).
We use [goreleaser](https://goreleaser.com) for creating them.

### How to create a GitHub release

1. Make sure that `git` and [goreleaser](https://goreleaser.com/install) are installed.
2. Checkout to a commit you would like to create a release against.
3. Make sure that `git status` is in clean state.
4. Create a `git` tag with desired release version and release name: `git tag -a 0.1.0 -m "First release"`, where `0.1.0` is release version and `First release` is release name.
5. Push the created tag to the repository: `git push origin 0.1.0`, where `0.1.0` is release version.
6. [Issue a personal GitHub access token.](https://github.com/settings/tokens)
7. Run `GITHUB_TOKEN=your_token make github-release`
8. [Check the created GitHub release.](https://github.com/SkycoinProject/skywire-mainnet/releases/)
5 changes: 5 additions & 0 deletions cmd/apps/helloworld/helloworld.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ import (
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
)

const (
netType = appnet.TypeSkynet
)

func main() {
if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

clientConfig, err := app.ClientConfigFromEnv()
if err != nil {
log.Fatalf("Error getting client config: %v\n", err)
Expand Down
5 changes: 5 additions & 0 deletions cmd/apps/skychat/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
)

const (
Expand All @@ -44,6 +45,10 @@ func main() {
log = app.NewLogger(appName)
flag.Parse()

if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

clientConfig, err := app.ClientConfigFromEnv()
if err != nil {
log.Fatalf("Error getting client config: %v\n", err)
Expand Down
5 changes: 5 additions & 0 deletions cmd/apps/skysocks-client/skysocks-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
)

const (
Expand Down Expand Up @@ -51,6 +52,10 @@ func main() {
log := app.NewLogger(appName)
skysocks.Log = log.PackageLogger("skysocks")

if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

var addr = flag.String("addr", skyenv.SkysocksClientAddr, "Client address to listen on")
var serverPK = flag.String("srv", "", "PubKey of the server to connect to")
flag.Parse()
Expand Down
5 changes: 5 additions & 0 deletions cmd/apps/skysocks/skysocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/SkycoinProject/skywire-mainnet/pkg/app"
"github.com/SkycoinProject/skywire-mainnet/pkg/app/appnet"
"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/util/buildinfo"
)

const (
Expand All @@ -27,6 +28,10 @@ func main() {
log := app.NewLogger(appName)
skysocks.Log = log.PackageLogger("skysocks")

if _, err := buildinfo.Get().WriteTo(log.Writer()); err != nil {
log.Printf("Failed to output build info: %v", err)
}

var passcode = flag.String("passcode", "", "Authorize user against this passcode")

flag.Parse()
Expand Down
3 changes: 0 additions & 3 deletions cmd/skywire-cli/commands/visor/gen-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ func defaultDmsgPtyConfig() visor.DmsgPtyConfig {
func defaultSkychatConfig() visor.AppConfig {
return visor.AppConfig{
App: skyenv.SkychatName,
Version: skyenv.SkychatVersion,
AutoStart: true,
Port: routing.Port(skyenv.SkychatPort),
Args: []string{"-addr", skyenv.SkychatAddr},
Expand All @@ -178,7 +177,6 @@ func defaultSkysocksConfig(passcode string) visor.AppConfig {
}
return visor.AppConfig{
App: skyenv.SkysocksName,
Version: skyenv.SkysocksVersion,
AutoStart: true,
Port: routing.Port(skyenv.SkysocksPort),
Args: args,
Expand All @@ -188,7 +186,6 @@ func defaultSkysocksConfig(passcode string) visor.AppConfig {
func defaultSkysocksClientConfig() visor.AppConfig {
return visor.AppConfig{
App: skyenv.SkysocksClientName,
Version: skyenv.SkysocksClientVersion,
AutoStart: false,
Port: routing.Port(skyenv.SkysocksClientPort),
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/skywire-visor/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (cfg *runCfg) readConfig() *runCfg {
}
}()

cfg.logger.Info("Reading config from %v", configPath)
cfg.logger.Infof("Reading config from %v", configPath)

rdr = file
cfg.configPath = &configPath
Expand Down Expand Up @@ -203,7 +203,7 @@ func (cfg *runCfg) runVisor() *runCfg {
cfg.logger.Fatal("failed to unlink socket files: ", err)
}

visor, err := visor.NewVisor(&cfg.conf, cfg.masterLogger, cfg.restartCtx, cfg.configPath)
vis, err := visor.NewVisor(&cfg.conf, cfg.masterLogger, cfg.restartCtx, cfg.configPath)
if err != nil {
cfg.logger.Fatal("Failed to initialize visor: ", err)
}
Expand All @@ -227,7 +227,7 @@ func (cfg *runCfg) runVisor() *runCfg {
}

go func() {
if err := visor.Start(); err != nil {
if err := vis.Start(); err != nil {
cfg.logger.Fatal("Failed to start visor: ", err)
}
}()
Expand All @@ -236,7 +236,7 @@ func (cfg *runCfg) runVisor() *runCfg {
cfg.conf.ShutdownTimeout = defaultShutdownTimeout
}

cfg.visor = visor
cfg.visor = vis

return cfg
}
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mholt/archiver/v3 v3.3.0
github.com/pkg/profile v1.3.0
github.com/prometheus/client_golang v1.3.0
github.com/prometheus/common v0.7.0
github.com/schollz/progressbar/v2 v2.15.0
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
Expand Down
Loading

0 comments on commit c769c60

Please sign in to comment.