Skip to content

Commit 9973806

Browse files
authored
Merge pull request #49 from square/cs/auto-release
Auto releases
2 parents 20bf3b1 + 9cafaff commit 9973806

4 files changed

Lines changed: 26 additions & 14 deletions

File tree

.travis.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
language: go
2-
32
sudo: false
4-
53
go:
64
- 1.5.x
7-
- 1.6.x
8-
- 1.7.x
9-
- 1.8.x
105
- 1.9.x
11-
- tip
12-
6+
deploy:
7+
provider: releases
8+
api_key:
9+
secure: 'kewugKeaEgDvNMaapSbhMTgWXO1tje4sbyF8D77lbceOviTfKZkDKuuwVSwTU1NTKuHk5DnC00Rrfy7d4HP1xPT94P4AnI6oEjUvQvi43U8Ub/YGbrwTAZpqUyZJWwmkHaEikeFRIRuyTnHztM8/IQaEQyOvxtu2NOFnMVCpagQ='
10+
file:
11+
- bin/certstrap-${TRAVIS_TAG}-linux-amd64
12+
- bin/certstrap-${TRAVIS_TAG}-darwin-amd64
13+
- bin/certstrap-${TRAVIS_TAG}-windows-amd64
14+
skip_cleanup: true
15+
on:
16+
tags: true
17+
go: 1.9
1318
install:
1419
- go get -d -t -v ./...
1520
- go get github.com/tools/godep
16-
1721
before_script:
1822
- ./build
19-
2023
script:
2124
- ./test

build

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
ORG_PATH="github.com/square"
66
REPO_PATH="${ORG_PATH}/certstrap"
7+
BUILD_TAG="${TRAVIS_TAG:-$(git describe --all | sed -e's/.*\///g')}"
78

89
export GOPATH=${PWD}/gopath
910

@@ -13,4 +14,6 @@ ln -s ${PWD} $GOPATH/src/${REPO_PATH}
1314

1415
eval $(go env)
1516

16-
go build -o bin/certstrap ${REPO_PATH}
17+
GOARCH=amd64 GOOS=linux go build -o bin/certstrap-${BUILD_TAG}-linux-amd64 ${REPO_PATH}
18+
GOARCH=amd64 GOOS=darwin go build -o bin/certstrap-${BUILD_TAG}-darwin-amd64 ${REPO_PATH}
19+
GOARCH=amd64 GOOS=windows go build -o bin/certstrap-${BUILD_TAG}-windows-amd64 ${REPO_PATH}

test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ if [ -z "$PKG" ]; then
88
PKG="cmd depot pkix tests"
99
fi
1010

11+
export BUILD_TAG="${TRAVIS_TAG:-$(git describe --all | sed -e's/.*\///g')}"
12+
1113
# Unit tests
1214
echo
1315
for mod in $PKG; do

tests/basic_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ import (
2323
"os/exec"
2424
"strings"
2525
"testing"
26+
"runtime"
27+
"fmt"
28+
"os"
2629
)
2730

2831
const (
29-
binPath = "../bin/certstrap"
30-
depotDir = ".certstrap-test"
31-
hostname = "host1"
32-
passphrase = "123456"
32+
depotDir = ".certstrap-test"
33+
hostname = "host1"
34+
passphrase = "123456"
3335
)
3436

37+
var binPath = fmt.Sprintf("../bin/certstrap-%s-%s-amd64", os.Getenv("BUILD_TAG"), runtime.GOOS)
38+
3539
func run(command string, args ...string) (string, string, error) {
3640
var stdoutBytes, stderrBytes bytes.Buffer
3741
args = append([]string{"--depot-path", depotDir}, args...)

0 commit comments

Comments
 (0)