-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows build #779
Windows build #779
Changes from all commits
7ba4a95
6733324
895d4a8
7f1d35d
5dd3f81
cb0ca00
2b34341
234013a
fd9df42
0a2b000
83b2de6
8c0ff8c
f7eb368
49ab591
30dbf40
8e00ff3
6365ab1
0283e59
5257972
9bf21a9
761f2b1
48d6bdc
1a2ca5c
b91455d
db8d9de
b8d4cf8
752e488
5ef1d23
da18891
5360164
d3a1055
23d671d
a03438a
bd7acc9
215bbd0
12dd99e
852a7a9
1b1b417
f30408e
080acfb
514fa4e
fd1068d
4095a69
9d1ae67
74d9e93
2243e39
3cb9998
5541ce4
67b16a3
5e9843c
62a261b
b74d4d0
c2f146f
12d0138
549c296
d2d5f5d
5eac2fd
c598093
07ba357
ea0b8e0
a27ae50
0fb18e5
2fd4638
7c1471c
ba2678c
3aaa550
a21c0c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,32 @@ environment: | |
appveyor_build_worker_image: ubuntu1804 | ||
GOARCH: amd64 | ||
- job_name: MacOS | ||
appveyor_build_worker_image: macos | ||
appveyor_build_worker_image: macos-bigsur | ||
GOARCH: amd64 | ||
- job_name: Windows | ||
appveyor_build_worker_image: Visual Studio 2019 | ||
GOARCH: amd64 | ||
|
||
# For release, by pushing tag | ||
- job_name: linux-amd64 | ||
appveyor_build_worker_image: ubuntu2004 | ||
GOARCH: amd64 | ||
- job_name: linux-arm | ||
appveyor_build_worker_image: ubuntu2004 | ||
GOARCH: arm | ||
- job_name: linux-arm64 | ||
appveyor_build_worker_image: ubuntu2004 | ||
GOARCH: arm64 | ||
- job_name: linux-386 | ||
appveyor_build_worker_image: ubuntu2004 | ||
GOARCH: 386 | ||
- job_name: darwin-amd64 | ||
appveyor_build_worker_image: macos | ||
GOARCH: amd64 | ||
- job_name: windows-amd64 | ||
appveyor_build_worker_image: Visual Studio 2019 | ||
GOARCH: amd64 | ||
|
||
for: | ||
- # Linux and MacOS | ||
skip_tags: true | ||
|
@@ -43,12 +66,68 @@ for: | |
|
||
install: | ||
- choco install make | ||
- go get github.com/golangci/golangci-lint/cmd/[email protected] | ||
- go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
- make dep | ||
|
||
- make install-deps-ui | ||
- set PATH=C:\Users\appveyor\go\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH% | ||
|
||
before_build: | ||
- set GO111MODULE=on | ||
- make check-windows-appveyor | ||
- make check-windows | ||
- make lint-ui | ||
|
||
build_script: | ||
- make build-windows | ||
- make build-ui-windows | ||
|
||
- # Linux and MacOS (Release) | ||
skip_non_tags: true | ||
matrix: | ||
only: | ||
- job_name: linux-arm | ||
- job_name: linux-arm64 | ||
- job_name: linux-amd64 | ||
- job_name: linux-386 | ||
- job_name: darwin-amd64 | ||
|
||
install: | ||
- make dep | ||
- ci_scripts/create-ip-aliases.sh | ||
- export GOARM=7 | ||
|
||
build_script: | ||
- make build | ||
|
||
after_build: | ||
- tar -cvzf skywire-$APPVEYOR_REPO_TAG_NAME-$APPVEYOR_JOB_NAME.tar.gz ./apps/* ./skywire-visor ./skywire-cli ./setup-node | ||
|
||
artifacts: | ||
- path: skywire-$(APPVEYOR_REPO_TAG_NAME)-$(APPVEYOR_JOB_NAME).tar.gz | ||
name: deploy | ||
|
||
deploy: | ||
- provider: GitHub | ||
release: $(APPVEYOR_REPO_TAG_NAME) | ||
auth_token: | ||
secure: ZrbNBE2wSfGvHzEq5GqEAUmNy7myDIl7KK05CKlZdQfieV7XdIAPXpkdHNEyZbvT | ||
draft: true | ||
artifact: deploy | ||
on: | ||
APPVEYOR_REPO_TAG: true | ||
|
||
- # Windows (Release) | ||
skip_non_tags: true | ||
matrix: | ||
only: | ||
- job_name: windows-amd64 | ||
|
||
environment: | ||
matrix: | ||
- GOARCH: amd64 | ||
|
||
install: | ||
- cmd: choco install make | ||
- make dep | ||
|
||
build_script: | ||
- make build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
.PHONY : check lint install-linters dep test | ||
.PHONY : build clean install format bin | ||
|
@@ -7,18 +6,26 @@ | |
.PHONY : docker-apps docker-bin docker-volume | ||
.PHONY : docker-run docker-stop | ||
|
||
SHELL := /bin/bash | ||
VERSION ?= $(shell git describe 2> /dev/null) | ||
#VERSION := v0.1.0 # for debugging updater | ||
|
||
VERSION := $(shell git describe) | ||
RFC_3339 := "+%Y-%m-%dT%H:%M:%SZ" | ||
DATE := $(shell date -u $(RFC_3339)) | ||
COMMIT ?= $(shell git rev-list -1 HEAD 2> /dev/null) | ||
COMMIT := $(shell git rev-list -1 HEAD) | ||
BRANCH := latest | ||
|
||
|
||
PROJECT_BASE := github.com/skycoin/skywire | ||
DMSG_BASE := github.com/skycoin/dmsg | ||
OPTS?=GO111MODULE=on | ||
ifeq ($(OS),Windows_NT) | ||
SHELL := pwsh | ||
OPTS?=powershell -Command setx GO111MODULE on; | ||
DATE := $(shell powershell -Command date -u ${RFC_3339}) | ||
.DEFAULT_GOAL := help-windows | ||
else | ||
SHELL := /bin/bash | ||
OPTS?=GO111MODULE=on | ||
DATE := $(shell date -u $(RFC_3339)) | ||
.DEFAULT_GOAL := help | ||
endif | ||
|
||
STATIC_OPTS?= $(OPTS) CC=musl-gcc | ||
MANAGER_UI_DIR = static/skywire-manager-src | ||
GO_BUILDER_VERSION=v1.17 | ||
|
@@ -46,10 +53,16 @@ BUILD_OPTS_DEPLOY?="-ldflags=$(BUILDINFO) -w -s" | |
|
||
check: lint test ## Run linters and tests | ||
|
||
check-windows: lint-windows test-windows ## Run linters and tests on appveyor windows image | ||
|
||
build: host-apps bin ## Install dependencies, build apps and binaries. `go build` with ${OPTS} | ||
|
||
build-windows: host-apps-windows bin-windows ## Install dependencies, build apps and binaries. `go build` with ${OPTS} | ||
|
||
build-systray: host-apps-systray bin-systray ## Install dependencies, build apps and binaries `go build` with ${OPTS}, with CGO and systray | ||
|
||
build-systray-windows: host-apps-systray-windows bin-systray-windows ## Builds systray binary in windows | ||
|
||
build-static: host-apps-static bin-static ## Build apps and binaries. `go build` with ${OPTS} | ||
|
||
installer: mac-installer ## Builds MacOS installer for skywire-visor | ||
|
@@ -65,24 +78,46 @@ clean: ## Clean project: remove created binaries and apps | |
-rm -rf ./apps | ||
-rm -f ./skywire-visor ./skywire-cli ./setup-node | ||
|
||
clean-windows: ## Clean project: remove created binaries and apps | ||
powershell -Command Remove-Item -Path ./apps -Force -Recurse | ||
powershell -Command Remove-Item -Path .\skywire-visor.exe,.\skywire-cli.exe,.\setup-node.exe -Force | ||
|
||
install: ## Install `skywire-visor`, `skywire-cli`, `setup-node` | ||
${OPTS} go install ${BUILD_OPTS} ./cmd/skywire-visor ./cmd/skywire-cli ./cmd/setup-node | ||
|
||
install-windows: ## Install `skywire-visor`, `skywire-cli`, `setup-node` | ||
powershell 'Get-ChildItem .\cmd | % { ${OPTS} go install ${BUILD_OPTS} ./ $$_.FullName }' | ||
|
||
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 | ||
|
||
lint: ## Run linters. Use make install-linters first | ||
${OPTS} golangci-lint run -c .golangci.yml ./... | ||
|
||
lint-windows: ## Run linters. Use make install-linters-windows first | ||
powershell 'golangci-lint run -c .golangci.yml ./...' | ||
|
||
lint-appveyor-windows: ## Run linters for appveyor only on windows | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is giving an error
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you tried to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and you should've run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay. Was just testing all the commands. Everything else works then. |
||
C:\Users\appveyor\go\bin\golangci-lint run -c .golangci.yml ./... | ||
|
||
test: ## Run tests | ||
-go clean -testcache &>/dev/null | ||
${OPTS} go test ${TEST_OPTS} ./internal/... | ||
${OPTS} go test ${TEST_OPTS} ./pkg/... | ||
|
||
test-windows: ## Run tests on windows | ||
@go clean -testcache | ||
${OPTS} go test ${TEST_OPTS} ./internal/... | ||
${OPTS} go test ${TEST_OPTS} ./pkg/... | ||
|
||
install-linters: ## Install linters | ||
- VERSION=latest ./ci_scripts/install-golangci-lint.sh | ||
${OPTS} go get -u golang.org/x/tools/cmd/goimports | ||
${OPTS} go get -u github.com/incu6us/goimports-reviser/v2 | ||
${OPTS} go install golang.org/x/tools/cmd/goimports@latest | ||
${OPTS} go install github.com/incu6us/goimports-reviser/v2@latest | ||
|
||
install-linters-windows: ## Install linters | ||
${OPTS} go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
${OPTS} go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
tidy: ## Tidies and vendors dependencies. | ||
${OPTS} go mod tidy -v | ||
|
@@ -93,6 +128,9 @@ 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 "./.git/*" -not -path "./vendor/*" -exec goimports-reviser -project-name ${PROJECT_BASE} -file-path {} \; | ||
|
||
format-windows: tidy ## Formats the code. Must have goimports and goimports-reviser installed (use make install-linters). | ||
powershell 'Get-ChildItem -Directory | where Name -NotMatch vendor | % { Get-ChildItem $$_ -Recurse -Include *.go } | % {goimports -w -local ${PROJECT_BASE} $$_ }' | ||
|
||
dep: tidy ## Sorts dependencies | ||
${OPTS} go mod vendor -v | ||
|
||
|
@@ -103,11 +141,16 @@ snapshot-clean: ## Cleans snapshot / release | |
rm -rf ./dist | ||
|
||
host-apps: ## Build app | ||
${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 | ||
mkdir -p ./apps | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skychat | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skysocks | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/skysocks-client | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/vpn-server | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/ ./cmd/apps/vpn-client | ||
|
||
host-apps-windows: | ||
powershell -Command new-item .\apps -itemtype directory -force | ||
powershell 'Get-ChildItem .\cmd\apps | % { ${OPTS} go build ${BUILD_OPTS} -o ./apps $$_.FullName }' | ||
|
||
host-apps-systray: ## Build app | ||
${OPTS} go build ${BUILD_OPTS} -o ./apps/skychat ./cmd/apps/skychat | ||
|
@@ -116,21 +159,36 @@ host-apps-systray: ## Build app | |
${OPTS} go build ${BUILD_OPTS} -tags systray -o ./apps/vpn-server ./cmd/apps/vpn-server | ||
${OPTS} go build ${BUILD_OPTS} -tags systray -o ./apps/vpn-client ./cmd/apps/vpn-client | ||
|
||
host-apps-systray-windows: | ||
powershell -Command new-item .\apps -itemtype directory -force | ||
powershell 'go build ${BUILD_OPTS} -o .\apps\skychat .\cmd\apps\skychat' | ||
powershell 'go build ${BUILD_OPTS} -o .\apps\skysocks .\cmd\apps\skysocks' | ||
powershell 'go build ${BUILD_OPTS} -o .\apps\skysocks-client .\cmd\apps\skysocks-client' | ||
powershell 'go build ${BUILD_OPTS} -tags systray -o .\apps\vpn-server .\cmd\apps\vpn-server' | ||
powershell 'go build ${BUILD_OPTS} -tags systray -o .\apps\vpn-client .\cmd\apps\vpn-client' | ||
|
||
# Static Apps | ||
host-apps-static: ## Build app | ||
${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 | ||
mkdir -p ./apps | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skychat | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skysocks | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/skysocks-client | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/vpn-server | ||
${STATIC_OPTS} go build -trimpath --ldflags '-linkmode external -extldflags "-static" -buildid=' -o ./apps/ ./cmd/apps/vpn-client | ||
|
||
# Bin | ||
bin: ## Build `skywire-visor`, `skywire-cli` | ||
${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 ./ ./cmd/skywire-visor | ||
${OPTS} go build ${BUILD_OPTS} -o ./ ./cmd/skywire-cli | ||
${OPTS} go build ${BUILD_OPTS} -o ./ ./cmd/setup-node | ||
|
||
bin-windows: ## Build `skywire-visor`, `skywire-cli` | ||
powershell 'Get-ChildItem .\cmd | % { ${OPTS} go build ${BUILD_OPTS} -o ./ $$_.FullName }' | ||
|
||
bin-systray-windows: ## Build `skywire-visor` and `skywire-cli` with systray support | ||
powershell 'Get-ChildItem .\cmd | % { ${OPTS} go build ${BUILD_OPTS} -tags systray -o ./ $$_.FullName }' | ||
|
||
bin-systray: | ||
bin-systray: ## Build `skywire-visor`, `skywire-cli` | ||
${OPTS} go build ${BUILD_OPTS} -tags systray -o ./skywire-visor ./cmd/skywire-visor | ||
${OPTS} go build ${BUILD_OPTS} -tags systray -o ./skywire-cli ./cmd/skywire-cli | ||
${OPTS} go build ${BUILD_OPTS} -o ./setup-node ./cmd/setup-node | ||
|
@@ -174,6 +232,12 @@ build-ui: install-deps-ui ## Builds the UI | |
mkdir ${MANAGER_UI_BUILT_DIR} | ||
cp -r ${MANAGER_UI_DIR}/dist/. ${MANAGER_UI_BUILT_DIR} | ||
|
||
build-ui-windows: install-deps-ui ## Builds the UI on windows | ||
cd $(MANAGER_UI_DIR) && npm run build | ||
powershell 'Remove-Item -Recurse -Force -Path ${MANAGER_UI_BUILT_DIR}' | ||
powershell 'New-Item -Path ${MANAGER_UI_BUILT_DIR} -ItemType Directory' | ||
powershell 'Copy-Item -Recurse ${MANAGER_UI_DIR}\dist\* ${MANAGER_UI_BUILT_DIR}' | ||
|
||
deb-install-prequisites: ## Create unsigned application | ||
sudo chmod +x ./scripts/deb_installer/prequisites.sh | ||
./scripts/deb_installer/prequisites.sh | ||
|
@@ -192,3 +256,6 @@ mac-installer-help: ## Show installer creation help | |
|
||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
help-windows: ## Display help for windows | ||
@powershell 'Select-String -Pattern "windows[a-zA-Z_-]*:.*## .*$$" $(MAKEFILE_LIST) | % { $$_.Line -split ":.*?## " -Join "`t:`t" } ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use
DATE := $(shell date -u $(RFC_3339))
inside the else.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's already a DATE variable defined above, so no need to define it twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, what I meant was that
DATE := $(shell date -u $(RFC_3339))
should be inside the else statement asmake
isn't working in windows if it is outside.