Skip to content

Commit 878d372

Browse files
committed
- [+] add travis with CI/CD building to bintray bin & repo
1 parent 1b35462 commit 878d372

4 files changed

Lines changed: 153 additions & 0 deletions

File tree

.travis.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# -*- yaml -*-
2+
3+
language: go
4+
# -*- yaml -*-
5+
6+
language: go
7+
8+
env:
9+
global:
10+
# Package setup (Ref: http://pkg-go.alioth.debian.org/packaging.html)
11+
- VERSION="${TRAVIS_TAG:=0.0~git$(date +%Y%m%d)-1}"
12+
- PKG_NAME="OpenSesame"
13+
- PKG_URL="https://github.com/suntong/OpenSesame"
14+
- PKG_CAT=utils
15+
- PKG_ARCH=amd64
16+
- PKG_DESC="Open Sesame -- One-time based file sharing"
17+
- PKG_VEND="suntong"
18+
- PKG_MAINT='Tong Sun <suntong@cpan.org>'
19+
- PKG_LICNS="MIT"
20+
# Build time setup
21+
- TZ=America/Toronto
22+
- DATE_BUILD=`date -I`
23+
24+
script:
25+
26+
- date
27+
- echo $DATE_BUILD $VERSION
28+
- echo
29+
30+
- go get -t -v ./...
31+
- go build -v -ldflags="-X main.date=$DATE_BUILD"
32+
- OpenSesame
33+
- go test -v ./...
34+
35+
- go get github.com/mitchellh/gox
36+
- gox -ldflags="-X main.date=$DATE_BUILD" -osarch="linux/386 linux/amd64 darwin/amd64 windows/amd64" -output="out/{{.Dir}}-{{.OS}}-{{.Arch}}"
37+
# linux/386 linux/amd64 linux/arm darwin/amd64 darwin/386 windows/amd64 windows/386
38+
# e.g.: out/OpenSesame-linux-amd64
39+
40+
# Create Debian Package
41+
- mkdir -p build
42+
- cp -v out/${PKG_NAME}-linux-amd64 build/${PKG_NAME}
43+
- gem install fpm --no-document
44+
- mkdir -p pkg
45+
- >-
46+
fpm --verbose -s dir -t deb
47+
--name ${PKG_NAME}
48+
--package pkg/${PKG_NAME}.deb
49+
--force
50+
--deb-compression bzip2
51+
--url "${PKG_URL}"
52+
--category ${PKG_CAT}
53+
--description "${PKG_DESC}"
54+
--maintainer "${PKG_MAINT}"
55+
--vendor "${PKG_VEND}"
56+
--license "${PKG_LICNS}"
57+
--version ${VERSION}
58+
--architecture ${PKG_ARCH}
59+
--depends apt
60+
--deb-compression gz
61+
./build/=/usr/bin/
62+
# --deb-compression gz: https://unix.stackexchange.com/questions/441032/
63+
- ar t pkg/${PKG_NAME}.deb
64+
65+
- sed -i -e "s/\$VERSION/$VERSION/" bintray-bin.json bintray-pkg.json
66+
- sed -i -e "s/\$DATE/$DATE_BUILD/" bintray-bin.json bintray-pkg.json
67+
68+
deploy:
69+
- provider: bintray
70+
user: suntong
71+
key: ${BINTRAY_API_KEY}
72+
file: bintray-bin.json
73+
skip_cleanup: true
74+
75+
- provider: bintray
76+
user: suntong
77+
key: $BINTRAY_API_KEY
78+
file: bintray-pkg.json
79+
skip_cleanup: true
80+
on:
81+
# tags: true

bintray-bin.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"package": {
3+
"name": "OpenSesame",
4+
"repo": "bin",
5+
"subject": "suntong",
6+
"desc": "Open Sesame -- One-time based file sharing",
7+
"website_url": "https://github.com/suntong/OpenSesame",
8+
"issue_tracker_url": "https://github.com/suntong/OpenSesame/issues",
9+
"vcs_url": "https://github.com/suntong/OpenSesame.git",
10+
"licenses": ["MIT"],
11+
"public_download_numbers": false
12+
},
13+
14+
"version": {
15+
"name": "$VERSION",
16+
"desc": "Release $VERSION",
17+
"released": "$DATE",
18+
"gpgSign": false
19+
},
20+
21+
"files": [{
22+
"includePattern": "out/(.*)", "uploadPattern": "$VERSION/$1",
23+
"matrixParams": {
24+
"override": 1
25+
}
26+
}],
27+
28+
"publish": true
29+
}

bintray-pkg.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"package": {
3+
"name": "OpenSesame",
4+
"repo": "deb",
5+
"subject": "suntong",
6+
"desc": "Open Sesame -- One-time based file sharing",
7+
"website_url": "https://github.com/suntong/OpenSesame",
8+
"issue_tracker_url": "https://github.com/suntong/OpenSesame/issues",
9+
"vcs_url": "https://github.com/suntong/OpenSesame.git",
10+
"licenses": ["MIT"],
11+
"public_download_numbers": false
12+
},
13+
14+
"version": {
15+
"name": "$VERSION",
16+
"desc": "Release $VERSION",
17+
"released": "$DATE",
18+
"vcs_tag": "$VERSION",
19+
"gpgSign": true
20+
},
21+
22+
"files": [{
23+
"includePattern": "pkg/(.*)\\.deb",
24+
"uploadPattern": "pool/main/o/$1_$VERSION_amd64.deb",
25+
"matrixParams": {
26+
"deb_distribution": "all",
27+
"deb_component": "main",
28+
"deb_architecture": "amd64",
29+
"override": 1
30+
}
31+
}],
32+
33+
"publish": true
34+
}

main_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main_test
2+
3+
import (
4+
"testing"
5+
)
6+
7+
func TestNothing(t *testing.T) {
8+
t.Logf("Dummy test passed")
9+
}

0 commit comments

Comments
 (0)