|
1 | | -# Build your Go project. |
2 | | -# Add steps that test, save build artifacts, deploy, and more: |
3 | | -# https://docs.microsoft.com/azure/devops/pipelines/languages/go |
4 | | - |
5 | 1 | trigger: |
6 | | -- master |
| 2 | + branches: |
| 3 | + include: |
| 4 | + - master |
7 | 5 |
|
8 | | -pool: |
9 | | - vmImage: 'ubuntu-latest' |
| 6 | +pr: |
| 7 | + branches: |
| 8 | + include: |
| 9 | + - master |
10 | 10 |
|
11 | 11 | variables: |
12 | | - GOBIN: '$(GOPATH)/bin' # Go binaries path |
13 | | - GOROOT: '/usr/local/go1.11' # Go installation path |
14 | | - GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path |
15 | | - modulePath: '$(GOPATH)/src/github.com/$(build.repository.name)' # Path to the module's code |
| 12 | + ExecutableName: 'arduino-language-server' |
| 13 | + |
| 14 | +jobs: |
| 15 | + - job: Linux_Build |
| 16 | + pool: |
| 17 | + vmImage: 'ubuntu-16.04' |
| 18 | + steps: |
| 19 | + - task: GoTool@0 |
| 20 | + inputs: |
| 21 | + version: '1.12' |
| 22 | + - script: | |
| 23 | + go build -o "$(Build.ArtifactStagingDirectory)/$(ExecutableName)_linux_amd64" |
| 24 | + go test ./... |
| 25 | + displayName: 'Generate builds' |
| 26 | + - task: PublishBuildArtifacts@1 |
| 27 | + displayName: 'Publish Artifacts' |
| 28 | + condition: succeededOrFailed() |
16 | 29 |
|
17 | | -steps: |
18 | | -- script: | |
19 | | - mkdir -p '$(GOBIN)' |
20 | | - mkdir -p '$(GOPATH)/pkg' |
21 | | - mkdir -p '$(modulePath)' |
22 | | - shopt -s extglob |
23 | | - shopt -s dotglob |
24 | | - mv !(gopath) '$(modulePath)' |
25 | | - echo '##vso[task.prependpath]$(GOBIN)' |
26 | | - echo '##vso[task.prependpath]$(GOROOT)/bin' |
27 | | - displayName: 'Set up the Go workspace' |
| 30 | + - job: MacOS_Build |
| 31 | + pool: |
| 32 | + vmImage: 'xcode9-macos10.13' |
| 33 | + steps: |
| 34 | + - task: GoTool@0 |
| 35 | + inputs: |
| 36 | + version: '1.12' |
| 37 | + - script: | |
| 38 | + go build -o "$(Build.ArtifactStagingDirectory)/$(ExecutableName)_darwin_amd64" |
| 39 | + go test ./... |
| 40 | + displayName: 'Generate builds' |
| 41 | + - task: PublishBuildArtifacts@1 |
| 42 | + displayName: 'Publish Artifacts' |
| 43 | + condition: succeededOrFailed() |
28 | 44 |
|
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 test ./... |
37 | | - go build -v . |
38 | | - workingDirectory: '$(modulePath)' |
39 | | - displayName: 'Get dependencies, then build' |
| 45 | + - job: Windows_Build |
| 46 | + pool: |
| 47 | + vmImage: 'vs2017-win2016' |
| 48 | + steps: |
| 49 | + - task: GoTool@0 |
| 50 | + inputs: |
| 51 | + version: '1.12' |
| 52 | + - script: | |
| 53 | + go build -o "$(Build.ArtifactStagingDirectory)/$(ExecutableName)_windows_amd64.exe" |
| 54 | + go test ./... |
| 55 | + displayName: 'Generate builds' |
| 56 | + - task: PublishBuildArtifacts@1 |
| 57 | + displayName: 'Publish Artifacts' |
| 58 | + condition: succeededOrFailed() |
0 commit comments