Skip to content

Commit

Permalink
Merge branch 'develop' into local-skychat
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpalide authored Nov 2, 2023
2 parents 458c156 + 499658a commit e93ca59
Show file tree
Hide file tree
Showing 1,414 changed files with 454,104 additions and 158,534 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/checkout@v3
- name: deploy to docker
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -48,7 +48,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
shell: pwsh
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -25,7 +25,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand All @@ -44,7 +44,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install Requirements
run: |
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ lint-windows: ## Run linters. Use make install-linters-windows first

test: ## Run tests
-go clean -testcache &>/dev/null
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/...
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/... ./cmd/...
${OPTS} go test ${TEST_OPTS}

test-windows: ## Run tests on windows
@go clean -testcache
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/...
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/... ./cmd/...

install-linters: ## Install linters
- VERSION=latest ./ci_scripts/install-golangci-lint.sh
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/completion/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var RootCmd = &cobra.Command{
Short: "Generate completion script",
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Args: cobra.MatchAll(cobra.ExactArgs(1)),
Run: func(cmd *cobra.Command, args []string) {
switch args[0] {
case "bash":
Expand Down
595 changes: 546 additions & 49 deletions cmd/skywire-cli/commands/config/gen.go

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions cmd/skywire-cli/commands/config/gen_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package cliconfig

import (
"os"
"os/exec"
"runtime"
"testing"

"github.com/bitfield/script"
)

var (
shell string
)

func init() {
switch runtime.GOOS {
case "windows":
if _, err := exec.LookPath("bash"); err == nil {
shell = "bash"
} else if _, err := exec.LookPath("powershell"); err == nil {
shell = "powershell"
} else {
panic("Required binaries 'bash' and 'powershell' not found")
}
case "linux", "darwin":
if _, err := exec.LookPath("bash"); err != nil {
panic("Required binary 'bash' not found")
}
shell = "bash"
default:
panic("Unsupported operating system: " + runtime.GOOS)
}
}

// Reference Issue https://github.com/skycoin/skywire/issues/1606

func TestConfigGenCmdFunc(t *testing.T) {
tests := []struct {
name string
command string
expectedErr bool
}{
{
name: "first config gen -r",
command: "config gen -r -o test-config.json",
expectedErr: false,
},
{
name: "second config gen -r",
command: "config gen -r -o test-config.json",
expectedErr: false,
},
{
name: "config gen -rf",
command: "config gen -rf -o test-config.json",
expectedErr: true,
},
}
_ = os.Remove("test-config.json") //nolint
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
_, err := script.Exec(shell + ` -c "go run ../../skywire-cli.go ` + test.command + `"`).Stdout()
if err != nil {
if !test.expectedErr {
t.Fatalf("Expected error: %v, but got: %v", test.expectedErr, err)
}
}
if err == nil {
if test.expectedErr {
t.Fatalf("Expected error: %v, but got: %v", test.expectedErr, err)
}
}
})
}
_ = os.Remove("test-config.json") //nolint
}
138 changes: 71 additions & 67 deletions cmd/skywire-cli/commands/config/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,73 +21,77 @@ var (
Test: visorconfig.DmsgHTTPServersData{DMSGServers: []*disc.Entry{}},
Prod: visorconfig.DmsgHTTPServersData{DMSGServers: []*disc.Entry{}},
}
noFetch bool
noDefaults bool
stcprPort int
sudphPort int
sk cipher.SecKey
output string
confPath string
configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong
isStdout bool
isRegen bool
isRetainHypervisors bool
isTestEnv bool
pText string
isPkgEnv bool
isUsrEnv bool
isHypervisor bool
hypervisorPKs string
dmsgptyWlPKs string
surveyWhitelistPKs string
routeSetupNodes string
transportSetupPKs string
isDmsgHTTP bool
isVpnServerEnable bool
isDisableAuth bool
isEnableAuth bool
selectedOS string
disableApps string
isBestProtocol bool
serviceConfURL string
services *visorconfig.Services
isForce bool
isHide bool
isAll bool
isOutUnset bool
ver string
isRoot = visorconfig.IsRoot()
svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr
testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr
gHiddenFlags []string
uHiddenFlags []string
binPath string
logLevel string
isPkg bool
input string
isUpdateEndpoints bool
addHypervisorPKs string
isResetHypervisor bool
setVPNClientKillswitch string
addVPNClientSrv string
addVPNClientPasscode string
isResetVPNclient bool
addVPNServerPasscode string
setVPNServerSecure string
setVPNServerAutostart string
setVPNServerNetIfc string
isResetVPNServer bool
addSkysocksClientSrv string
isResetSkysocksClient bool
skysocksPasscode string
isResetSkysocks bool
setPublicAutoconnect string
minHops int
isUsr bool
isPublic bool
disablePublicAutoConn bool
isDisplayNodeIP bool
addExampleApps bool
noFetch bool
noDefaults bool
stcprPort int
sudphPort int
sk cipher.SecKey
output string
confPath string
configName string //nolint Note: configName used, but golangci-lint marked it unused in wrong
isStdout bool
isRegen bool
isRetainHypervisors bool
isTestEnv bool
pText string
isPkgEnv bool
isUsrEnv bool
isHypervisor bool
hypervisorPKs string
dmsgptyWlPKs string
surveyWhitelistPKs string
routeSetupNodes string
transportSetupPKs string
isDmsgHTTP bool
isVpnServerEnable bool
isDisableAuth bool
isEnableAuth bool
selectedOS string
disableApps string
isBestProtocol bool
serviceConfURL string
services *visorconfig.Services
isForce bool
isHide bool
isAll bool
isOutUnset bool
ver string
isRoot = visorconfig.IsRoot()
svcConf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr
testConf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //visorconfig.DefaultServiceConfAddr
gHiddenFlags []string
uHiddenFlags []string
binPath string
logLevel string
isPkg bool
input string
isUpdateEndpoints bool
addHypervisorPKs string
isResetHypervisor bool
setVPNClientKillswitch string
addVPNClientSrv string
addVPNClientPasscode string
isResetVPNclient bool
addVPNServerPasscode string
setVPNServerSecure string
setVPNServerAutostart string
setVPNServerNetIfc string
isResetVPNServer bool
addSkysocksClientSrv string
isResetSkysocksClient bool
skysocksPasscode string
isResetSkysocks bool
setPublicAutoconnect string
minHops int
isUsr bool
isPublic bool
disablePublicAutoConn bool
isDisplayNodeIP bool
addExampleApps bool
enableProxyClientAutostart bool
disableProxyServerAutostart bool
proxyServerPass string
proxyClientPass string
)

// RootCmd contains commands that interact with the config of local skywire-visor
Expand Down
Loading

0 comments on commit e93ca59

Please sign in to comment.