github.com/zaolin/u-root@v0.0.0-20200428085104-64aaafd46c6d/azure-pipelines.yml (about)

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