Skip to content

Commit

Permalink
enable build and test on linux (#421)
Browse files Browse the repository at this point in the history
* enable build and test on linux

* fail on first error and use portable std*

* update test to run on devops
  • Loading branch information
jhendrixMSFT authored Jul 9, 2019
1 parent c35c12c commit 95dd057
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autorest/adal/persist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestSaveTokenFailsNoPermission(t *testing.T) {
}

func TestSaveTokenFailsCantCreate(t *testing.T) {
tokenPath := "/thiswontwork"
tokenPath := "/usr/thiswontwork"
if runtime.GOOS == "windows" {
tokenPath = path.Join(os.Getenv("windir"), "system32")
}
Expand Down
40 changes: 40 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,43 @@ pool:

trigger:
- master

variables:
GOROOT: '/usr/local/go1.12'
GOPATH: '$(system.defaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/$(build.repository.name)'

steps:
- script: |
set -e
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
- script: |
set -e
curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure -v
go install ./vendor/golang.org/x/lint/golint
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: |
set -e
grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2 | test -z "$(<&0)"
test -z "$(gofmt -s -l -w ./autorest/. | tee >&2)"
test -z "$(golint ./autorest/... | tee >&2)"
workingDirectory: '$(sdkPath)'
displayName: 'Formatting and Linting'
- script: |
set -e
go vet ./autorest/...
go build -v ./autorest/...
workingDirectory: '$(sdkPath)'
displayName: 'Vet and Build'
- script: |
go test -race -v ./autorest/...
workingDirectory: '$(sdkPath)'
displayName: 'Run Tests'

0 comments on commit 95dd057

Please sign in to comment.