-
Notifications
You must be signed in to change notification settings - Fork 26
/
azure-pipelines.yml
59 lines (50 loc) · 1.5 KB
/
azure-pipelines.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
55
56
57
58
59
# Go
# Build your Go project.
# Add steps that test, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/go
trigger:
#- master
- feature/*
#pr:
#- master
pool:
vmImage: 'ubuntu-latest'
variables:
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path
GOBIN: '$(GOPATH)/bin' # Go binaries path
PLUGIN_DIR: '$(GOBIN)'
modulePath: '$(GOPATH)/src/hello' # Path to the module's code
steps:
- script: |
echo "GOBIN $(GOBIN)"
echo "GOPATH $(GOPATH)"
echo "REPO PATH $(GOPATH)/src/github.com/$(build.repository.name)"
mkdir -p '$(GOPATH)'
mkdir -p '$(GOBIN)'
mkdir -p '$(GOPATH)/pkg'
mkdir -p '$(modulePath)'
echo "Moving $(system.defaultWorkingDirectory)/* To $(modulePath)"
mv $(system.defaultWorkingDirectory)/* $(modulePath)
shopt -s extglob
shopt -s dotglob
echo '##vso[task.prependpath]$(GOBIN)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
displayName: 'Set up the Go workspace'
- script: |
go version
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
else
echo "ERROR no Gopkg.toml found!"
exit 1
fi
go install hello/src/hello
workingDirectory: '$(GOPATH)/src/hello'
displayName: 'Get dependencies, then build'
- script: |
$(GOBIN)/hello &
PS=`ps -ef |grep hello |grep -v grep |awk '{print $2}'`
echo "hello $PS"
curl http://localhost:8000/status
kill -9 $PS