forked from vmware-tanzu-labs/cf-mgmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
118 lines (105 loc) · 3.64 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
box: golang
services:
- name: ldap
id: cwashburn/ldap
build:
# The steps that will be executed on build
steps:
- script:
name: env
code: env
# Sets the go workspace and places you package
# at the right place in the workspace tree
- setup-go-workspace
# Get the dependencies
- script:
name: go get
code: |
export GLIDE_VERSION=v0.12.3
cd $WERCKER_SOURCE_DIR
go version
wget https://github.com/Masterminds/glide/releases/download/$GLIDE_VERSION/glide-$GLIDE_VERSION-linux-amd64.tar.gz
tar xvzf glide-$GLIDE_VERSION-linux-amd64.tar.gz
export PATH=./linux-amd64:$PATH
export PATH=$WERCKER_SOURCE_DIR/bin:$PATH
glide install
# Test the project
- script:
name: go test
code: |
LOG_LEVEL=debug RUN_LDAP_TESTS=true go test $(glide novendor) -v -cover -race
crosscompile:
steps:
- setup-go-workspace
# Get the dependencies
- script:
name: go get
code: |
export GLIDE_VERSION=v0.12.3
cd $WERCKER_SOURCE_DIR
go version
wget https://github.com/Masterminds/glide/releases/download/$GLIDE_VERSION/glide-$GLIDE_VERSION-linux-amd64.tar.gz
tar xvzf glide-$GLIDE_VERSION-linux-amd64.tar.gz
export PATH=./linux-amd64:$PATH
export PATH=$WERCKER_SOURCE_DIR/bin:$PATH
glide install
- script:
name: set release id variable and version
code: |
go get github.com/xchapter7x/versioning
export NEXT_VERSION=`versioning bump_patch`-`git rev-parse HEAD | cut -c1-6`
echo "next version should be: ${NEXT_VERSION}"
- script:
name: cross platform release
code: |
(CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cf-mgmt-linux -ldflags "-X main.VERSION=${NEXT_VERSION}")
(GOOS=darwin GOARCH=amd64 go build -o cf-mgmt-osx -ldflags "-X main.VERSION=${NEXT_VERSION}")
(GOOS=windows GOARCH=amd64 go build -o cf-mgmt.exe -ldflags "-X main.VERSION=${NEXT_VERSION}")
- script:
name: add repo to artifact
code: |
cp -R ./ ${WERCKER_OUTPUT_DIR}
- script:
name: list output dir
code: |
ls -al ${WERCKER_OUTPUT_DIR}
deploy:
steps:
- script:
name: install-packages
code: |
sudo apt-get install -y openssh-client wget
ls -la
pwd
echo ${WERCKER_OUTPUT_DIR}
ls -la ${WERCKER_OUTPUT_DIR}
- wercker/add-ssh-key@1.0.2:
keyname: PCF_GITHUB_KEY
- wercker/add-to-known_hosts@1.4.0:
hostname: github.com
fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
- script:
name: set release id variable for version
code: |
go get github.com/xchapter7x/versioning
export WERCKER_GITHUB_CREATE_RELEASE_ID=`versioning bump_patch`-`git rev-parse HEAD | cut -c1-6`
- github-create-release:
token: $GITHUB_TOKEN
tag: $WERCKER_GITHUB_CREATE_RELEASE_ID
title: CF-MGMT $WERCKER_GITHUB_CREATE_RELEASE_ID
draft: true
- github-upload-asset:
token: $GITHUB_TOKEN
file: cf-mgmt-linux
release_id: $WERCKER_GITHUB_CREATE_RELEASE_ID
content-type: application/x-gzip
- github-upload-asset:
token: $GITHUB_TOKEN
file: cf-mgmt-osx
release_id: $WERCKER_GITHUB_CREATE_RELEASE_ID
content-type: application/x-gzip
- github-upload-asset:
token: $GITHUB_TOKEN
file: cf-mgmt.exe
release_id: $WERCKER_GITHUB_CREATE_RELEASE_ID
content-type: application/x-gzip