forked from dynport/dgtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins.sh
40 lines (31 loc) · 1009 Bytes
/
jenkins.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
#!/bin/bash
set -e
export GOROOT=${GOROOT:-/usr/local/go1.4.3}
if [[ -n $WORKSPACE ]]; then
export GOPATH=$WORKSPACE
fi
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH/
export DYNPORT_GO_PATH=$GOPATH/src/github.com/dynport
mkdir -p $DYNPORT_GO_PATH $WORKSPACE/bin
pushd $DYNPORT_GO_PATH/dgtk
go get -d ./...
make ego
go test ./...
go vet ./...
d=$(mktemp -d /tmp/build-XXXX)
info=$(bash ./build_info.sh)
if [[ -z $info ]]; then
echo "info must not be blank"
exit 1
fi
for os in darwin linux; do
for name in wunderproxy/wunderproxy wunderproxy/wunderstatus; do
echo "building $name with os $os"
GOOS=$os go build -ldflags "-X main.BUILD_INFO $info" -o $d/${os}_amd64/$(basename $name) github.com/dynport/dgtk/$name
done
done
if [[ -n $GIT_COMMIT && -n $JOB_NAME && -n $BUILDS_BUCKET ]]; then
aws s3 sync --delete $d/ s3://${BUILDS_BUCKET}/builds/${JOB_NAME}/$GIT_COMMIT/
echo $info > $d/current.json
aws s3 cp $d/current.json s3://${BUILDS_BUCKET}/builds/${JOB_NAME}/current.json
fi