|
| 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 |
0 commit comments