Skip to content

Commit

Permalink
Update azure-pipelines.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
apudovkin-ms authored Aug 22, 2024
1 parent c9e5fa0 commit e1016eb
Showing 1 changed file with 18 additions and 36 deletions.
54 changes: 18 additions & 36 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,21 @@ trigger:
pool:
vmImage: 'ubuntu-latest'

variables:
GOBIN: '$(GOPATH)/bin' # Go binaries path
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code

steps:
- script: |
printenv | sort
displayName: 'Log Environment Variables'

- script: |
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
shopt -s extglob
shopt -s dotglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
displayName: 'Set up the Go workspace'

- script: |
go version
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
go build -v ./...
workingDirectory: '$(modulePath)'
displayName: 'Get dependencies, then build'

- script: |
go test ./...
workingDirectory: '$(modulePath)'
displayName: 'Run unit tests'
steps:
- task: GoTool@0
inputs:
version: '1.13.5'
- task: Go@0
inputs:
command: 'get'
arguments: '-d'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go@0
inputs:
command: 'build'
workingDirectory: '$(System.DefaultWorkingDirectory)'
- task: Go@0
inputs:
command: 'test'
arguments: '-v'
workingDirectory: '$(System.DefaultWorkingDirectory)'

0 comments on commit e1016eb

Please sign in to comment.