azure-pipelines.yml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Go
  2. # Build your Go project.
  3. # Add steps that test, save build artifacts, deploy, and more:
  4. # https://docs.microsoft.com/azure/devops/pipelines/languages/go
  5. trigger:
  6. - master
  7. pool:
  8. vmImage: 'Ubuntu-16.04'
  9. variables:
  10. GOBIN: '$(GOPATH)/bin' # Go binaries path
  11. GOROOT: '/usr/local/go1.11' # Go installation path
  12. GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
  13. modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
  14. steps:
  15. - script: |
  16. mkdir -p '$(GOBIN)'
  17. mkdir -p '$(GOPATH)/pkg'
  18. mkdir -p '$(modulePath)'
  19. shopt -s extglob
  20. shopt -s dotglob
  21. mv !(gopath) '$(modulePath)'
  22. echo '##vso[task.prependpath]$(GOBIN)'
  23. echo '##vso[task.prependpath]$(GOROOT)/bin'
  24. displayName: 'Set up the Go workspace'
  25. - script: |
  26. go version
  27. go get -v -t -d ./...
  28. if [ -f Gopkg.toml ]; then
  29. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  30. dep ensure
  31. fi
  32. go build -v .
  33. workingDirectory: '$(modulePath)'
  34. displayName: 'Get dependencies, then build'