From ca418de16f809cd1240eb881a1b55f99e5a54764 Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Tue, 14 Apr 2020 00:04:38 +0300 Subject: [PATCH] +(global): windows travis build --- .travis.yml | 44 ++++++++++++++++++++++++++++++++++++++------ util/os_windows.go | 2 +- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57f4cbba..3cf8d23c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,14 +7,31 @@ go: os: - linux - osx + - windows before_install: - - nvm install node - - npm install -g npm - - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.23.8 + - |- + case $TRAVIS_OS_NAME in + linux | osx) + nvm install node + npm install -g npm + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.23.8 + ;; + windows) + choco install node + ;; + esac install: - - npm --prefix client ci + - |- + case $TRAVIS_OS_NAME in + linux | osx) + npm --prefix client ci + ;; + windows) + npm --prefix client ci + ;; + esac cache: directories: @@ -23,10 +40,23 @@ cache: - $HOME/Library/Caches/go-build script: - - /bin/bash ci.sh + - |- + case $TRAVIS_OS_NAME in + linux | osx) + /bin/bash ci.sh + ;; + windows) + go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./... + ;; + esac after_success: - - bash <(curl -s https://codecov.io/bash) + - |- + case $TRAVIS_OS_NAME in + linux) + bash <(curl -s https://codecov.io/bash) + ;; + esac notifications: slack: performix:yXTihlSzsLFSZiqbXMNzvTSX @@ -60,6 +90,8 @@ matrix: file_glob: true skip_cleanup: true + # Docker build configuration + - if: repo = AdguardTeam/AdGuardHome - name: docker if: type != pull_request AND (branch = master OR tag IS present) AND repo = AdguardTeam/AdGuardHome go: diff --git a/util/os_windows.go b/util/os_windows.go index 1c09e588..2a3742fa 100644 --- a/util/os_windows.go +++ b/util/os_windows.go @@ -13,7 +13,7 @@ func SetRlimit(val uint) { func HaveAdminRights() (bool, error) { var token windows.Token - h, _ := windows.GetCurrentProcess() + h := windows.CurrentProcess() err := windows.OpenProcessToken(h, windows.TOKEN_QUERY, &token) if err != nil { return false, err