This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
build_gocd.sh
executable file
·86 lines (73 loc) · 2.37 KB
/
build_gocd.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
#
# Copyright 2016 ThoughtWorks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License..
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set +x
set -e
if [[ -f var ]]; then
. vars
fi
BUILD_DIR=$(pwd)
export GOPATH=$BUILD_DIR
export GOBIN=$GOPATH/bin
#
# Pull dependencies
#
echo "================"
echo "Get dependencies"
echo "================"
echo ""
echo "------------------------------"
echo "Get golang.org/x/net/websocket"
go get -u golang.org/x/net/websocket
echo "---------------------"
echo "Get golang.org/x/text"
go get -u golang.org/x/text
echo "---------------------------"
echo "Get golang.org/x/crypto/ssh"
go get -u golang.org/x/crypto/ssh
echo "---------------------------"
echo "Get github.com/satori/go.uuid"
go get -u github.com/satori/go.uuid
echo "---------------------------"
echo "Get github.com/xli/assert"
go get -u github.com/xli/assert
echo "---------------------------"
echo "Get github.com/bmatcuk/doublestar"
go get -u github.com/bmatcuk/doublestar
#
# Running Test and generate Test Report
#
echo "---------------------------"
echo "Get github.com/jstemmer/go-junit-report"
if [[ -f $GOPATH/bin/go-junit-report ]]; then
echo "Remove binary : $GOPATH/bin/go-junit-report"
rm -rf $GOPATH/bin/go-junit-report
fi
go get -u github.com/jstemmer/go-junit-report
if [[ -f testreport.xml ]]; then
echo "Remove old test report : testreport.xml"
/bin/rm -rf testreport.xml
fi
go test -test.v github.com/gocd-contrib/gocd-golang-agent... | $GOPATH/bin/go-junit-report > testreport.xml
# Go Build !!
/bin/rm -rf output
/bin/mkdir output
echo "===================="
echo "Start building gocd-golang-agent for linux"
CGO_ENABLED=0 GOOS=linux go build -a -o output/gocd-golang-agent_linux_x86 github.com/gocd-contrib/gocd-golang-agent
echo "===================="
echo "Start building gocd-golang-agent for OSX"
CGO_ENABLED=0 GOOS=darwin go build -a -o output/gocd-golang-agent_darwin_x86 github.com/gocd-contrib/gocd-golang-agent