Skip to content
This repository has been archived by the owner on Jun 21, 2018. It is now read-only.

Commit

Permalink
create packages on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAkulov committed Mar 25, 2016
1 parent e612fd7 commit 60bd564
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
notifier/notifier
.coverprofile
build/
.vscode
50 changes: 33 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
language: go
sudo: false
go:
- 1.4
- 1.5
- 1.5.3
- 1.6
before_install:
- make prepare
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get github.com/modocache/gover
- go get github.com/golang/lint/golint
script:
- go vet -x ./...
- golint ./...
- cd tests
- ginkgo -r --randomizeAllSpecs -cover --failOnPending -coverpkg=../ --trace --race
- gover
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/9992cd0d36a6ba9bb40b
on_success: change
on_failure: always
on_start: never
before_install:
- sudo apt-get install -y rpm
- gem install fpm
- go get github.com/axw/gocov/gocov
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get github.com/modocache/gover
- go get github.com/golang/lint/golint
install:
- go vet -x ./...
- golint ./...
- make test
- gover
- goveralls -coverprofile=gover.coverprofile -service=travis-ci
script:
- make packages
before_deploy:
- export RELEASE_PKG_TAR=$(ls build/moira-notifier*.tar.gz)
- export RELEASE_PKG_RPM=$(ls build/moira-notifier*.rpm)
- export RELEASE_PKG_DEB=$(ls build/moira-notifier*.deb)
deploy:
provider: releases
api_key:
secure: kuNhaWPMfrzfLblZShTW6qD8K88l2Gmwc1AcmW74LqpqIgzjAP33DVvRP2vHLpRE1tDWB+79k1Z6sKEij+tbQfJ+KI31dzcLxB3TtCqnaxX3wa6oTlgvv3lVWJavKIZ4I9W8EJqQUa+FTIoAuTPpr8hNh5STCIztPmVX0uAJ+RpcNhiP/rJGL+Q7CFUmkJSc9i4wztULMVb1W/zBDYKFc8c49yb9ZkrqbCLLXr9itlMRSx5Dhpq/ad6rIXcrcpTL5Qf2Bs0TluSjl0dow2wbQuQci/DcG0gSDZIsaT3FOtBjDK1oc5hkQfzkMumZIBj4AHue0rtag61OfdDzvQUJe6WwCLfhtCYyqi1I7VE2wPK5WoroRB9S8aBn0UOWbnef3gXnXZhJisMhsXOaElKddKs1Sz1OvzVwe1vRWDAThjQmG59iQaTql9W26qhPc4ATr87PTWrFJZVe3Ty8++pU9yAxGCiGoNG1SVAwz382b0GtkOkrGDCLNukek+pI/MZEAc4eMbejIFoX5WgR2k34ANBOry1gBB/TMPvEhSzxogzg4YHjeuz1Y04g/O8PHJudlMe1BtX3b7ZdBEAY/4fC5oCz0sVi08uEiC/CG5CcpVHmXgWNPipJDvr9EnFnM5HLujxyDSM/WvHUx2VtPigQKG8aUILt05McO9FCHEESkIE=
file:
- "${RELEASE_PKG_TAR}"
- "${RELEASE_PKG_RPM}"
- "${RELEASE_PKG_DEB}"
skip_cleanup: true
on:
tags: true
condition: $TRAVIS_GO_VERSION = 1.5.3
33 changes: 26 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build:
go build -ldflags "-X main.Version=$(VERSION)-$(RELEASE)" -o build/moira-notifier github.com/moira-alert/notifier/notifier

test: prepare
ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --trace --race --progress tests
ginkgo -r --randomizeAllSpecs --randomizeSuites -cover -coverpkg=../ --failOnPending --trace --race --progress tests

.PHONY: test

Expand All @@ -22,25 +22,44 @@ prepare:
clean:
rm -rf build

rpm: clean build
tar:
mkdir -p build/root/usr/local/bin
mkdir -p build/root/usr/lib/systemd/system
mkdir -p build/root/etc/logrotate.d/

mv build/moira-notifier build/root/usr/local/bin/
cp pkg/rpm/moira-notifier.service build/root/usr/lib/systemd/system/moira-notifier.service
cp pkg/moira-notifier.service build/root/usr/lib/systemd/system/moira-notifier.service
cp pkg/logrotate build/root/etc/logrotate.d/moira-notifier

tar -czvPf build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz -C build/root .

rpm:
fpm -t rpm \
-s "dir" \
-s "tar" \
--description "Moira Notifier" \
--vendor $(VENDOR) \
--url $(URL) \
--license $(LICENSE) \
--name "moira-notifier" \
--version "$(VERSION)" \
--iteration "$(RELEASE)" \
--after-install "./pkg/postinst" \
--depends logrotate \
-p build \
build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz
deb:
fpm -t deb \
-s "tar" \
--description "Moira Notifier" \
-C build/root \
--vendor $(VENDOR) \
--url $(URL) \
--license $(LICENSE) \
--name "moira-notifier" \
--version "$(VERSION)" \
--iteration "$(RELEASE)" \
--after-install "./pkg/rpm/postinst" \
--after-install "./pkg/postinst" \
--depends logrotate \
-p build
-p build \
build/moira-notifier-$(VERSION)-$(RELEASE).tar.gz

packages: clean build tar rpm deb
File renamed without changes.
0 pkg/rpm/postinst → pkg/postinst
100755 → 100644
File renamed without changes.

0 comments on commit 60bd564

Please sign in to comment.