This repository has been archived by the owner on Feb 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathwercker.yml
66 lines (56 loc) · 2.06 KB
/
wercker.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
60
61
62
63
64
65
66
box: golang:1.8
no-response-timeout: 15
build:
base-path: /go/src/github.com/oracle/smith
steps:
- script:
name: install govendor
code: go get -u github.com/kardianos/govendor
- script:
name: go vet
code: govendor vet +local
# golint is a little to strict
# - golint:
# exclude: vendor
- script:
name: go test
code: govendor test +local
- script:
name: clear out the build binaries
code: rm -rf $GOPATH/pkg
- script:
name: decide version
code: |
# the prefix for version tags. This could be "v", "release-", or ""
# depending on the repository
export VERPREFIX="v"
# the full glob for the version. This may need to be shortened if
# the repository has fewer parts to its version numbers.
export VERGLOB=$VERPREFIX*.*.*
export VERSION=$(git describe --tags --match "$VERGLOB" | tr -d " \n")
export VERSION=${VERSION#$VERPREFIX}
export REALV=${VERSION%%-*}
if [ "$REALV" != "$VERSION" ]; then
export COMMITS=${VERSION#*-}
export COMMITS=${COMMITS%%-*}
export VERSION=${REALV}.${COMMITS}.$(git rev-parse --short HEAD | tr -d " \n")
fi
- script:
name: compile
code: |
export CGO_ENABLED=0
export ID=$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')
GOOS=linux GOARCH=amd64 go build \
-ldflags="-X main.ver=${VERSION} -X main.sha=${WERCKER_GIT_COMMIT} -B 0x${ID}" \
-o "$WERCKER_OUTPUT_DIR/artifacts/latest/linux_amd64/smith"
cp -r $WERCKER_OUTPUT_DIR/artifacts/latest/* $WERCKER_REPORT_ARTIFACTS_DIR
# generate SHA's for all binaries
- script:
name: generate SHAs
code: |
cd $WERCKER_OUTPUT_DIR
for f in $(find . -type f -name smith); do
cd $WERCKER_OUTPUT_DIR/$(dirname "$f")
sha256sum smith > SHA256SUMS
done
cd $WERCKER_OUTPUT_DIR