This repository has been archived by the owner on Jan 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
.travis.yml
65 lines (57 loc) · 2.06 KB
/
.travis.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
language: go
os:
- linux
go:
- 1.10.1
sudo: required
env:
- DEP_VERSION="0.4.1"
before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64
-o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep
install:
- dep ensure
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
script:
- go generate
- go test -v -covermode=count -coverprofile=coverage.out ./...
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
before_deploy:
# Grab the cross compiler
- go get github.com/karalabe/xgo
- |
# Get the full go repo url
REPO=$(pwd | rev | cut -d'/' -f-3 | rev)
# Get the name of the app
APP="${PWD##*/}"
# Get this tag as the version
VERSION=$(git describe --abbrev=0 --tags)
# Ensure a fresh build folder
rm -rf build && mkdir build
# Compile
xgo \
-dest build/ \
--targets=darwin-10.11/amd64,freebsd/386,freebsd/amd64,freebsd/arm,linux/386,linux/amd64,linux/arm \
--ldflags "-X main.version=${VERSION}" \
$REPO
# Package
cd build
# For each compiled binary, we're repackaging it in a zip with the architecture name, and
# renaming the binary to the app name
for FILE in $(ls .); do
mv $FILE $APP
tar cvzf ${FILE}.tgz $APP
rm -f $APP
done
cd ..
deploy:
provider: releases
api_key:
secure: RG9Hd77NoFS7NwMjDVyurbROV33bsefz8kW7XigfFDURTSfGAsMjyWR3wWt4qWCgCw2gMtszLlYp8yoX0xlHV38UslDscEKfvUnzWdHDPPgM2AtRyLFk5tYeOaX+t0VQDZA3KKgQRUitPgzC8SoaVdwQL5EhkvYKM4pUM2irvFYLT/pRIaP1yJ6gsrJqiybjpfpUHwH6VtgSLKjj6o6YBywr7LHSlrAGK2N+0eSncs5C0A0F+Jfs4NPPB0v2ke8SvHprN3V9pC51KZTWTuApKu+bAXxQbnZo4aOFdK52f7tO2uKj7xFbcCgpj8HDrypofX3HwzyAYV6Xd23vdhbHisJDkqwQpUW/hx/bWygGk/4b92D+yw9fMVgec/Lg03+evXkXJZ0ZsRSuANrKtsgVk8+8RsH/eGgsMAK7eISESxVkAW8C2CIPjvRP6E5F7I6fW8v7nj1SJZablCCNRAD20E3ICkXkhJTADWHcxEr2Bnl/m4RJNUsrO5OJeY1E2zbWJwwqIRGK5O0NtaTfRvcPgI2iJ9dmenJFUttYm1631C5MIFKFCISBrIBdTIiOVZa5xWKek18ReKblrT6ARyg1yxk5b7PvAbnmp+jfYvj9d9hYaKYmbASGC2m9Qa7M+mpCbrElrZ9EB6KD98lJUXjAZXpcmGBWnxXpglxBSM2O1gg=
file_glob: true
file: "build/*"
skip_cleanup: true
on:
tags: true