From 07ef0d7c23e97f611875be68dec0660678970f2f Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 22 Mar 2021 22:12:23 +0300 Subject: [PATCH 1/7] Remove travisci comment, `make test-no-ci` target --- .travis.yml | 2 +- Makefile | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8e1b1ba05d..8fa5ee90b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ before_script: - ci_scripts/create-ip-aliases.sh script: - - make lint # TODO(evanlinjin): Temporary due to https://github.com/golangci/golangci-lint/issues/827 + - make lint - make build - make test - make test-no-ci diff --git a/Makefile b/Makefile index 852fe9bfa6..2dad7f231b 100644 --- a/Makefile +++ b/Makefile @@ -26,19 +26,15 @@ DOCKER_NETWORK?=SKYNET DOCKER_NODE?=SKY01 DOCKER_OPTS?=GO111MODULE=on GOOS=linux # go options for compiling for docker container -TEST_OPTS_BASE:=-cover -timeout=5m -mod=vendor +TEST_OPTS:=-cover -timeout=5m -mod=vendor RACE_FLAG:=-race GOARCH:=$(shell go env GOARCH) ifneq (,$(findstring 64,$(GOARCH))) - TEST_OPTS_BASE:=$(TEST_OPTS_BASE) $(RACE_FLAG) + TEST_OPTS:=$(TEST_OPTS) $(RACE_FLAG) endif -TEST_OPTS_NOCI:=-$(TEST_OPTS_BASE) -v -TEST_OPTS:=$(TEST_OPTS_BASE) -tags no_ci - - BUILDINFO_PATH := $(DMSG_BASE)/buildinfo BUILDINFO_VERSION := -X $(BUILDINFO_PATH).version=$(VERSION) @@ -121,10 +117,6 @@ test: ## Run tests ${OPTS} go test ${TEST_OPTS} ./internal/... ${OPTS} go test ${TEST_OPTS} ./pkg/... -test-no-ci: ## Run no_ci tests - -go clean -testcache - ${OPTS} go test ${TEST_OPTS_NOCI} ./pkg/transport/... -run "TCP|PubKeyTable" - install-linters: ## Install linters - VERSION=latest ./ci_scripts/install-golangci-lint.sh # GO111MODULE=off go get -u github.com/FiloSottile/vendorcheck From bbfc3edb32ee36fb03fe76e7eddb7abaca0822d6 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 22 Mar 2021 22:26:00 +0300 Subject: [PATCH 2/7] Remove `make test-no-ci` invokation from travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8fa5ee90b1..d001ce4e02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,6 @@ script: - make lint - make build - make test - - make test-no-ci - make install-deps-ui - make lint-ui - make build-ui From 60acfbffd91913dbcd5bd335d85b5e96a919fda9 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 22 Mar 2021 22:34:29 +0300 Subject: [PATCH 3/7] Remove redundant scripts from `ci_scripts` --- ci_scripts/run-internal-tests.sh | 20 --------- ci_scripts/run-pkg-tests.sh | 76 -------------------------------- 2 files changed, 96 deletions(-) delete mode 100755 ci_scripts/run-internal-tests.sh delete mode 100755 ci_scripts/run-pkg-tests.sh diff --git a/ci_scripts/run-internal-tests.sh b/ci_scripts/run-internal-tests.sh deleted file mode 100755 index bd1dec41b0..0000000000 --- a/ci_scripts/run-internal-tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -# commit a70894c8c4223424151cdff7441b1fb2e6bad309 -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/httpauth -run TestClient >> ./logs/internal/TestClient.log - -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestAckReadWriter >> ./logs/internal/TestAckReadWriter.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestAckReadWriterCRCFailure >> ./logs/internal/TestAckReadWriterCRCFailure.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestAckReadWriterFlushOnClose >> ./logs/internal/TestAckReadWriterFlushOnClose.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestAckReadWriterPartialRead >> ./logs/internal/TestAckReadWriterPartialRead.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestAckReadWriterReadError >> ./logs/internal/TestAckReadWriterReadError.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/ioutil -run TestLenReadWriter >> ./logs/internal/TestLenReadWriter.log - -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestRPCClientDialer >> ./logs/internal/TestRPCClientDialer.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestConn >> ./logs/internal/TestConn.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestListener >> ./logs/internal/TestListener.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestKKAndSecp256k1 >> ./logs/internal/TestKKAndSecp256k1.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestXKAndSecp256k1 >> ./logs/internal/TestXKAndSecp256k1.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestReadWriterKKPattern >> ./logs/internal/TestReadWriterKKPattern.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestReadWriterXKPattern >> ./logs/internal/TestReadWriterXKPattern.log -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/noise -run TestReadWriterConcurrentTCP >> ./logs/internal/TestReadWriterConcurrentTCP.log - -go clean -testcache &>/dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/internal/skysocks -run TestProxy >> ./logs/internal/TestProxy.log diff --git a/ci_scripts/run-pkg-tests.sh b/ci_scripts/run-pkg-tests.sh deleted file mode 100755 index 5482b85203..0000000000 --- a/ci_scripts/run-pkg-tests.sh +++ /dev/null @@ -1,76 +0,0 @@ -# commit a70894c8c4223424151cdff7441b1fb2e6bad309 -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppDial >> ./logs/pkg/TestAppDial.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppAccept >> ./logs/pkg/TestAppAccept.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppWrite >> ./logs/pkg/TestAppWrite.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppRead >> ./logs/pkg/TestAppRead.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppSetup >> ./logs/pkg/TestAppSetup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppCloseConn >> ./logs/pkg/TestAppCloseConn.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppClose >> ./logs/pkg/TestAppClose.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestAppCommand >> ./logs/pkg/TestAppCommand.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestPipeConn >> ./logs/pkg/TestPipeConn.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestProtocol >> ./logs/pkg/TestProtocol.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/app -run TestProtocolParallel >> ./logs/pkg/TestProtocolParallel.log - -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestDmsgDiscovery >> ./logs/pkg/TestDmsgDiscovery.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestTransportDiscovery >> ./logs/pkg/TestTransportDiscovery.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestTransportLogStore >> ./logs/pkg/TestTransportLogStore.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestRoutingTable >> ./logs/pkg/TestRoutingTable.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestAppsConfig >> ./logs/pkg/TestAppsConfig.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestAppsDir >> ./logs/pkg/TestAppsDir.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestLocalDir >> ./logs/pkg/TestLocalDir.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestNewVisor >> ./logs/pkg/TestNewVisor.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestVisorStartClose >> ./logs/pkg/TestVisorStartClose.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestVisorSpawnApp >> ./logs/pkg/TestVisorSpawnApp.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestVisorSpawnAppValidations >> ./logs/pkg/TestVisorSpawnAppValidations.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestListApps >> ./logs/pkg/TestListApps.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestStartStopApp >> ./logs/pkg/TestStartStopApp.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/visor -run TestRPC >> ./logs/pkg/TestRPC.log - -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestAppManagerInit >> ./logs/pkg/TestAppManagerInit.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestAppManagerSetupRouteGroup >> ./logs/pkg/TestAppManagerSetupRouteGroup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestAppManagerCloseRouteGRoup >> ./logs/pkg/TestAppManagerCloseRouteGroup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestAppManagerForward >> ./logs/pkg/TestAppManagerForward.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestManagedRoutingTableCleanup >> ./logs/pkg/TestManagedRoutingTableCleanup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestPortManager >> ./logs/pkg/TestPortManager.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerGetRule >> ./logs/pkg/TestRouteManagerGetRule.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerRemoveRouteGroupRule >> ./logs/pkg/TestRouteManagerRemoveRouteGroupRule.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerAddRemoveRule >> ./logs/pkg/TestRouteManagerAddRemoveRule.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerDeleteRules >> ./logs/pkg/TestRouteManagerDeleteRules.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerConfirmRouteGroup >> ./logs/pkg/TestRouteManagerConfirmRouteGroup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouteManagerRouteGroupClosed >> ./logs/pkg/TestRouteManagerRouteGroupClosed.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterForwarding >> ./logs/pkg/TestRouterForwarding.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterAppInit >> ./logs/pkg/TestRouterAppInit.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterApp >> ./logs/pkg/TestRouterApp.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterLocalApp >> ./logs/pkg/TestRouterLocalApp.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterSetup >> ./logs/pkg/TestRouterSetup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterSetupRouteGroup >> ./logs/pkg/TestRouterSetupRouteGroup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterSetupRouteGroupLocal >> ./logs/pkg/TestRouterSetupRouteGroupLocal.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterCloseRouteGroup >> ./logs/pkg/TestRouterCloseRouteGroup.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterCloseRouteGroupOnAppClose >> ./logs/pkg/TestRouterCloseRouteGroupOnAppClose.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterCloseRouteGroupOnRouterClose >> ./logs/pkg/TestRouterCloseRouteGroupOnRouterClose.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/router -run TestRouterRouteExpiration >> ./logs/pkg/TestRouterRouteExpiration.log - -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/routing -run TestBoltDBRoutingTable >> ./logs/pkg/TestBoltDBRoutingTable.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/routing -run TestMakePacket >> ./logs/pkg/TestMakePacket.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/routing -run TestRoutingTable >> ./logs/pkg/TestRoutingTable.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/routing -run TestAppRule >> ./logs/pkg/TestAppRule.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/routing -run TestForwardRule >> ./logs/pkg/TestForwardRule.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/setup -run TestNewProtocol >> ./logs/pkg/TestNewProtocol.log - -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestSettlementHandshake >> ./logs/pkg/TestSettlementHandshake.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestSettlementHandshakeInvalidSig >> ./logs/pkg/TestSettlementHandshakeInvalidSig.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestSettlementHandshakePrivate >> ./logs/pkg/TestSettlementHandshakePrivate.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestSettlementHandshakeExistingTransport >> ./logs/pkg/TestSettlementHandshakeExistingTransport.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestValidateEntry >> ./logs/pkg/TestValidateEntry.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestInMemoryTransportLogStore >> ./logs/pkg/TestInMemoryTransportLogStore.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestFileTransportLogStore >> ./logs/pkg/TestFileTransportLogStore.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestTransportManager >> ./logs/pkg/TestTransportManager.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestTransportManagerReEstablishTransports >> ./logs/pkg/TestTransportManagerReEstablishTransports.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestTransportManagerLogs >> ./logs/pkg/TestTransportManagerLogs.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport -run TestTCPFactory >> ./logs/pkg/TestTCPFactory.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestClientAuth >> ./logs/pkg/TestClientAuth.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestRegisterTransportResponses >> ./logs/pkg/TestRegisterTransportResponses.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestRegisterTransports >> ./logs/pkg/TestRegisterTransports.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestGetTransportByID >> ./logs/pkg/TestGetTransportByID.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestGetTransportsByEdge >> ./logs/pkg/TestGetTransportsByEdge.log -go clean -testcache &> /dev/null || go test -race -tags no_ci -cover -timeout=5m github.com/skycoin/skywire/pkg/transport-discovery/client -run TestUpdateStatuses >> ./logs/pkg/TestUpdateStatuses.log From e8b7f1139d6975c11627b41bdc14334193e59470 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Mon, 22 Mar 2021 23:59:19 +0300 Subject: [PATCH 4/7] More cleanup --- .travis.yml | 6 ++---- Makefile | 38 ++------------------------------------ 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index d001ce4e02..d159c97b07 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,17 +23,15 @@ before_install: - nvm install 10.16 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.31.0 - - make tidy + - make dep before_script: - ci_scripts/create-ip-aliases.sh script: - - make lint - make build - - make test + - make check - make install-deps-ui - make lint-ui - make build-ui diff --git a/Makefile b/Makefile index 2dad7f231b..1f5a3062f9 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,6 @@ clean: ## Clean project: remove created binaries and apps install: ## Install `skywire-visor`, `skywire-cli`, `setup-node` ${OPTS} go install ${BUILD_OPTS} ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node - install-static: ## Install `skywire-visor`, `skywire-cli`, `setup-node` ${STATIC_OPTS} go install -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node @@ -104,14 +103,6 @@ lint-extra: ## Run linters with extra checks. # The govet version in golangci-lint is out of date and has spurious warnings, run it separately ${OPTS} go vet -all ./... -vendorcheck: ## Run vendorcheck - GO111MODULE=off vendorcheck ./internal/... - GO111MODULE=off vendorcheck ./pkg/... - GO111MODULE=off vendorcheck ./cmd/apps/... - GO111MODULE=off vendorcheck ./cmd/setup-node/... - 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/... @@ -119,16 +110,11 @@ test: ## Run tests install-linters: ## Install linters - VERSION=latest ./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 ${OPTS} go get -u github.com/incu6us/goimports-reviser tidy: ## Tidies and vendors dependencies. ${OPTS} go mod tidy -v - ${OPTS} go mod vendor -v format: tidy ## Formats the code. Must have goimports and goimports-reviser installed (use make install-linters). ${OPTS} goimports -w -local ${PROJECT_BASE} ./pkg @@ -136,7 +122,7 @@ format: tidy ## Formats the code. Must have goimports and goimports-reviser inst ${OPTS} goimports -w -local ${PROJECT_BASE} ./internal find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports-reviser -project-name ${PROJECT_BASE} -file-path {} \; -dep: ## Sorts dependencies +dep: tidy ## Sorts dependencies ${OPTS} go mod vendor -v host-apps: ## Build app @@ -166,26 +152,6 @@ bin-static: ## Build `skywire-visor`, `skywire-cli` ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./skywire-cli ./cmd/skywire-cli ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./setup-node ./cmd/setup-node -release: ## Build `skywire-visor`, `skywire-cli` and apps without -race flag - ${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 ./apps/skychat ./cmd/apps/skychat - ${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks ./cmd/apps/skysocks - ${OPTS} go build ${BUILD_OPTS} -o ./apps/skysocks-client ./cmd/apps/skysocks-client - ${OPTS} go build ${BUILD_OPTS} -o ./apps/vpn-server ./cmd/apps/vpn-server - ${OPTS} go build ${BUILD_OPTS} -o ./apps/vpn-client ./cmd/apps/vpn-client - -release-static: ## Build `skywire-visor`, `skywire-cli` and apps without -race flag - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./skywire-visor ./cmd/skywire-visor - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./skywire-cli ./cmd/skywire-cli - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./setup-node ./cmd/setup-node - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skychat ./cmd/apps/skychat - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skysocks ./cmd/apps/skysocks - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/skysocks-client ./cmd/apps/skysocks-client - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/vpn-server ./cmd/apps/vpn-server - ${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/vpn-client ./cmd/apps/vpn-client - build-deploy: ## Build for deployment Docker images ${OPTS} go build -tags netgo ${BUILD_OPTS_DEPLOY} -o /release/skywire-visor ./cmd/skywire-visor ${OPTS} go build ${BUILD_OPTS_DEPLOY} -o /release/skywire-cli ./cmd/skywire-cli @@ -259,7 +225,7 @@ docker-rerun: docker-stop ${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 +docker-run-syslog: ## Run syslog-ng in docker. Logs are mounted under /tmp/syslog -rm -rf /tmp/syslog -mkdir -p /tmp/syslog -docker container rm syslog-ng -f From fd281700799fca94d2e46bb46c55e0a6c8410a08 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Wed, 24 Mar 2021 20:54:06 +0300 Subject: [PATCH 5/7] Remove `config`, `run`, `rerun`, `stop` targets --- Makefile | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/Makefile b/Makefile index 1f5a3062f9..e6b64db72c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ .PHONY : check lint lint-extra install-linters dep test .PHONY : build clean install format bin .PHONY : host-apps bin -.PHONY : run stop config .PHONY : docker-image docker-clean docker-network .PHONY : docker-apps docker-bin docker-volume .PHONY : docker-run docker-stop @@ -57,15 +56,6 @@ build: host-apps bin ## Install dependencies, build apps and binaries. `go build build-static: host-apps-static bin-static ## Build apps and binaries. `go build` with ${OPTS} -run: ## Run skywire visor with skywire-config.json, and start a browser if running a hypervisor - ./skywire-visor -c ./skywire-config.json --launch-browser - -stop: ## Stop running skywire-visor on host - -bash -c "kill $$(ps aux |grep '[s]kywire-visor' | awk '{print $$2}')" - -config: ## Generate skywire-config.json - -./skywire-cli visor gen-config -o ./skywire-config.json -r --is-hypervisor - install-generate: ## Installs required execs for go generate. ${OPTS} go install github.com/mjibson/esc ${OPTS} go install github.com/vektra/mockery/cmd/mockery @@ -88,12 +78,6 @@ install: ## Install `skywire-visor`, `skywire-cli`, `setup-node` install-static: ## Install `skywire-visor`, `skywire-cli`, `setup-node` ${STATIC_OPTS} go install -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node -rerun: stop - ${OPTS} go build -race -o ./skywire-visor ./cmd/skywire-visor - -./skywire-cli visor gen-config -o ./skywire.json -r - perl -pi -e 's/localhost//g' ./skywire.json - ./skywire-visor skywire.json - 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 @@ -231,11 +215,5 @@ docker-run-syslog: ## Run syslog-ng in docker. Logs are mounted under /tmp/syslo -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 -mod-comm: ## Comments the 'replace' rule in go.mod - ./ci_scripts/go_mod_replace.sh comment go.mod - -mod-uncomm: ## Uncomments the 'replace' rule in go.mod - ./ci_scripts/go_mod_replace.sh uncomment go.mod - help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' From 0debff2eecf156c437892e7349a71339c671de7a Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Wed, 24 Mar 2021 21:03:49 +0300 Subject: [PATCH 6/7] Merge `*-static` targetsy --- Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Makefile b/Makefile index e6b64db72c..cf75c396bb 100644 --- a/Makefile +++ b/Makefile @@ -143,13 +143,6 @@ build-deploy: ## Build for deployment Docker images ${OPTS} go build ${BUILD_OPTS_DEPLOY} -o /release/apps/skysocks ./cmd/apps/skysocks ${OPTS} go build ${BUILD_OPTS_DEPLOY} -o /release/apps/skysocks-client ./cmd/apps/skysocks-client -build-deploy-static: ## Build for deployment Docker images - ${STATIC_OPTS} go build -tags netgo -trimpath --ldflags '-w -s -linkmode external -extldflags "-static" -buildid=' -o /release/skywire-visor ./cmd/skywire-visor - ${STATIC_OPTS} go build -trimpath --ldflags '-w -s -linkmode external -extldflags "-static" -buildid=' -o /release/skywire-cli ./cmd/skywire-cli - ${STATIC_OPTS} go build -trimpath --ldflags '-w -s -linkmode external -extldflags "-static" -buildid=' -o /release/apps/skychat ./cmd/apps/skychat - ${STATIC_OPTS} go build -trimpath --ldflags '-w -s -linkmode external -extldflags "-static" -buildid=' -o /release/apps/skysocks ./cmd/apps/skysocks - ${STATIC_OPTS} go build -trimpath --ldflags '-w -s -linkmode external -extldflags "-static" -buildid=' -o /release/apps/skysocks-client ./cmd/apps/skysocks-client - github-release: ## Create a GitHub release goreleaser --rm-dist From a29607898aa78f61dd1c714f394a050eebce4695 Mon Sep 17 00:00:00 2001 From: Sir Darkrengarius Date: Wed, 24 Mar 2021 21:20:33 +0300 Subject: [PATCH 7/7] Add `RACE_FLAG` env to be passed to build opts --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cf75c396bb..68812e4766 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,10 @@ DOCKER_OPTS?=GO111MODULE=on GOOS=linux # go options for compiling for docker con TEST_OPTS:=-cover -timeout=5m -mod=vendor -RACE_FLAG:=-race GOARCH:=$(shell go env GOARCH) ifneq (,$(findstring 64,$(GOARCH))) - TEST_OPTS:=$(TEST_OPTS) $(RACE_FLAG) + TEST_OPTS:=$(TEST_OPTS) -race endif BUILDINFO_PATH := $(DMSG_BASE)/buildinfo @@ -42,7 +41,7 @@ BUILDINFO_COMMIT := -X $(BUILDINFO_PATH).commit=$(COMMIT) BUILDINFO?=$(BUILDINFO_VERSION) $(BUILDINFO_DATE) $(BUILDINFO_COMMIT) -BUILD_OPTS?="-ldflags=$(BUILDINFO)" -mod=vendor +BUILD_OPTS?="-ldflags=$(BUILDINFO)" -mod=vendor $(RACE_FLAG) BUILD_OPTS_DEPLOY?="-ldflags=$(BUILDINFO) -w -s" check: lint test ## Run linters and tests