-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-binary-template.yml
54 lines (54 loc) · 1.71 KB
/
build-binary-template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
parameters:
poolImage: 'macOS-latest'
targetOS: 'darwin'
targetArch: 'amd64'
dependStep: 'release_environment'
relVersion: ''
jobs:
- job: build_${{ parameters.targetOS }}_${{ parameters.targetArch }}
dependsOn:
${{ parameters.dependStep }}
variables:
GOOS: ${{ parameters.targetOS }}
GOARCH: ${{ parameters.targetArch }}
REL_VERSION: ${{ parameters.relVersion }}
GOPROXY: https://proxy.golang.org
pool:
vmImage: '${{ parameters.poolImage }}'
steps:
- task: GoTool@0
displayName: 'Install Go'
inputs:
version: '1.12'
- task: Bash@3
displayName: 'Set up the Go workspace'
inputs:
targetType: 'inline'
script: |
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(modulePath)'
shopt -s extglob
mv !(gopath) '$(modulePath)'
echo '##vso[task.prependpath]$(GOBIN)'
- task: CmdLine@2
displayName: 'Run make test'
condition: ne('${{ parameters.targetArch }}', 'arm')
inputs:
script: 'make test'
workingDirectory: '$(modulePath)'
failOnStderr: false
- task: CmdLine@2
displayName: 'Run make release to build and archive binaries'
inputs:
script: 'make release GOOS=${{ parameters.targetOS }} GOARCH=${{ parameters.targetArch }} ARCHIVE_OUT_DIR=$(Build.ArtifactStagingDirectory)'
workingDirectory: '$(modulePath)'
failOnStderr: false
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
parallel: true,
parallelCount: 8
publishLocation: 'Container'