...
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
6trigger:
7- master
8
9pool:
10 vmImage: 'Ubuntu-16.04'
11
12variables:
13 GOBIN: '$(GOPATH)/bin' # Go binaries path
14 GOROOT: '/usr/local/go1.11' # Go installation path
15 GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
16 modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code
17
18steps:
19- script: |
20 mkdir -p '$(GOBIN)'
21 mkdir -p '$(GOPATH)/pkg'
22 mkdir -p '$(modulePath)'
23 shopt -s extglob
24 shopt -s dotglob
25 mv !(gopath) '$(modulePath)'
26 echo '##vso[task.prependpath]$(GOBIN)'
27 echo '##vso[task.prependpath]$(GOROOT)/bin'
28 displayName: 'Set up the Go workspace'
29
30- script: |
31 go version
32 go get -v -t -d ./...
33 if [ -f Gopkg.toml ]; then
34 curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
35 dep ensure
36 fi
37 go build -v .
38 workingDirectory: '$(modulePath)'
39 displayName: 'Get dependencies, then build'
View as plain text